It can be any area/s of heavy calculation, eg an indicator calling another indicator, lengthy manipulations or comparisons of long arrays, etc
Maybe calculating once per bar would do it - but only if you are not using unclosed values...
It can be any area/s of heavy calculation, eg an indicator calling another indicator, lengthy manipulations or comparisons of long arrays, etc
Maybe calculating once per bar would do it - but only if you are not using unclosed values...
Hi BB,
Is it preferble using higher timeframe to calculate once or lower TF, e.g. M15 and M30??
Thanks
Start with M1 and test upwards - the higher you can go, the quicker the back-testing will be but at some stage the signals will not be checked often enough.
On short-term trend EA's I look for opening-trade signals once each M5 bar but check trailing stops every tick
Start with M1 and test upwards - the higher you can go, the quicker the back-testing will be but at some stage the signals will not be checked often enough.
On short-term trend EA's I look for opening-trade signals once each M5 bar but check trailing stops every tick
Hi BB
Brings up interesting point, I assume that if there is an open,or pending order then at every tick the system checks to see if a stop, take profit or entry criterion has been satisfied, after that control passes to the start function and then proceeds to the first executable statement in the start function. This assumes that the time interval between ticks is long enough to test all positions before proceeding to start. Like you I like to enter on completed bars and only calculate entry/exit postions on completed bars. Is my assumption correct?
Keith
KM
>> if there is an open,or pending order then at every tick the system checks to see if a stop, take profit or entry criterion has been satisfied
Yes
>> after that control passes to the start function and then proceeds to the first executable statement in the start function
Well, 'the rest of' the start() function
init() only fires once on load of the EA to the chart
deinit() only fires once on unload of the EA to the chart, change of Profile or closure of the terminal
start() runs every tick - if your code has finished processing the prior one...
You must not assume that it will finish, so if in doubt, use RefreshRates() to get the latest prices where relevant
Good Luck
-BB-
BB
"...so if in doubt, use RefreshRates() to get the latest prices where relevant"
Are you saying that if EA not exit in eg, time during which terminal receives 2 server ticks, that by calling RefreshRates() the Close[0] will be the last tick value of the 2 missed ticks ?
or asked another way - while in start() 5 server ticks incomming to terminal. At some point EA calls RefreshRates(). Will the only available data tick be the last received tick which is accessed by Close[0] ? and other 4 older ticks will not be accessable ?
So basically, last data tick is Close[0] ?
> if start() entered every terminal incomming tick OR
> if start() NOT entered for a while but when entered at some point calls RefreshRates() before access Close[0]
fbj
FBJ
You certainly need to RefreshRates() to be sure of getting the current latest Bid/Ask
I believe that the latest Close[0] etc is also only available after RefreshRates() but am not certain - I do it anyway!
Tick data occuring between the one that initiated the start() and the next call of RefreshRates() will not be accessible to the EA you're in
If this is a problem, another EA could be used doing nothing else but collecting tick data into a global array...?
Would need Rosh, Stringo, Collector or Phy in here to confirm - one of them may drop in soon
-BB-
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Admin,
I was told to check my logics in order to fix EA's testing time that is more than 5Min.
Is it the order entry logic or the trailing stop or the exit logics to fix, pls enlight me more??
Isaac.