NAS 2m HULL-SAR trading system

Viewing 15 posts - 1 through 15 (of 344 total)
  • Author
    Posts
  • #146827 quote
    nonetheless
    Participant
    Master

    This is a new 2m strategy I’ve been working on, uses Hull MA and Parabolic SAR in 3 time frames with cumulative orders. Short back test so may be a curve fit but the VRT is good.

    I think it can still be improved but I’ve run out of ideas so any suggestions are welcome, maybe a limit to the number of positions? Cumulative orders are not to everyone’s taste, and the drawdown is huge – you’d need a lot of capital to run it – but as a % of the runup it’s not that bad. Could be worth playing with…

    Ctime = time >=143000 and time <210000
    
    TIMEFRAME(18 minutes)
    Period= 155
    inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)
    HULLa = weightedaverage[round(sqrt(Period))](inner)
    c1 = HULLa > HULLa[1]
    c2 = HULLa < HULLa[1]
    
    ST1 = SAR[.005,.005,.02]
    c1a = (close > ST1)
    c2a = (close < ST1)
    
    TIMEFRAME(6 minutes)
    Periodb= 29
    innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)
    HULLb = weightedaverage[round(sqrt(Periodb))](innerb)
    c3 = HULLb > HULLb[1]
    c4 = HULLb < HULLb[1]
    
    ST2 = SAR[.005,.005,.02]
    c3a = (close > ST2)
    c4a = (close < ST2)
    
    TIMEFRAME(default)
    Periodc= 4
    innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)
    HULLc = weightedaverage[round(sqrt(Periodc))](innerc)
    c5 = HULLc > HULLc[1] and HULLc[1] < HULLc[2]
    c6 = HULLc < HULLc[1] and HULLc[1] > HULLc[2]
    
    ST3 = SAR[.01,.01,.005]
    c5a = (close > ST3)
    c6a = (close < ST3)
    
    // Conditions to enter long positions
    IF Ctime and c1 and c1a AND C3 and c3a AND C5 and c5a THEN
    BUY positionsize CONTRACT AT MARKET
    SET STOP %LOSS .7
    SET TARGET %PROFIT 1.7
    ENDIF
     
    // Conditions to enter short positions
    IF Ctime and c2 and c2a AND C4 and c4a AND C6 and c6a THEN
    SELLSHORT positionsize CONTRACT AT MARKET
    SET STOP %LOSS 1.1
    SET TARGET %PROFIT 1.3
    ENDIF
    
    //%trailing stop function
    trailingstop = 1
    if trailingstop =1 then
    once trailingPercent = 0.38
    once stepPercent = 0.006
    if onmarket then
    trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailingstart points profit
    trailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stoploss
    endif
    
     
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
    newSL = tradeprice(1)+trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>trailingstep THEN
    newSL = newSL+trailingstep
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
    newSL = tradeprice(1)-trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>trailingstep THEN
    newSL = newSL-trailingstep
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    endif
    Nicolas, swedshare, Scooby and 8 others thanked this post
    #146848 quote
    swedshare
    Participant
    Senior

    Excellent G/L-ratio on that amount of trades.

    borderlineJim thanked this post
    #146852 quote
    swedshare
    Participant
    Senior

    I agree that the max amount of cumulative orders should be an option to avoid anxiety. For example this:

    MaxPositionsAllowed = 5
    
    // Conditions to enter long positions
    IF ctime and c1 and c1a AND C3 and c3a AND C5 and c5a and abs(CountOfPosition) < MaxPositionsAllowed THEN
    BUY 1 CONTRACT AT MARKET
    SET STOP %LOSS .7
    SET TARGET %PROFIT 1.7
    ENDIF
     
    // Conditions to enter short positions
    IF ctime and c2 and c2a AND C4 and c4a AND C6 and c6a and abs(CountOfPosition) < MaxPositionsAllowed THEN
    SELLSHORT 1 CONTRACT AT MARKET
    SET STOP %LOSS 1.1
    SET TARGET %PROFIT 1.3
    ENDIF
    nonetheless thanked this post
    #146858 quote
    GraHal
    Participant
    Master

    Cumulative orders are not to everyone’s taste

    Looks good with CumulateOrders = False.

    Also positive on performance on 1m and 3m.

    Thank you very much for sharing @nonetheless

    Can’t wait for 14:30 to see how it performs on Demo Live! 🙂

    nonetheless thanked this post
    #146866 quote
    Francesco
    Participant
    Veteran

    I don’t think the VRT can be useful on that amount of trades, so be careful before going live.

    #146871 quote
    nonetheless
    Participant
    Master

    I don’t think the VRT can be useful on that amount of trades, so be careful before going live.

    I think you’re prob right, but with such a short back test WF wouldn’t tell us much either. It would certainly be discouraging if the VRT were bad. But all short TF systems have to be left on demo for a good few months. Work in progress…

    #146879 quote
    nonetheless
    Participant
    Master

    I agree that the max amount of cumulative orders should be an option to avoid anxiety.

    #146890 quote
    Paul
    Participant
    Master

    Looks nice nonetheless . Thanks for sharing!

    I always have doubts having multiple positions, the way exits are handled are a bit tricky.

    If you have xx positions and a new position is openend and a new stop loss is set, the stop loss level for the last position counts for all positions?

    That could work positive but also negative in terms of acceptable risk.

    Maybe there’s a difference, adding only to a winning position, which means the first positions stop loss is lowered and the risk is reduced.

    Same works a bit similar for the trailing stop, but what happens if using instead of trade price(1)  position price?

    #146897 quote
    Paul
    Participant
    Master

    here’s the quick change, same ts but using position price and adding to winning positions.

    Didn’t optimise stop loss &  profit targets.

    now I look about it, it using positionperf(0) below, but perhaps better is to look at the positionperf of all current trades in same direction and if that’s positive add a position.

    MaxPositionsAllowed = 9999
     
    
    // Conditions to enter long positions
    IF not longonmarket and Ctime and c1 and c1a AND C3 and c3a AND C5 and c5a THEN
    BUY positionsize CONTRACT AT MARKET
    SET STOP %LOSS 1.5
    SET TARGET %PROFIT 2.5
    elsif longonmarket and Ctime and c1 and c1a AND C3 and c3a AND C5 and c5a and abs(CountOfPosition) < MaxPositionsAllowed THEN
    if positionperf(0)*100>0 then
    BUY positionsize CONTRACT AT MARKET
    SET STOP %LOSS 1.5
    SET TARGET %PROFIT 2.5
    endif
    endif
     
    // Conditions to enter short positions
    IF not shortonmarket and Ctime and c2 and c2a AND C4 and c4a AND C6 and c6a THEN
    SELLSHORT positionsize CONTRACT AT MARKET
    SET STOP %LOSS 1.5
    SET TARGET %PROFIT 2.5
    elsif shortonmarket and Ctime and c2 and c2a AND C4 and c4a AND C6 and c6a and abs(CountOfPosition) < MaxPositionsAllowed THEN
    if positionperf(0)*100>0 then
    SELLSHORT positionsize CONTRACT AT MARKET
    SET STOP %LOSS 1.5
    SET TARGET %PROFIT 2.5
    endif
    endif
    #146900 quote
    Paul
    Participant
    Master

    sorry that was not a good comparison because difference of sl/pt.

    #146905 quote
    nonetheless
    Participant
    Master

    new position is openend and a new stop loss is set, the stop loss level for the last position counts for all positions?

    Hi Paul, from what I can see in demo, all the stops are different, measured from each entry point.

    Only adding to winning positions could be a good idea – i’ll have to play around with it. Of course, then you lose the benefit of averaging down your losing positions. The question is how much you trust the primary trend.

    I also tried adding exit conditions, when any of the indicators changed direction, but couldn’t get any improvement. There must be a better way to get out of a losing position without going all the way to the stop… maybe something like the Fibonacci exits you have in your DJ 3m Vectorial  – would that bit of code work as it is?

    #146913 quote
    Paul
    Participant
    Master

    Hi Paul, from what I can see in demo, all the stops are different, measured from each entry point.

    Hi, then it’s perfect! I wasn’t sure.

    about the Fibonacci exits, yes it does add something too it, it appears. That’s nice to see, especially in another market (often it breaks down), but if it’s enough to keep it? I used hour 0 to hour 8 or 9.

    Using position price instead of trade price the results go down a bit.

    #146917 quote
    nonetheless
    Participant
    Master

    One thing I just noticed, although the stop loss is set individually for each new position, it doesn’t seem to change when the trail moves up. At the moment there are 18 open positions, most of which are up by around .6% but the stop hasn’t moved, even though the trail should go to break even at .38 %

    It’s even above the aggregate price by more than that.

    Does anyone know how a trailing stop is supposed to work with cumulative orders?

    #146936 quote
    GraHal
    Participant
    Master

    It is probably like in the Forces … follow your last Order  🙂 … so the trail works on the last Order to be executed.

    The last Order / trade didn’t reach the Trail Start level?

    #146940 quote
    nonetheless
    Participant
    Master

    No, it didn’t but how can it ever if new positions are always being added? It would have to go .38 % without the slightest pullback or it’ll take another trade and start a  new trail from there.

Viewing 15 posts - 1 through 15 (of 344 total)
  • You must be logged in to reply to this topic.

NAS 2m HULL-SAR trading system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 343 replies,
has 42 voices, and was last updated by bege
3 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/09/2020
Status: Active
Attachments: 129 files
Logo Logo
Loading...