Orders being Rejected
Forums › ProRealTime English forum › General trading discussions › Orders being Rejected
- This topic has 5 replies, 3 voices, and was last updated 2 days ago by MacroT.
-
-
01/15/2025 at 3:39 PM #242639
I trade auto strategies via IG and from time to time I get the following message
“order status: rejected order rejected by the broker or the market
The order level you have requested is too close to current market level , The minimum distance is X points ”
As the broker has widened the the limit level for the market to X points.
When this happens the strategy is stopped and I have to manually make it active
This usually happens during economic releases but can happen at other times. Also they can change the level it is widened to , for example for S&P 500 it can be a low as 1 point but it can be as wide as 40 points
I would like to know if there are any lines of code that can be added to prevent this from happening within the strategy coding , hence prevent the order being rejected and the strategy being stopped ?
Ideally, it would be great having something in the ‘ProOrder AutoTrading’ screen that allows you to click a check box to allow such instances to be executed at market when PRT receives such a rejectiom request or even better would be for the limit to be widened by y Points each time it is rejected until it gets executed
Thanks
01/15/2025 at 3:43 PM #24264001/15/2025 at 5:13 PM #242642Yes I am, but from my understanding of this functionality it only changes the stops once the order has executed. So if a live order has to adjust its stop and the broker has widened the minimum distance then it will adjust accordingly.
My issue is similar but on the actual order being executed in the first instance. Ticking this box does not resolve this for the parent order being initially executed if the limit is less than that set by the broker for the instrument
1 user thanked author for this post.
01/15/2025 at 5:24 PM #242643Yes, you need to set a minimum distance large enough to prevent that error when using pending orders (STOP and LIMIT ones), as for AT MARKET orders there’s no such issue. If the required distance for an instrument is, say, 6 pips, you can set that distance to 10+ to try to prevent your strategy from being stopped. Unfortunately there’s no way to know when the broker modify that limit and by how many points. So, there’s no guarantee that setting that distance to twice the regular requirement will do.
Anyway, this is the code you can use:
123456789101112131415161718ONCE Distance = 10*PipSize //set a 10-point distanceIF myLongConditions THENIF close > (myEntryPrice + Distance) THENBUY 1 CONTRACT AT myEntryPrice LIMITELSIF close < (myEntryPrice - Distance) THENBUY 1 CONTRACT AT myEntryPrice STOPELSEBUY 1 CONTRACT AT MarketENDIFELSIF myShortConditions THENIF close > (myEntryPrice + Distance) THENSELLSHORT 1 CONTRACT AT myEntryPrice STOPELSIF close < (myEntryPrice - Distance) THENSELLSHORT 1 CONTRACT AT myEntryPrice LIMITELSESELLSHORT 1 CONTRACT AT MarketENDIFENDIFyou will have to set your SL and TP as usual.
1 user thanked author for this post.
01/15/2025 at 5:27 PM #242644You may comment out the two lines with the AT MARKET entry to skip opening a trade when there is a tight distance. As it is now, a position will always be opened when your conditions are met.
01/15/2025 at 5:35 PM #242645 -
AuthorPosts
Find exclusive trading pro-tools on