PRT Bands Strategy

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #176218 quote
    jth82
    Participant
    Average

    I have created a very simple strategy for DJ 1h using the PRT bands indicator – if the price crosses over the upper/lower band then it takes a long/short position with TP and SL set at 2xATR. It is profitable in backtest (apart from during the covid crash last year).

    I have one issue with the code that I would be grateful for help to improve. When in an uptrend, the price crosses over the upper band multiple times and it re-opens the long position, cumulating profit. In downtrends however, the price only crosses the lower band once, at the very start. It never seems to cross the lower band again, coming very close but not below the band to trigger a trade.

    I have attached examples of a typical up and down trend – the uptrend executes three trades whereas the downtrend only has one despite two or three other opportunities to short.

    How can I best modify this code to take repeated short positions in the down trend? Maybe take shorts within x% or x points of the lower band?

    Thanks in advance for your help.

     

    //-------------------------------------------------------------------------
    // Main code : JH DJ 1h PRTBands 2xATR
    //-------------------------------------------------------------------------
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = PRTBANDSUP
    c1 = (close > indicator1)
    
    IF c1 THEN
    BUY 1 PERPOINT AT MARKET
    atr = averagetruerange[14](close)
    set target profit atr*2
    set stop loss atr*2
    ENDIF
    
    // Conditions to exit long positions
    indicator2 = PRTBANDSDOWN
    c3 = (close < indicator2)
    
    IF c3 THEN
    SELL AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator3 = PRTBANDSDOWN
    c4 = (close < indicator3)
    
    IF c4 THEN
    SELLSHORT 1 PERPOINT AT MARKET
    atr = averagetruerange[14](close)
    set target profit atr*2
    set stop loss atr*2
    ENDIF
    
    // Conditions to exit short positions
    indicator4 = PRTBANDSUP
    c6 = (close > indicator4)
    
    IF c6 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    JH-DJ-1h-PRTBands-2xATR.itf Uptrend.png Uptrend.png Downtrend.png Downtrend.png
    #176223 quote
    nonetheless
    Participant
    Master

    how do you mean “it re-opens the long position” if CumulateOrders = False ?

    (btw, your c4 is the same as c3, and c6 is the same as c1 – you don’t have to write them out twice) 😁

    Midlanddave thanked this post
    #176227 quote
    jth82
    Participant
    Average

    Apologies, by re-open I didn’t mean cumulating orders. I mean after one long order is closed by hitting the 2xATR take profit, the price often crosses the upper band again in an uptrend and opens a new trade – see the attached screenshots to get an idea of what I mean.

    In the downtrends, it doesn’t do this as the price always seems to come very close to, but rarely crosses the lower bands. That is the issue I would like assistance with. It seems to be a feature of the PRT bands that the price only crosses the lower band once (at the start) in downtrends.

    Yes – sorry about the messy multiple indicator codes. I started the strategy with the simplified creation tool then finished it off manually.

    #176229 quote
    nonetheless
    Participant
    Master

    So, if I understand correctly, your short gets stopped out and you don’t get another entry signal even though the downtrend continues ?

    Then it sounds like you need to adjust your exit conditions so as to hold the position longer. You could try using a standard % stop, plus a trailing stop (for example), or change the atr values – either the period or the multiplier.

    #176232 quote
    Swingueur
    Participant
    Average

    Hello,

    First of all, the author of PRTbands claimed that this indicator is not designed to be used with Short positions.

    That said, you may try to use similar indicators to the lower band and the short-term line, when you already are in downtrend.

     

    // Breakout in a downtrend
    c1 = close crosses under lowest[20](low[1])
    ...
    // Back to downtrend for the short-term line
    ma3 = Average[3]
    c2 = ma3<ma3[1] and ma3[1]>ma3[2] and ma3[2]>ma3[3]
    #176234 quote
    Magifina
    Participant
    Master

    Hello Jth82

    Be careful. If you add the spread of 3.6 the strategy isn’t profitable anymore 🙂

    #176248 quote
    jth82
    Participant
    Average

    Thanks all for your comments.

    I looked at the strategy again and trying to optimise a different ATR multiple for the shorts still gives 2xATR as the optimal exit. And adding on extra points below the close of the bar to trigger additional short trades by crossing the lower PRT band more often didn’t result in any worthwhile additional gain either.

    So maybe the answer is that PRT bands aren’t designed for short trades as @swingeur says and I need to use a different indicator for these.

    Interesting point regarding the spread however, @magifna. Certainly with a spread of 3.6 and even with the worst possible DJ spread of 9.8, the strategy is still profitable over the last 12 months – but I agree, not beyond this.

    It’s great that we can backtest to 200k or 1m bars but are we not looking for strategies that are profitable now, in the current conditions, rather than those that might have been profitable two, three, or more years ago? Is anyone running strategies they started two-hundred-thousand one hour bars ago that are still profitable? Or are we more frequently starting and stopping new strategies that best fit more recent conditions?

    I am relatively new to this so these are open questions. Clearly I still have much to learn.

    #226669 quote
    GraHal
    Participant
    Master

    Is anyone running strategies they started two-hundred-thousand one hour bars ago that are still profitable?

    Silence is golden!  Let’s say the answer is NO and see if anybody comes back with a Yes? 😉

    #226670 quote
    JS
    Participant
    Senior
    200,000 (trading) hours ago you were in the last century and PRT didn’t exist yet… 🙂
    GraHal and ashehzi thanked this post
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

PRT Bands Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jth82 @jth82 Participant
Summary

This topic contains 8 replies,
has 6 voices, and was last updated by JS
2 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/25/2021
Status: Active
Attachments: 3 files
Logo Logo
Loading...