You can find many examples. Especially the "code for beginners" series, you might not be a beginner coder generally speaking, but that's aside from the point if it's helpful code.
How you use CopyBuffer in an EA in MQL5 is much different than how you use CopyBuffer in an indicator. In an EA you only care about 1 bar, in an indicator you use rates_total (all bars/rates)
You can find many examples. Especially the "code for beginners" series, you might not be a beginner coder generally speaking, but that's aside from the point if it's helpful code.
How you use CopyBuffer in an EA in MQL5 is much different than how you use CopyBuffer in an indicator. In an EA you only care about 1 bar, in an indicator you use rates_total (all bars/rates)
Thanks, It was helpful but the point is my indicator A is a higher time frame indicator (MN) and I want to use it in lower time frame (D1) so it takes time to get ready the indicator A.
Do you have any Idea how to say "wait until indicator A is ready", I don't want to start count bars in indicator B in D1 until indicator A is ready.
Thanks, It was helpful but the point is my indicator A is a higher time frame indicator (MN) and I want to use it in lower time frame (D1) so it takes time to get ready the indicator A.
Do you have any Idea how to say "wait until indicator A is ready", I don't want to start count bars in indicator B in D1 until indicator A is ready.
You could try to use CopySeries
bool CheckSufficientBars()
{
// Define number of bars to wait before considering indicator A readyint bars = 500;
double buf_a[];
double buf_b[];
ArrayResize(buf_a, bars);
ArrayResize(buf_b, bars);
// Copy the series data for the required number of barsint copied_a = CopySeries(Symbol(), PERIOD_MN1, 0, bars, COPY_RATES_CLOSE, buf_a);
int copied_b = CopySeries(Symbol(), PERIOD_D1, 0, bars, COPY_RATES_CLOSE, buf_b);
if(copied_a >= bars && copied_b >= bars){
returntrue;
}
else {
returnfalse;
}
}
the codebase is your friend, here's one of my basic publications which uses copybuffer and icustom
https://www.mql5.com/en/code/46924
You can find many examples. Especially the "code for beginners" series, you might not be a beginner coder generally speaking, but that's aside from the point if it's helpful code.
How you use CopyBuffer in an EA in MQL5 is much different than how you use CopyBuffer in an indicator. In an EA you only care about 1 bar, in an indicator you use rates_total (all bars/rates)
the codebase is your friend, here's one of my basic publications which uses copybuffer and icustom
https://www.mql5.com/en/code/46924
You can find many examples. Especially the "code for beginners" series, you might not be a beginner coder generally speaking, but that's aside from the point if it's helpful code.
How you use CopyBuffer in an EA in MQL5 is much different than how you use CopyBuffer in an indicator. In an EA you only care about 1 bar, in an indicator you use rates_total (all bars/rates)
Thanks, It was helpful but the point is my indicator A is a higher time frame indicator (MN) and I want to use it in lower time frame (D1) so it takes time to get ready the indicator A.
Do you have any Idea how to say "wait until indicator A is ready", I don't want to start count bars in indicator B in D1 until indicator A is ready.
Thanks, It was helpful but the point is my indicator A is a higher time frame indicator (MN) and I want to use it in lower time frame (D1) so it takes time to get ready the indicator A.
Do you have any Idea how to say "wait until indicator A is ready", I don't want to start count bars in indicator B in D1 until indicator A is ready.
You could try to use CopySeries
You could try to use CopySeries
Thanks to you, my problem got solved by this way :)
Thanks everybody else