Download MetaTrader 5

Very Simple Question about Special Functions

To add comments, please log in or register
Kevin Kim
35
Kevin Kim  

So my understanding is that OnStart() is where you put trading algorithm for opening and closing positions

but any changes in the currency pairs price during the execution of OnStart() are ignored.


If, then, how would I set it such that once the positions are opened, my closing algorithm would monitor current price changes

until optimal exit condition is met, and exits?

Marco vd Heijden
Moderator
5335
Marco vd Heijden  
when orders total is >0 above zero.
Fstrifoerr8
36
Fstrifoerr8  
Kevin Kim:

So my understanding is that OnStart() is where you put trading algorithm for opening and closing positions

but any changes in the currency pairs price during the execution of OnStart() are ignored.


If, then, how would I set it such that once the positions are opened, my closing algorithm would monitor current price changes

until optimal exit condition is met, and exits?

use 

1) OnTick()

or

2) RefreshRates() 

whroeder1
15719
whroeder1  
Kevin Kim:

So my understanding is that OnStart() is where you put trading algorithm for opening and closing positions but any changes in the currency pairs price during the execution of OnStart() are ignored.

If, then, how would I set it such that once the positions are opened, my closing algorithm would monitor current price changes until optimal exit condition is met, and exits?

  1. OnStart is only for scripts, OnTick is for EAs
  2. Correct.
  3. Scripts: Sleep, RefreshRates, and retest. EAs, return and retest on next tick.
To add comments, please log in or register