Stop orders rejected because too close to current price
Forums › ProRealTime English forum › ProOrder support › Stop orders rejected because too close to current price
- This topic has 7 replies, 3 voices, and was last updated 5 years ago by
BC.
-
-
12/08/2020 at 5:54 AM #152932
Yes, in backtesting everything works fine and looks great. But when it comes to live trading some parameters change.
So my strategy enters a trade using STOP orders. And I am struggling at the moment with the situation, that somethings the algo calculates the levels of the STOPs to close to the current price, so that IG rejects the STOP orders and the strategy stops.
Any idea how to prevent this? How can I identify what the minimal distance of points to the current price must be on financial instrument level?
Thanks
12/08/2020 at 7:27 AM #152934There’s no way to know what that distance is at runtime and it changes when there’s high volatility or news.
You should check what it is with IG, then use this code to make sure your SL is not below:
1234Once Distance = 10..MyStopLoss = max(MyStopLoss, Distance)this will not guarantee your strategy will never be stopped again when exceptions occur, but most of the times it will.
1 user thanked author for this post.
12/08/2020 at 9:14 AM #15293912/08/2020 at 12:07 PM #15295512/08/2020 at 1:40 PM #152970You need to apply that code whenever you place an order, be it a SET STOP LOSS or a PENDING LIMIT/STOP order (not AT MARKET).
Before you place the order make a difference between the current price (CLOSE) and your desired entry price, then check that it’s not less than the required distance:
1234567ONCE Distance = 10 * pipsize..IF MyLongConditions AND close > close[1] THEN //your long conditions on a raising marketEntryPrice = min(Close - Distance,low[1]) //enter al the lowest price between LOW[1] and CLOSE-Distance to make sure your order is not rejectedBUY 1 CONTRACT AT EntryPrice LIMITENDIFin this case say you want to enter LIMIT at LOW[1] on a raising market, so you want to make sure that the entry price is at least within DISTANCE pips from the current price (CLOSE) at the very moment you place the order.
Obviously you will have to check with IG what is the correct value for DISTANCE (if any).
12/08/2020 at 2:40 PM #152975Thanks for your suggestion, Robertogozzi.
But actual syntax is as below:-
1234567891011ONCE Distance = 10 * pipsizeInitialTargetPrice = DClose(1) + AverageTrueRange[20](Close)If LongCondition thenFinalTargetPrice = Max(InitialTargetPrice, CurrentPrice + Distance)Buy 1 Contract at FinalTargetPrice StopEndIfSo I wondering what command can replace the CurrentPrice?
12/08/2020 at 3:34 PM #152980CLOSE is the current price.
In strategies it’s the last price of the most recently closed candle since currently forming candles cannot be accessed, while in indicators and screeners it’s the last price of the candle being formed.
12/09/2020 at 6:34 AM #153041 -
AuthorPosts
Find exclusive trading pro-tools on