bug!!!

 

there is abug in stratagy tester....


here at 1.1605 both sl of buy and tp of sell stop should get triggered at same time .....but it happens one after another..leading to a buy stop bw s/l and t/p...bug

 
Already heard of a thing called spread?
 

Can you explain why you think there is a bug in the strategy tester and not a bug in your code that produces the behavior you believe is a problem? 

From what little you have posted, this doesn't appear to be a problem with the strategy tester.  Your code executed a buy (OP_BUY) order (# 1) for 0.01 lots at 1.1625 with a stoploss of 1.1605 and takeprofit of 1.1636; it also opened a pending sell (OP_SELLSTOP) order (# 2) for 0.03 lots at 1.1614 with s stoploss at 1.1636 and takeprofit at 1.1605.  The price continued downward and hit order #2's open price of 1.1614; the price continued to fall to 1.1605.  At this moment, order #1 was closed at the stoploss, and order #2 was closed at the takeprofit.  The question of why a pending buy (OP_BUYSTOP) order was entered (and when) can only be answered by looking at your code--the strategy tester doesn't just enter random trades; instead, your code must enter a trade.  So, as I said at the beginning, explain why you think it is a problem with the tester and not your code and post relevant portions of your code, so we can see what your code is doing. 

 
Thirteen:

Can you explain why you think there is a bug in the strategy tester and not a bug in your code that produces the behavior you believe is a problem? 

From what little you have posted, this doesn't appear to be a problem with the strategy tester.  Your code executed a buy (OP_BUY) order (# 1) for 0.01 lots at 1.1625 with a stoploss of 1.1605 and takeprofit of 1.1636; it also opened a pending sell (OP_SELLSTOP) order (# 2) for 0.03 lots at 1.1614 with s stoploss at 1.1636 and takeprofit at 1.1605.  The price continued downward and hit order #2's open price of 1.1614; the price continued to fall to 1.1605.  At this moment, order #1 was closed at the stoploss, and order #2 was closed at the takeprofit.  The question of why a pending buy (OP_BUYSTOP) order was entered (and when) can only be answered by looking at your code--the strategy tester doesn't just enter random trades; instead, your code must enter a trade.  So, as I said at the beginning, explain why you think it is a problem with the tester and not your code and post relevant portions of your code, so we can see what your code is doing. 


in the above picture u see a buy stop placed in bw s/l and t/p....that is a bug in tester...both s/l and t/p should happen simultaneously one after another as price reaches 1.1605...


as it doesn't happen simultaneously so my ea  places a buy stop order in bw them which is a part of coding only and its not a programming error...

 
ankit29030:

in the above picture u see a buy stop placed in bw s/l and t/p....that is a bug in tester...both s/l and t/p should happen simultaneously one after another as price reaches 1.1605...


as it doesn't happen simultaneously so my ea  places a buy stop order in bw them which is a part of coding only and its not a programming error...


SPREAD. Ask != Bid. Sells close at Bid, Buys close at Ask


Its not a bug, it's forex and beginner trading knowledge. It will happen also on live accounts, depending on market conditions speard can be very high.

!!!! READ THIS BEFORE PLACING ANY ORDER WITH REAL MONEY !!!!

http://www.babypips.com/school/how-you-make-money-in-forex.html

 
zzuegg: SPREAD. Ask != Bid. Sells close at Bid, Buys close at Ask
The OTHER way. Buy's open at the Ask and close at the Bid. Sells open at the Bid and close at the Ask.
 
WHRoeder:
The OTHER way. Buy's open at the Ask and close at the Bid. Sells open at the Bid and close at the Ask.

true, true. sry
 
ankit29030:

both s/l and t/p should happen simultaneously one after another as price reaches 1.1605...


This is an incorrect statement.  As both zzuegg and WHRoeder suggested, order #1 closes at a bid price of 1.1605, whereas order #2 closes at an ask price of 1.1605.  Remember: you buy at the Ask price and sell at the Bid price.  Lets assume there is a 3 pip spread.  When order #1 was executed, the ask price was 1.1625 and the bid price was 1.1622; additionally, when order #1 closed (stopped out), the ask price was 1.1608 and the bid price was 1.1605.  Compare that with order #2.  When order #2 was executed, the ask price was 1.1617 and the bid price was 1.1614; and when order #2 closed (takeprofit), the ask price was 1.1605 and the bid price was 1.1602.  Accordingly, as correctly depicted in the strategy tester, order #1 was closed before order #2 was closed.  Therefore, the behavior you've highlighted is not a bug in the strategy tester.

Presumably (since you've posted no code, I can only presume), once the buy order (order #1) was closed (which left only the active sell order), your code determined that a new buy (OP_BUYSTOP) order needed to be placed and placed it (order #3).  Some time thereafter, the sell order (order #2) hit its takeprofit price, and your code determined that the pending buy order (order #3) should be deleted and deleted it.  If this sequence of events is not what you want, then you will need to change your code.

 
Thirteen:


This is an incorrect statement.  As both zzuegg and WHRoeder suggested, order #1 closes at a bid price of 1.1605, whereas order #2 closes at an ask price of 1.1605.  Remember: you buy at the Ask price and sell at the Bid price.  Lets assume there is a 3 pip spread.  When order #1 was executed, the ask price was 1.1625 and the bid price was 1.1622; additionally, when order #1 closed (stopped out), the ask price was 1.1608 and the bid price was 1.1605.  Compare that with order #2.  When order #2 was executed, the ask price was 1.1617 and the bid price was 1.1614; and when order #2 closed (takeprofit), the ask price was 1.1605 and the bid price was 1.1602.  Accordingly, as correctly depicted in the strategy tester, order #1 was closed before order #2 was closed.  Therefore, the behavior you've highlighted is not a bug in the strategy tester.

Presumably (since you've posted no code, I can only presume), once the buy order (order #1) was closed (which left only the active sell order), your code determined that a new buy (OP_BUYSTOP) order needed to be placed and placed it (order #3).  Some time thereafter, the sell order (order #2) hit its takeprofit price, and your code determined that the pending buy order (order #3) should be deleted and deleted it.  If this sequence of events is not what you want, then you will need to change your code.


ok then ..thank u for complete explanation...can i code my file to close all pending and market orders as soon as a tp or sl hit??like in above case as sl hit close all my positions..
 
ankit29030:

ok then ..thank u for complete explanation...can i code my file to close all pending and market orders as soon as a tp or sl hit??like in above case as sl hit close all my positions..
Yes,  but if you want a Sell to close at an apparent "Bid price" you have to allow for the spread when you set your SL and TP and if the spread widens or narrows it will not close at the price you wanted.  Sells close by way of a Buy,  a Buy is executed at Ask . . . . there is no way around this fact.
 
RaptorUK:
Yes,  but if you want a Sell to close at an apparent "Bid price" you have to allow for the spread when you set your SL and TP and if the spread widens or narrows it will not close at the price you wanted.  Sells close by way of a Buy,  a Buy is executed at Ask . . . . there is no way around this fact.


thats no prob because i'm provided with fixed spread of 1pip on EUR/USD.
Reason: