@roar
Thank you for your guidance
Your solution was completely correct and my problem was solved.

@roar
Thank you for your guidance
Your solution was completely correct and my problem was solved.

@l-andorrĂ Thank you
I found a post on @roar's profile that I think has my answer.
https://fxdreema.com/forum/topic/17851/transformation-of-profit-loss-into-price-level
I will check it more to find a suitable solution.
@tec-nacks Thanks for letting me know
I'll test it now.
@tec-nacks
Thank you
Do you know when this happened
Because I don't think it happened until yesterday...
Hi FXDreema team, @fxDreema
I'm encountering an issue with an EA generated by FXDreema, specifically an "array out of range" error in the OnChartEvent, OnTimer function.
This seems to happen when I switch timeframes, and I believe it’s related to the generated code rather than anything I’ve added.
Here’s the relevant code:
void OnChartEvent(
const int id, // Event ID
const long& lparam, // Parameter of type long event
const double& dparam, // Parameter of type double event
const string& sparam // Parameter of type string events
)
{
//-- write parameter to the system global variables
FXD_ONCHART.id = id;
FXD_ONCHART.lparam = lparam;
FXD_ONCHART.dparam = dparam;
FXD_ONCHART.sparam = sparam;
//-- run blocks
int blocks_to_run[] = {39,52,60,62,64,66,68,70,72,74,76,78,80,81,85,86,88,90,92,94,96,101,115,127,131,137,139,142,143,150,156,163,165,177,185,187,191,202,213,221,226,229,231,237,249,251,255,258,263,269,282,284,290,301,303,309,320,322,334,343,349,356,359,367,374,381,419,425,463,465,468,469,470,471,472,476,477,570,572,573,599,600,602,604,606,608,610,611,612,617,618,619,623,624,625,629,630,633,634,635,639,642,643,662,668,669,672,673,674,678,679,682,684,686,688,690,692,693,694,698,699,704,705,744,745,754,772,774,776,778,780,782,784,786,788,828,830,832,834,858,861,862,863,864,889,892,895,897,903,941,963,965,969,971,973,976,978,980,992,997,1015,1017,1019,1025,1026,1028,1031,1033,1046,1066,1069,1082,1098,1153,1159,1163,1167,1171,1176,1177,1182,1188,1189,1190,1191,1196,1197,1198,1199,1204,1205,1206,1207,1211,1212,1213,1214,1219,1240,1242,1270,1271,1272,1273,1279};
Print(ArraySize(blocks_to_run));
Print("Size of _blocks_: ", ArraySize(_blocks_));
for (int i=0; i<ArraySize(blocks_to_run); i++) {
_blocks_[blocks_to_run[i]].run();
}
return;
}
To debug, I added some print statements:
Print(ArraySize(blocks_to_run)); returns 205, which seems correct.
Print("Size of blocks: ", ArraySize(blocks)); returns 1301 normally, but when I switch timeframes, it drops to 0, and that’s when the “array out of range” error occurs.
I’m using MetaTrader 5. Could you please take a look and suggest a fix or workaround?
Thanks for your help!
Dear friend, now the conditions that you placed will only be checked by EA and in the same market on which the EA was run.
To check all markets and all trades, make the changes I specified in the picture.

Hello @roar
I want to know the amount of tp and sl in currency (not in price or pip).
I read your post and created a project based on it.
But unfortunately, it does not work properly in different markets.
I am sending the picture of the result in Eurusd and Nasdaq market as an example.
@l-andorrĂ Thank you
I found a post on @roar's profile that I think has my answer.
https://fxdreema.com/forum/topic/17851/transformation-of-profit-loss-into-price-level
I will check it more to find a suitable solution.
@l-andorrĂ Thanks for your help...
Is there a specific formula for different markets? If you know a suitable reference for the calculation formula in different markets, I would be grateful if you could send it to me.
@l-andorrĂ thank you
My problem is solved
The solution is to use ChartRedraw();