SET STOP pLOSS with negative value

Forums ProRealTime English forum ProOrder support SET STOP pLOSS with negative value

Viewing 8 posts - 1 through 8 (of 8 total)
  • #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?

    #59115

    I 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

    #59123

    Yes if it was not a trailing stop. I start with a positive value and slowly move it into negative as price rises. So (PositionPrice – (-20)) is 20 pips above PositionPrice which is fine if close is 30 above for example.

    #59189

    It is not possible since stoploss set with SET STOP, must be an absolute value.

    #59192

    I’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.

    #59194

    Am 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.

     

    #59219

    Right, since PositionPrice will only be known at the end of the next candlestick. You can do something like this instead:

    Making the assumption that there will be no gap, it should be ok 🙂

    #59224

    Could you do something like this to avoid the gap issue and have a trailing stop?

     

Viewing 8 posts - 1 through 8 (of 8 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login