Mother of Dragons trading strategy…

Viewing 15 posts - 16 through 30 (of 523 total)
  • Author
    Posts
  • #117641 quote
    nonetheless
    Participant
    Master

    Ciao Francesco, here’s a second version if you wouldn’t mind backtesting on 200k. MM is disabled but the DrawdownNeededToQuit might still be operative … not sure.

    I added another layer of filters at the 15m level. It performs better than v1 over 100k — higher profit from fewer trades — so curious to know if it’s still just fit it to that data set.

    Dita incrociate…

    DJ-5m-Mother-of-Dragons-MM-v2.itf
    #117648 quote
    Vonasi
    Moderator
    Master

    nonetheless – could you post the code so that we don’t have to download the ITF file please?

    #117649 quote
    nonetheless
    Participant
    Master
    // Definition of code parameters
    DEFPARAM CumulateOrders = false // Cumulating positions deactivated
    DEFPARAM preloadbars = 5000
    Capital = 10000
    MinSize = 1                 //The minimum position size allowed for the instrument.
    MM1stType = 0               //Starting type of moneymanagement. Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.
    MM2ndType = 0               //Type of money management to switch to after TradesQtyForSwitch number of trades and ProfitNeededForSwitch profit has occurred
    TradesQtyForSwitch = 15    //Quantity of trades required before switching to second money management choice.
    ProfitNeededForSwitch = 2  //% profit needed before allowing a money management type change to MM2ndType.
    DrawdownNeededToSwitch = 8 //% draw down from max equity needed before money management type is changed back to MM1stType.
    DrawdownNeededToQuit = 25   //% draw down from max equity needed to stop strategy
     
    Once MoneyManagement = MM1stType
     
    Equity = Capital + StrategyProfit
    maxequity = max(equity,maxequity)
     
    if equity < maxequity * (1 - (DrawdownNeededToSwitch/100)) then
    enoughtrades = 0
    tradecount = 0
    moneymanagement = MM1stType
    endif
     
    if equity < maxequity * (1 - (DrawdownNeededToQuit/100)) then
    quit
    endif
     
    if not EnoughTrades then
    if abs(countofposition) > abs(countofposition[1]) then
    tradecount = tradecount + 1
    endif
    if tradecount > TradesQtyForSwitch and maxequity >= Capital * (1 + (ProfitNeededForSwitch/100)) then
    EnoughTrades = 1
    MoneyManagement = MM2ndType
    endif
    endif
     
    IF MoneyManagement = 1 THEN
    PositionSize = Max(MinSize, Equity * (MinSize/Capital))
    ENDIF
     
    IF MoneyManagement = 2 THEN
    PositionSize = Max(LastSize, Equity * (MinSize/Capital))
    LastSize = PositionSize
    ENDIF
     
    IF MoneyManagement <> 1 and MoneyManagement <> 2 THEN
    PositionSize = MinSize
    ENDIF
     
    PositionSize = Round(PositionSize*100)
    PositionSize = PositionSize/100
     
     
    // Size of POSITIONS
    PositionSizeLong = 1 * positionsize
    PositionSizeShort = 1 * positionsize
    
    
    
    TIMEFRAME(120 minutes)
    
    Period= 520
    inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)
    HULLa = weightedaverage[round(sqrt(Period))](inner)
     
    c1 = HULLa > HULLa[1]
    c2 = HULLa < HULLa[1]
    
    indicator1 = SuperTrend[5,21]
    c3 = (close > indicator1)
    c4 = (close < indicator1)
    
    TIMEFRAME(15 minutes)
    
    indicator2 = Average[6](typicalPrice)
    indicator3 = Average[11](typicalPrice)
    c7 = (indicator2 > indicator3)
    c8 = (indicator2 < indicator3)
    
    Periodc= 17
    innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)
    HULLc = weightedaverage[round(sqrt(Periodc))](innerc)
     
    c9 = HULLc > HULLc[1]
    c10 = HULLc < HULLc[1]
    
    
    TIMEFRAME(5 minutes)
    
    Periodb= 22
    innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)
    HULLb = weightedaverage[round(sqrt(Periodb))](innerb)
     
    c5 = HULLb > HULLb[1]and HULLb[1]<HULLb[2]
    c6 = HULLb < HULLb[1]and HULLb[1]>HULLb[2]
    
    // Conditions to enter long positions
    IF c1 AND C3 AND C5 and c7 and c9 THEN
    BUY PositionSizeLong CONTRACT AT MARKET
    SET STOP %LOSS 2.1
    SET TARGET %PROFIT 1
    ENDIF
     
     
    // Conditions to enter short positions
    IF c2 AND C4 AND C6 and c8 and c10 THEN
    SELLSHORT PositionSizeShort CONTRACT AT MARKET
    SET STOP %LOSS 1.2
    SET TARGET %PROFIT 1
    ENDIF
    
    
    
    //trailing stop function
    trailingstart = 81 //trailing will start @trailinstart points profit
    trailingstep = 3 //trailing step to move the "stoploss"
     
    //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*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    
    winnie37 thanked this post
    #117661 quote
    Francesco
    Participant
    Veteran
    #117665 quote
    nonetheless
    Participant
    Master

    Thanks Francesco … sadly not any better than the first one. Only really works for 2019.

    May need to rethink this. We all know how it ended for the mother of dragons.

    #117666 quote
    Francesco
    Participant
    Veteran

    Hope the next will not be Oberyn trading strategy 😀

    #117671 quote
    GraHal
    Participant
    Master

    May need to rethink this

    Least it wouldn’t have blown the Account in the 1st 100k bars (as many Systems do for OOS periods).

    Maybe a Filter to prevent trading when Price is ranging and also in a downtrend.

    If you look at the equity curve … in 2017 when price was rising (from Sep 17 to Jan 18) your System made money then lost it when price was in a downtrend (Feb 18 to May 18) then hovered around zero when price was ranging from May 18 until 2019 when it got going again.

    It is worth trying a few tweaks and then if  Franseco tests again over 200k bars.

    But really you need tweak then  optimise else you not know if the tweak worked. How about trying it on 100k x 10 min TF as then back to June 2017 should be included??

    Just a few thoughts anyway.

    #117695 quote
    nonetheless
    Participant
    Master

    TBH, I’m inclined to give it a rest until we get v11. 100k just isn’t enough data to work with unless you’re using +1h TFs.

    #119175 quote
    fifi743
    Participant
    Master

    I changed line
    61
    74
    131
    Add a stop from the line
    113
    I would do well a multi position if the position wins.

    GraHal thanked this post
    Capture-d’écran-561.png Capture-d’écran-561.png DJ-5m-Mother.of_.Dragons_v2_MOD.itf
    #119181 quote
    nonetheless
    Participant
    Master

    Hey Fifi, a few tweaks and suddenly it looks so much better – thanks for that!

    Your backtest is 200k, yes? How does the curve look for 2017, 2018? The previous version only really came alive in 2019.

    #119190 quote
    fifi743
    Participant
    Master

    and There you go

    Paul thanked this post
    Capture-d’écran-563.png Capture-d’écran-563.png
    #119214 quote
    nonetheless
    Participant
    Master

    That is a much better line, steady increase over almost the whole period. I tried to break it into separate long and short but the result is worse; your version works better as one code going both ways. A couple of big losses in Jan/Feb 2020 but over the long term looks like it could work – génial!

    This is another version I had been working on, with a couple of extra filters in the 2h TF to help confirm the primary trend. What do you think? My guess is that yours is probably more stable…

    DJ-5m-Mother.of_.Dragons-v2.5.jpg DJ-5m-Mother.of_.Dragons-v2.5.jpg DJ-5m-Mother.of_.Dragons-v2.5.itf
    #119217 quote
    nonetheless
    Participant
    Master

    here’s the code:

    // Definition of code parameters
    DEFPARAM CumulateOrders = false // Cumulating positions deactivated
    DEFPARAM preloadbars = 5000
    
    
    
    Capital = 10000
    MinSize = 1                 //The minimum position size allowed for the instrument.
    MM1stType = 0               //Starting type of moneymanagement. Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.
    MM2ndType = 0               //Type of money management to switch to after TradesQtyForSwitch number of trades and ProfitNeededForSwitch profit has occurred
    TradesQtyForSwitch = 8    //Quantity of trades required before switching to second money management choice.
    ProfitNeededForSwitch = 2  //% profit needed before allowing a money management type change to MM2ndType.
    DrawdownNeededToSwitch = 8 //% draw down from max equity needed before money management type is changed back to MM1stType.
    DrawdownNeededToQuit = 25   //% draw down from max equity needed to stop strategy
     
    Once MoneyManagement = MM1stType
     
    Equity = Capital + StrategyProfit
    maxequity = max(equity,maxequity)
     
    if equity < maxequity * (1 - (DrawdownNeededToSwitch/100)) then
    enoughtrades = 0
    tradecount = 0
    moneymanagement = MM1stType
    endif
     
    if equity < maxequity * (1 - (DrawdownNeededToQuit/100)) then
    quit
    endif
     
    if not EnoughTrades then
    if abs(countofposition) > abs(countofposition[1]) then
    tradecount = tradecount + 1
    endif
    if tradecount > TradesQtyForSwitch and maxequity >= Capital * (1 + (ProfitNeededForSwitch/100)) then
    EnoughTrades = 1
    MoneyManagement = MM2ndType
    endif
    endif
     
    IF MoneyManagement = 1 THEN
    PositionSize = Max(MinSize, Equity * (MinSize/Capital))
    ENDIF
     
    IF MoneyManagement = 2 THEN
    PositionSize = Max(LastSize, Equity * (MinSize/Capital))
    LastSize = PositionSize
    ENDIF
     
    IF MoneyManagement <> 1 and MoneyManagement <> 2 THEN
    PositionSize = MinSize
    ENDIF
     
    PositionSize = Round(PositionSize*100)
    PositionSize = PositionSize/100
     
     
    // Size of POSITIONS
    PositionSizeLong = 1 * positionsize
    PositionSizeShort = 1 * positionsize
    
    
    
    TIMEFRAME(120 minutes)
    
    Period= 480
    inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)
    HULLa = weightedaverage[round(sqrt(Period))](inner)
     
    c1 = HULLa > HULLa[1]
    c2 = HULLa < HULLa[1]
    
    indicator1 = SuperTrend[5,21]
    c3 = (close > indicator1)
    c4 = (close < indicator1)
    
    indicator4 = CALL "Moving Average Slope"[75,1](close)
    c11 = (indicator4 > 0)
    c12 = (indicator4 < 0)
    
    Sinewave, ignored, ignored, ignored = CALL "Ehlers Even Better Sinewave"[100,.8, -.8]
    c13 = (Sinewave > -8)
    c14 = (Sinewave < .8)
    
    TIMEFRAME(15 minutes)
    
    indicator2 = Average[6](typicalPrice)
    indicator3 = Average[11](typicalPrice)
    c7 = (indicator2 > indicator3)
    c8 = (indicator2 < indicator3)
    
    Periodc= 17
    innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)
    HULLc = weightedaverage[round(sqrt(Periodc))](innerc)
     
    c9 = HULLc > HULLc[1]
    c10 = HULLc < HULLc[1]
    
    
    TIMEFRAME(5 minutes)
    
    Periodb= 22
    innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)
    HULLb = weightedaverage[round(sqrt(Periodb))](innerb)
     
    c5 = HULLb > HULLb[1]and HULLb[1]<HULLb[2]
    c6 = HULLb < HULLb[1]and HULLb[1]>HULLb[2]
    
    // Conditions to enter long positions
    IF c1 AND C3 AND C5 and c7 and c9 and c11 and c13 THEN
    BUY PositionSizeLong CONTRACT AT MARKET
    SET STOP %LOSS 1.9
    SET TARGET %PROFIT 1
    ENDIF
     
     
    // Conditions to enter short positions
    IF c2 AND C4 AND C6 and c8 and c10 and c12 and c14 THEN
    SELLSHORT PositionSizeShort CONTRACT AT MARKET
    SET STOP %LOSS 1.5
    SET TARGET %PROFIT 1
    ENDIF
    
    
    
    //trailing stop function
    trailingstart = 81 //trailing will start @trailinstart points profit
    trailingstep = 3 //trailing step to move the "stoploss"
     
    //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*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    
    #119224 quote
    Vonasi
    Moderator
    Master

    I tried to break it into separate long and short but the result is worse; your version works better as one code going both ways

    For me that would start ringing an alarm bell. If an entry condition and exit condition are good then they should be good whether you have opposite direction trades in the strategy or not.

    #119228 quote
    nonetheless
    Participant
    Master

    There wasn’t much in it – less than 10% difference, but better as one code doing both long and short. (I’m talking about Fifi’s version, posted above as v2_MOD – my original worked better as separate long and short).

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

Mother of Dragons trading strategy…


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 522 replies,
has 50 voices, and was last updated by LaurentBZH35
4 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/21/2020
Status: Active
Attachments: 195 files
Logo Logo
Loading...