Widen stoploss overnight
Forums › ProRealTime English forum › ProOrder support › Widen stoploss overnight
- This topic has 20 replies, 4 voices, and was last updated 5 years ago by GraHal.
-
-
08/10/2018 at 11:22 AM #77953
You can or cannot use ABS, it depends on your coding style. Look at this code, the most widely used for trailing stops https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/.
To check if the current price has reached your trailing stop treshold you can (but the above example is complete and perfectly working AS IS) write:
1234567891011// for LONG tradesIF TRADEPRICE - close >= MyTreshold THEN..ENDIF// for SHORT tradesIF close - TRADEPRICE >= MyTreshold THEN..ENDIF08/10/2018 at 11:25 AM #7795408/10/2018 at 12:10 PM #7795708/10/2018 at 12:59 PM #77962Also do not forget that if you send an order to the market that is too close to the price then the order will be rejected. You need to consider the minimum allowed stop distance for whatever instrument you are trading and include something in your code to ensure you never try to place an order that is under it.
1 user thanked author for this post.
08/10/2018 at 1:53 PM #77964I experienced that if it tries to put in a stoploss and the current price is beyond the stoploss level, the position closes at market (with IG CFD). Stops too close indeed got rejected. Will this shut the system down after too many rejections?
08/10/2018 at 1:58 PM #77967Will this shut the system down after too many rejections?
Yes, after 12 rejections, you are closed down on the 13th I think?
Not sure if there is a time limit on that, like > 12 rejections within 1 week etc??
1 user thanked author for this post.
-
AuthorPosts