Sorry if that wasn't clear: it closes and re-opens all positions as per De-Init en Init.
that a chunk of spread and commission gone to waste :-(
I'd like the EA to continue to run on the chart regardless of changing the time frame...
Route206:
i cannot change the timeframe of the Chart it runs on (e.g. from 5m, to 15m) withouth the EA DiInit-ing and re-Init-ing. it closes and re-opens all positions as per De-Init en Init. that a chunk of spread and commission gone to waste :-( I'd like the EA to continue to run on the chart regardless of changing the time frame... |
|
Thanks - from my amount of posts here you can safely assume i'm a newbie, so i need some time to digest your response.
To be clear though: If you say '"Don't close trades and nothing is wasted" then that is exactly what i'm trying to accomplish here!
My EA is recovering fine, even when it shouldn't have collapsed to begin with (upon change of chart timeframe..)
OK - i've come to accept that changing timeframe on a chart with an Active EA, will cause it to DeInit() and Init() again. That said, is there no way i can get like a pop-up warning "This Chart has Active EA, are you sure?, y/n" kind of thing?
Sorry to nag on this one, but, clumsy me, it continues happen inadvertently and it is really, really annoying.
I'm ok if i'm the dumbest one here, but would really appreciate some pointers.. Pop up would solve it for me..
When running, i cannot change the timeframe of the Chart it runs on (e.g. from 5m, to 15m) withouth the EA DiInit-ing and re-Init-ing.
can someone enlighten me?
Actually I can help in case you have the source code of your Indicator. There is a way to test for timeframe changes and once the test for timeframe changes is true, you can return from the DeInit() method without actually de-initing. I know this, because I ran into a similar issue not long ago. Please have a look here:
[1] Performance issue on timeframe changes
If you scroll down at the close bottom, you find two source codes attached. Please take the boost_2.mp4 and copy out the if (...) statement at the top of the DeInit(); method and paste it into your own source.
if (UninitializeReason() == REASON_CHARTCHANGE) { return; }
Now you can change timeframe without actually DeInit'ing. Normal remove of the Indicator or closing terminal of course de'inits.
Oh! And you most likely need to add the same in the OnInit(); method at the top because on each DeInit(); follows a new OnInit();

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a simple EA that takes and closes positions based on a grid.
When running, i cannot change the timeframe of the Chart it runs on (e.g. from 5m, to 15m) withouth the EA DiInit-ing and re-Init-ing.
Since my EA is completely independant of the timeframe (not an indicator of any sort) I'm probably overlooking something stupid.
can someone enlighten me?
thanks!