MQL4 - automated forex trading   /  

Forum

FIX EA LOGICS

Back to topics list To post a new topic, please log in or register

avatar
157
asiko79 2008.09.01 17:50 

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.

article

Technical Analysis: Make the Impossible Possible!

The article answers the question: Why can the impossible become possible where much suggests otherwise? Technical analysis reasoning.


avatar
1236
BarrowBoy 2008.09.01 18:04 

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...


avatar
157
asiko79 2008.09.01 18:40 
BarrowBoy wrote >>

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


avatar
1236
BarrowBoy 2008.09.02 13:40 

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


avatar
173
kminler 2008.09.03 02:41 
BarrowBoy wrote >>

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


avatar
1236
BarrowBoy 2008.09.04 14:13 

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-


avatar
747
fbj 2008.09.04 15:03 

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


avatar
1236
BarrowBoy 2008.09.04 15:28 

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-


avatar
747
fbj 2008.09.04 15:45 
BB - quick turnaround ;)
Back to topics list  

To add comments, please log in or register