Two different stop loss exit strategy

Forums ProRealTime English forum ProOrder support Two different stop loss exit strategy

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • #88079

    Hi all,

    I want to add another stop loss to my code below but I’m not sure how to do it.  I already have a a fixed stop loss based on price (as you can see below). I was hoping you fine people could help to add another stop loss which would only be allowed to work at the END of an interval (e.g 1hour) for a different stop loss price.

    So I would end up with :

    1. stop loss which can exit at anytime throughout the trade for a fixed price e.g 120 points.
    2. stop loss which can only exit the trade at the end of a time interval if the price hits e.g 70.

    Many thank,

    James

    The code below is just used as an example !

     

    #88110

    If you want to exit an order exactly on the first candlestick Close of the hour, you can test it like this:

    You can of course add any other condition with AND

    (.. AND if Close>=70)

     

    #88122

    Thanks Nicolas for the reply.   Sorry I didn’t explain myself better originally.

    I only want the trade to exit if the price has gone higher or lower than e.g 40 points, at the end of ANY interval be it the 1st or the 12 or 24th. It would only close when an interval has finished and the price is higher than what I stated.

    I hope that makes better sense as currently it will exit after the first interval close.

    Hopefully you can help my frustrations in this matter.

    Many thanks,

    James

    #88143

    Since the code is only read one time at Close, any instruction that close an order is already doing it “at the end of any interval”.

    If you want to close an order that is higher than 40 points than your order open price, you can do it as follow:

    Of course this code will run at the end of each candlestick on the timeframe the strategy is currently running on.

    #88149

    So is tradeprice(1) the price of the currently open trade?

    Or should it be tradeprice(0)?

    #88154

    So is tradeprice(1) the price of the currently open trade?

    I should have said …

    So is tradeprice(1) the price at execution of the currently open trade?

    #88156

    tradeprice(0) returns nothing at all. It must be tradeprice or tradeprice(1).

     

    1 user thanked author for this post.
    #88241

    A massive thanks again.  Much appreciated !  Only.

    I’m having differing back test results.  As you can see. The chart on the left has only a basic stop loss based on price. The chart on the right has the basic price stop loss and the added code for exiting the position at the end of an interval.  As you can see in the results the chart with the added code has a lot of 0 bar trades when back tested with the added stop loss.  I’m unsure why.  Any help would be greatly appreciated.  The code I’m playing around with is on a 1 hour time frame on the Dow.

     

    Thanks again

    #88376

    Hi all,

    please can you let me know if the coding is correct in the highlighted area in the attachment to bring short and long trades out. Please don’t take any notice of the coding as this is just an example.

     

    I seem to be having some anomalies from the results above and am wondering if this part of the code is wrong.

    thanks,

    james

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

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