How can I connect close price of candles?

How can I connect close price of candles?

Manage alerts

Loading saved threads...

PineEditor22 · External communityPost link
External question — Stack Overflow Stack Exchange Author: PineEditor22 Original post: https://stackoverflow.com/questions/79373951 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am new to mql5. I want to write the code to connect the close prices of candles to each other in an expert advisor file. In Pine script, it is: plot(close) In mql5 I can use something like this, but it creates numerous parallel lines. int numberOfCandles = Bars(_Symbol, PERIOD_CURRENT); ObjectCreate(0, "close" + numberOfCandles, OBJ_HLINE, 0, 0, close);
Quote
Report
PineEditor22 · External communityPost link
External answer — Stack Overflow Stack Exchange Author: PineEditor22 Original post: https://stackoverflow.com/a/79379991 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. It is possible by using an indicator, and then calling that indicator in the expert advisor codes by iCustom function. This is the code for the indicator: #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrYellow #property indicator_width1 1 double Buffer1[]; int OnInit() { SetIndexBuffer(0,Buffer1,INDICATOR_DATA); return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { if (prev_calculated>=0) ArrayCopy(Buffer1, close, prev_calculated, prev_calculated, rates_total); return(rates_total - 1); } reference for more information: https://www.mql5.com/en/forum/480025
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: PineEditor22 Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/79379991 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. It is possible by using an indicator, and then calling that indicator in the expert advisor codes by iCustom function. This is the code for the indicator: #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrYellow #property indicator_width1 1 double Buffer1[]; int OnInit() { SetIndexBuffer(0,Buffer1,INDICATOR_DATA); return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { if (prev_calculated>=0) ArrayCopy(Buffer1, close, prev_calculated, prev_calculated, rates_total); return(rates_total - 1); } reference for more information: https://www.mql5.com/en/forum/480025

Cancel quote

Checking account access…