Download MetaTrader 5
To add comments, please log in or register
Publish your article. We will translate it into other languages!
wayneb87
16
wayneb87 2014.10.08 20:16 

hi everybody..

I'm working on a simple EA,. I realized that my SL & TP keep on changing after testing it on demo..

Initially, I set input parameters, SL =10 pips, TP = 10 pips..but it keep on changing and appear on a trade SL =9 pips, TP = 11 pips/ SL =8 pips, TP = 12 pips/ SL =11 pips, TP = 9 pips/ SL =12 pips, TP = 9 pips,...

 

please, can someone explain to me why is this happening,..and kindly solve my problem,.thanks

Keith Watford
Moderator
7951
Keith Watford 2014.10.08 22:16  
Slippage
Alain Verleyen
Moderator
28606
Alain Verleyen 2014.10.08 22:26  
GumRai:
Slippage
There is no slippage on demo account.
Alain Verleyen
Moderator
28606
Alain Verleyen 2014.10.08 22:33  
wayneb:

hi everybody..

I'm working on a simple EA,. I realized that my SL & TP keep on changing after testing it on demo..

Initially, I set input parameters, SL =10 pips, TP = 10 pips..but it keep on changing and appear on a trade SL =9 pips, TP = 11 pips/ SL =8 pips, TP = 12 pips/ SL =11 pips, TP = 9 pips/ SL =12 pips, TP = 9 pips,...

 

please, can someone explain to me why is this happening,..and kindly solve my problem,.thanks

How do you calculate these values 9-11/8-12/11-9, etc... Can you show your trades history ?
Keith Watford
Moderator
7951
Keith Watford 2014.10.09 00:56  
angevoyageur:
There is no slippage on demo account.

Are you sure about that?

The OP does not use RefreshRates() in the code and it is quite possible that the loops could take some time to execute, therefore missing ticks.

So, on demo, a trade will be placed at the Ask price loaded when start() is called, no matter whether ticks have been missed or not? 

wayneb87
16
wayneb87 2014.10.09 06:03  
angevoyageur:
How do you calculate these values 9-11/8-12/11-9, etc... Can you show your trades history ?
yes sure..
wayneb87
16
wayneb87 2014.10.09 07:17  
GumRai:

Are you sure about that?

The OP does not use RefreshRates() in the code and it is quite possible that the loops could take some time to execute, therefore missing ticks.

So, on demo, a trade will be placed at the Ask price loaded when start() is called, no matter whether ticks have been missed or not? 


Do you propose reducing slippage or no slippage at all? 
Alain Verleyen
Moderator
28606
Alain Verleyen 2014.10.09 08:46  
wayneb:
yes sure..
?
Alain Verleyen
Moderator
28606
Alain Verleyen 2014.10.09 09:19  
GumRai:

Are you sure about that?

The OP does not use RefreshRates() in the code and it is quite possible that the loops could take some time to execute, therefore missing ticks.

So, on demo, a trade will be placed at the Ask price loaded when start() is called, no matter whether ticks have been missed or not? 

Yes I am sure.

Even if the loops take too much time (which is possible here if trades history if very large), and your price doesn't correspond to actual price, you will get an Invalid price error(129).

/
To add comments, please log in or register