Problem with minstop
Forums › ProRealTime English forum › ProOrder support › Problem with minstop
- This topic has 13 replies, 5 voices, and was last updated 3 years ago by robertogozzi.
-
-
09/15/2021 at 8:53 AM #177595
A bot is disconnected because It tries to send an order to place stop below the Minimum stop required by the broker.
A Solution?
09/15/2021 at 9:00 AM #177596Find what is the minimum stop distance allowed by the broker for that particular instrument and adapt your code or use the stop adjustement function available when you launch a ProOrder code (checkbox). See below attached picture, sorry in French.
09/15/2021 at 9:32 AM #177603Thanks Nicolás.
09/15/2021 at 11:03 AM #177616And how to include on the Code?
09/15/2021 at 10:51 PM #17768009/16/2021 at 8:26 AM #177690Once MinStopDist = 10
If StopDist < MinStopDist then
StopDist = MinStopDist
EndIf
Set Stop Loss StopDistIt can also be written this way:
123Once MinStopDist = 10StopDist = max(MinStopDist,StopDist)Set Stop Loss StopDist09/16/2021 at 11:33 AM #17771209/16/2021 at 1:53 PM #17772109/16/2021 at 5:10 PM #177739below the Minimum stop required by the broker.
I’m sure your SL’s are > 10 anyway, so what is probably happening is that your code is trying to place a SL during periods of high volatility? This is when IG increases min stop distances to 30, 50, 100 or even many 100’s at times … daft though it sounds.
To guarantee never to be rejected then we would need to use a value for SL that is > the maximum value IG has ever set the minimum distance. So being rejected at times is something we have to live with.
I have ticked the ‘Guaranteed Stop’ AND ‘Readjust Stop’ boxes when starting my Algos and they still get rejected!
09/26/2021 at 7:15 PM #178487This is the problem12345678if longonmarket AND c2 and c6 and close<positionprice thensell at marketendifIf shortonmarket and c1 and c5 and close>positionprice thenexitshort at marketendifI need what this instruction close the operation, but only if price save the minstoploss of broker09/26/2021 at 7:23 PM #178489I can’t understand what you mean by
“I need what this instruction close the operation, but only if price save the minstoploss of broker”.
Can you explain better?
09/26/2021 at 8:02 PM #178493The bot launches an order to close the operation, but when the price is below the minimum stop required by the broker, the bot is deactivated.
That is the code to close the operation, I need the instruction to save the minimum stop required by the broker.
09/26/2021 at 8:31 PM #178497The bot has its own stop loss.
These orders are separate from that stop loss.
If the operation goes wrong, the operation can be closed with those orders, but the price has to be saving the minimum stop required by the broker, depending on the index it can be 5 pips, 8 pips, 10 pips …
09/27/2021 at 12:04 PM #178552To exit using a pending order you have to:
- set a DISTANCE to be taken into account when placing a pending order
- choose among STOP, LIMIT and AT MARKET orders according to the position of the current price compared to the exit price (stop loss in this case).
There you go:
1234567891011121314151617181920212223ONCE Distance = 6 * PipSize //Distance required by the broker (pips)//// StopLoss must have been defined elsewhere in your code (and cleared when not OnMarket)//IF StopLoss > 0 THENIF LongOnMarket THEN //LONG tradesIF (close + Distance) > StopLoss THENSELL AT StopLoss STOP //exit at a worse price than the current oneELSIF (close - Distance) < StopLoss THENSELL AT StopLoss LIMIT //exit at a better price than the current oneELSESELL AT Market //exit at market if not within the DISTANCE (you may comment out his line not to exit at market, thus waiting for the next bar to close)ENDIFELSIF ShortOnmarket THEN //SHORT tradesIF (close + Distance) < StopLoss THENEXITSHORT AT StopLoss STOP //exit at a worse price than the current oneELSIF (close - Distance) > StopLoss THENEXITSHORT AT StopLoss LIMIT //exit at a better price than the current oneELSEEXITSHORT AT Market //exit at market if not within the DISTANCE (you may comment out his line not to exit at market, thus waiting for the next bar to close)ENDIFENDIFENDIF -
AuthorPosts
Find exclusive trading pro-tools on