SET STOP pLOSS with negative value
Forums › ProRealTime English forum › ProOrder support › SET STOP pLOSS with negative value
- This topic has 7 replies, 3 voices, and was last updated 6 years ago by Vonasi.
-
-
01/11/2018 at 10:19 PM #59112
I was just working on a new trailing stop theory and using SET STOP pLOSS SL at the end of the code and changing the value of SL within the code – I was getting some weird results as I was limiting the minimum value of SL to 1. For some reason I had not twigged that the STOP pLOSS is subtracted from the TradePrice or PositionPrice and so there is no reason why you cannot have a negative value for the stop loss – meaning that as you go into profit SET STOP pLOSS can be used to close positions above the TradePrice/PositionPrice.
I don’t think I have seen any other trailing stops doing this – they seem to prefer SELL AT x STOP rather than a negative valued SET STOP pLOSS.
Except for the fact that I think I need to avoid a zero value on the SET STOP pLOSS is there any reason not to do this as the lack of other code with it in always gives me reason to wonder?
01/11/2018 at 11:03 PM #59115I wrote a post to reply but i somehow i got logged out and then couldnt log back in and in the process my post disappeared . Correct me if i am wrong but would not any – stop loss have you stopped on any entry for the price of the spread instantaneously ? I cant fathom how this could possibly work . What am i missing here
01/11/2018 at 11:23 PM #5912301/12/2018 at 2:51 PM #5918901/12/2018 at 3:12 PM #59192I’ve replied in the other discussion we are having about this at:
https://www.prorealcode.com/topic/graph-close-returns-wrong-value/
Strange thing is that it seems to work but just messes up the GRAPH function.
Guess I’ll just go back to SELL STOP orders.
01/12/2018 at 3:25 PM #59194Am I right in my thinking that if you have the following code that the SELL STOP order will not be set at the time that the BUY order is placed as at that candles close PositionPrice has no value? You will have to wait for the next candles close.
1234IF Not OnMarket and <conditions> THENBUY 1 CONTRACT AT MARKETSELL AT (PositionPrice - SL) STOPENDIF01/12/2018 at 4:42 PM #5921901/12/2018 at 4:50 PM #59224Could you do something like this to avoid the gap issue and have a trailing stop?
1234567891011IF Not OnMarket and <conditions to buy> THENBUY 1 CONTRACT AT MARKETSL = <Starting Stop Loss>SET STOP pLoss SLENDIFIF OnMarket and <conditions to change stop> THENSL = SL - <amount you want to reduce stoploss by>SET STOP pLoss 0 //cancel StopLoss orderSELL AT (PositionPrice - SL) STOPENDIF -
AuthorPosts
Find exclusive trading pro-tools on