Mother of Dragons trading strategy…

Viewing 15 posts - 466 through 480 (of 523 total)
  • Author
    Posts
  • #150808 quote
    Indiana400
    Participant
    Junior

    Fantastic thank you.

    #150834 quote
    ilvillans
    Participant
    Senior

    Hi, great system, great information. If you set 0.2 the system does not respond correctly.

    Immagine-2020-11-17-210952.png Immagine-2020-11-17-210952.png Immagine-2020-11-17-211139.png Immagine-2020-11-17-211139.png
    #150848 quote
    nonetheless
    Participant
    Master

    You’ve got the wrong itf, that’s a robustness test algo.

    Click ‘View all attachments’ and look through the list for DJ 5m MoD v5.1

    ayrton78 thanked this post
    #151508 quote
    Mitchy14
    Participant
    Average

    Hi All,

    Firstly, can I send my thanks to all that have developed this Algo – the results look really exciting. @Nonetheless so far, it looks to be a fairly robust strategy! Cracking name too… 😀

    So much so… I’d like to start trading with it – 0.2 contracts. I’ve made the amendments, and have gone live, it starts, but minutes later (potentially 5 mins) I get a notification that it’s no longer trading and has stopped.

    What am I missing? The only areas I have amended are the leverage to .5, and the start position to .2

    Any ideas?

    Best,

    Tom

    #151514 quote
    nonetheless
    Participant
    Master

    I have amended are the leverage to .5

    In the UK this should be .05, although I can’t see why that should stop it from running. Are you in demo or live?

    Mitchy14 thanked this post
    #151516 quote
    Fabien6658
    Participant
    Senior

    Hi All,

    Firstly, can I send my thanks to all that have developed this Algo – the results look really exciting. @Nonetheless so far, it looks to be a fairly robust strategy! Cracking name too… 😀

    So much so… I’d like to start trading with it – 0.2 contracts. I’ve made the amendments, and have gone live, it starts, but minutes later (potentially 5 mins) I get a notification that it’s no longer trading and has stopped.

    What am I missing? The only areas I have amended are the leverage to .5, and the start position to .2

    Any ideas?

    Best,

    Tom

    Hi Mitchy,

    First you have to check if your broker accept a 0.2 size of position. Next you should check the necessary margin for trading this index.

    Mitchy14 thanked this post
    #151530 quote
    Vonasi
    Moderator
    Master

    ilvillans – Welcome to the forums. Please try to be more careful when posting especially if cutting and pasting text into your posts. I have removed the extra HTML that was making your post very untidy. We like a tidy form! 🙂

    #151532 quote
    Mitchy14
    Participant
    Average

    Hi,

    Sorry, that was a typo – the setting is 0.05.

    I think it may be a broker issue – 0.02 isn’t a valid contract size for me.

    Best,

    Tom

    #151538 quote
    Mitchy14
    Participant
    Average

    Sorry chaps – still not running (even on one contract). I’ve added the code below. I must admit, it’s like asking my math teacher to check for mistakes :/

    First one to point out the ridiculously embarrassing mistake wins… 😀

    No need to check beyond line 26 – nothing else was tweaked.

    Also got this error message…

    The trading system was stopped because an indicator received a negative or zero parameter ex:(-10). You can modify your code to to prevent negative parameters then backtest the system to check the correction.

    Best,

    Tom

    ----------------------------------------------------------------------
    // Main code : DJ 5m MoD v5.1 xtest
    //-------------------------------------------------------------------------
    // Definition of code parameters
    DEFPARAM CumulateOrders = true // Cumulating positions deactivated
    DEFPARAM preloadbars = 5000
    
    // cumulative positions are added when reenter is 2/3/4, the stoploss, profittarget & trailingstep and other exit criteria are all based on the first opened position mainly on the purpose of backtesting.
    
    // reenter [1] (default) no action on same signals until closed
    // reenter [2] action on same signals when in position
    // reenter [3] action on same signals when position is in loss
    // reenter [4] action on same signals when position is in profit
    
    reenter=1
    
    //Money Management DOW
    MM = 0 // = 0 for optimization
    if MM = 0 then
    positionsize=1
    ENDIF
    if MM = 1 then
    ONCE startpositionsize = 1
    ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etc
    ONCE margin = (close*.05) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverage
    ONCE margin2 = (close*.05)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverage
    ONCE tier1 = 55 // DOW €1 IG first tier margin limit
    ONCE maxpositionsize = 550 // DOW €1 IG tier 2 margin limit
    ONCE minpositionsize = 1 // enter minimum position allowed
    IF Not OnMarket THEN
    positionsize = startpositionsize + Strategyprofit/(factor*margin)
    ENDIF
    IF Not OnMarket THEN
    IF startpositionsize + Strategyprofit/(factor*margin) > tier1 then
    positionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 margin
    ENDIF
    IF Not OnMarket THEN
    if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN
    positionsize = minpositionsize //keeps positionsize from going below allowed minimum
    ENDIF
    IF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize then
    positionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limit
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    
    TIMEFRAME(2 hours,updateonclose)
    Period= 490
    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[8,4]
    c3 = (close > indicator1)
    c4 = (close < indicator1)
    
    ma = average[60,3](close)
    c11 = ma > ma[1]
    c12 = ma < ma[1]
    
    //Stochastic RSI | indicator
    lengthRSI = 15 //RSI period
    lengthStoch = 9 //Stochastic period
    smoothK = 10 //Smooth signal of stochastic RSI
    smoothD = 5 //Smooth signal of smoothed stochastic RSI
    myRSI = RSI[lengthRSI](close)
    MinRSI = lowest[lengthStoch](myrsi)
    MaxRSI = highest[lengthStoch](myrsi)
    StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
    K = average[smoothK](stochrsi)*100
    D = average[smoothD](K)
    c13 = K>D
    c14 = K<D
    
    TIMEFRAME(30 minutes,updateonclose)
    indicator5 = Average[3](typicalPrice)
    indicator6 = Average[7](typicalPrice)
    c15 = (indicator5 > indicator6)
    c16 = (indicator5 < indicator6)
    
    
    
    TIMEFRAME(15 minutes,updateonclose)
    indicator2 = Average[4](typicalPrice)
    indicator3 = Average[8](typicalPrice)
    c7 = (indicator2 > indicator3)
    c8 = (indicator2 < indicator3)
    
    Periodc= 22
    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(10 minutes)
    indicator4 = SuperTrend[2,6]
    indicator4a = SAR[0.02,0.03,0.2]
    c19 = (close > indicator4) or (close > indicator4a)
    c20 = (close < indicator4) or (close < indicator4a)
    
    TIMEFRAME(5 minutes)
    //Stochastic RSI | indicator
    lengthRSIa = 3 //RSI period
    lengthStocha = 6 //Stochastic period
    smoothKa = 9 //Smooth signal of stochastic RSI
    smoothDa = 3 //Smooth signal of smoothed stochastic RSI
    myRSIa = RSI[lengthRSIa](close)
    MinRSIa = lowest[lengthStocha](myrsia)
    MaxRSIa = highest[lengthStocha](myrsia)
    StochRSIa = (myRSIa-MinRSIa) / (MaxRSIa-MinRSIa)
    Ka = average[smoothKa](stochrsia)*100
    Da = average[smoothDa](Ka)
    c23 = Ka>Da
    c24 = Ka<Da
    
    ma3 = average[15,3](typicalPrice)
    c21 = ma3 > ma3[1]
    c22 = ma3 < ma3[1]
    
    Periodb= 15
    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]
    
    once sll = 1.5 // stoploss long
    once sls = 2 // stoploss short
    
    once ptl = 2.6  // profit target long
    once pts = 2  // profit target short
    
    
    
    // Conditions to enter long positions
    IF (not onmarket or shortonmarket[1]) and dhigh(0)-high<250 and c1 AND C3 AND C5 and c7 and c9 and c11 and c13 and c15 and c19 and c21 and c23 THEN
    BUY positionsize CONTRACT AT MARKET
    ENDIF
    if longonmarket and dhigh(0)-high<250 and c1 AND C3 AND C5 and c7 and c9 and c11 and c13 and c15 and c19 and c21 and c23 THEN
    if reenter=1 then
    positionperformance=0
    elsif reenter=2 then
    positionperformance=1
    elsif reenter=3 then
    positionperformance=positionperf(0)<0
    elsif reenter=4 then
    positionperformance=positionperf(0)>0
    endif
    if positionperformance then
    buy positionsize contract at market
    endif
    endif
    
    // Conditions to enter short positions
    IF (not onmarket or longonmarket[1]) and low-dlow(0)<600 and c2 AND C4 AND C6 and c8 and c10 and c12 and c14 and c16 and c20 and c22 and c24 THEN
    SELLSHORT positionsize CONTRACT AT MARKET
    ENDIF
    if shortonmarket and low-dlow(0)<600 and c2 AND C4 AND C6 and c8 and c10 and c12 and c14 and c16 and c20 and c22 and c24 THEN
    if reenter=1 then
    positionperformance=0
    elsif reenter=2 then
    positionperformance=1
    elsif reenter=3 then
    positionperformance=positionperf(0)<0
    elsif reenter=4 then
    positionperformance=positionperf(0)>0
    endif
    if positionperformance then
    sellshort positionsize contract at market
    endif
    endif
    
    countpos=abs(countofposition)
    
    //================== exit in profit
    if longonmarket and C6 and c8 and close>tradeprice(countpos) then
    sell at market
    endif
    
    If shortonmarket and C5 and c7 and close<tradeprice(countpos) then
    exitshort at market
    endif
    
    //==============exit at loss
    if longonmarket AND c2 and c6 and close<tradeprice(countpos) then
    sell at market
    endif
    If shortonmarket and c1 and c5 and close>tradeprice(countpos) then
    exitshort at market
    endif
    
    //%trailing stop function
    trailingpercentlong  = 0.26 // %
    trailingpercentshort = 0.31 // %
    stepPercentlong = 0.026
    stepPercentshort = 0.013
    sensitivity = (low+high+close)/3
    if onmarket then
    trailingstartlong = tradeprice(countpos)*(trailingpercentlong/100) //trailing will start @trailingstart points profit
    trailingstartshort = tradeprice(countpos)*(trailingpercentshort/100) //trailing will start @trailingstart points profit
    trailingsteplong = tradeprice(countpos)*(stepPercentlong/100) //% step to move the stoploss
    trailingstepshort = tradeprice(countpos)*(stepPercentshort/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 sensitivity-tradeprice(countpos)>=trailingstartlong THEN
    newSL = tradeprice(countpos)+trailingsteplong
    ENDIF
    //next moves
    IF newSL>0 AND sensitivity-newSL>trailingsteplong THEN
    newSL = newSL+trailingsteplong
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(countpos)-sensitivity>=trailingstartshort THEN
    newSL = tradeprice(countpos)-trailingstepshort
    ENDIF
    //next moves
    IF newSL>0 AND newSL-sensitivity>trailingstepshort THEN
    newSL = newSL-trailingstepshort
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    //****************************************************************************************
    IF longonmarket and barindex-tradeindex>1880 and close<tradeprice(countpos) then
    sell at market
    endif
    IF shortonmarket and barindex-tradeindex>560 and close>tradeprice(countpos) then
    exitshort at market
    endif
    //=============================================
    if longonmarket and abs(open-close)<1 and high[1]>high and close>tradeprice(countpos) and high-close>11 then
    sell at market
    endif
    if shortonmarket and abs(open-close)<1 and low[1]>low and close-low>11 and close<tradeprice(countpos) then
    exitshort at market
    endif
    //===================================
    myrsiM5=rsi[14](close)
    //
    if myrsiM5<30 and barindex-tradeindex>1 and longonmarket and close>tradeprice(countpos) then
    sell at market
    endif
    if myrsiM5>70 and barindex-tradeindex>1 and shortonmarket and close<tradeprice(countpos) then
    exitshort at market
    endif
    
    // ---------   US DAY LIGHT SAVINGS MONTHS      ---------------- //
    mar = month = 3 // MONTH START
    nov = month = 11 // MONTH END
    IF (month > 3 AND month < 11) OR (mar AND day>14) OR (mar AND day-dayofweek>7) OR (nov AND day<=dayofweek AND day<7) THEN
    USDLS=010000
    ELSE
    USDLS=0
    ENDIF
    
    once shortStep = 0
    once longStep = 0
    once openStrongLong = 0
    once openStrongShort = 0
    if not onmarket or (time <= 143000 - USDLS and time >= 210000 - USDLS) then
    shortStep = 0
    longStep = 0
    openStrongLong = 0
    openStrongShort = 0
    endif
    
    //detect strong direction for market open
    once rangeOK = 45
    once tradeMin = 500
    IF (time >= 144000 - USDLS) AND (time <= 144000 + tradeMin - USDLS) THEN
    openStrongLong = close > open AND close - open > rangeOK
    openStrongShort = close < open AND open - close > rangeOK
    ENDIF
    
    once bollperiod = 20
    once bollMAType = 1
    once s = 2
    once BollLevel = 90
    once BollSR = 50
    
    bollMA = average[bollperiod, bollMAType](close)
    STDDEV = STD[bollperiod]
    bollUP = bollMA + s * STDDEV
    bollDOWN = bollMA - s * STDDEV
    IF bollUP = bollDOWN THEN
    bollPercent = 50
    ELSE
    bollPercent = 100 * (close - bollDOWN) / (bollUP - bollDOWN)
    ENDIF
    
    //Market spike up
    IF shortonmarket AND shortStep = 0 AND bollPercent > BollLevel THEN
    shortStep = 1
    ENDIF
    //Market slowly come down
    IF shortonmarket AND shortStep = 1 AND bollPercent < 100 - BollLevel THEN
    shortStep = 2
    ENDIF
    //Market still go back to bullish and supported after strong bull open, exit
    IF shortonmarket AND shortStep = 2 AND bollPercent > BollSR AND openStrongLong THEN
    exitshort at market
    ENDIF
    
    //Market shoot down
    IF longonmarket AND longStep = 0 AND bollPercent < 100 - BollLevel THEN
    longStep = 1
    ENDIF
    //Market slowly go back up
    IF longonmarket AND longStep = 1 AND bollPercent > BollLevel THEN
    longStep = 2
    ENDIF
    //Market still go back to bearish and resisted after strong bear open, exit
    IF longonmarket AND longStep = 2 AND bollPercent < 100 - BollSR AND openStrongShort THEN
    sell at market
    ENDIF
    
    once trendPeriod = 70
    once trendPeriodResume = 30
    once trendGap = 3
    once trendResumeGap = 6
    if not onmarket then
    fullySupported = 0
    fullyResisteded = 0
    endif
    //Market supported in the wrong direction
    IF shortonmarket AND fullySupported = 0 AND summation[trendPeriod](bollPercent > 50) >= trendPeriod - trendGap THEN
    fullySupported = 1
    ENDIF
    
    //Market pull back but continue to be supported
    IF shortonmarket AND fullySupported = 1 AND bollPercent[trendPeriodResume + 1] < 0 AND summation[trendPeriodResume](bollPercent > 50) >= trendPeriodResume - trendResumeGap THEN
    exitshort at market
    ENDIF
    
    //Market resisted in wrong direction
    IF longonmarket AND fullyResisteded = 0 AND summation[trendPeriod](bollPercent < 50) >= trendPeriod - trendGap THEN
    fullyResisteded = 1
    ENDIF
    
    //Market pull back but continue to be resisted
    IF longonmarket AND fullyResisteded = 1 AND bollPercent[trendPeriodResume + 1] > 100 AND summation[trendPeriodResume](bollPercent < 50) >= trendPeriodResume - trendResumeGap THEN
    sell at market
    ENDIF
    
    //Started real wrong direction
    once strongTrend = 70
    once strongPeriod = 6
    IF shortonmarket and openStrongLong and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent > strongTrend) = strongPeriod then
    exitshort at market
    ENDIF
    
    IF longonmarket and openStrongShort and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent < 100 - strongTrend) = strongPeriod then
    sell at market
    ENDIF
    
    if not onmarket then
    flag1=0
    flag2=0
    endif
    
    if longonmarket and (not onmarket[1] or shortonmarket)[1] then
    flag1=1
    flag2=0
    endif
    if flag1=1 then
    sell at tradeprice(countpos)-(tradeprice(countpos)*(sll/100)) stop
    sell at tradeprice(countpos)+(tradeprice(countpos)*(ptl/100)) limit
    endif
    
    if shortonmarket and (not onmarket[1] or longonmarket[1]) then
    flag1=0
    flag2=1
    endif
    
    if flag2=1 then
    exitshort at tradeprice(abs(countpos))+(tradeprice(abs(countpos))*(sls)/100) stop
    exitshort at tradeprice(abs(countpos))-(tradeprice(abs(countpos))*(pts)/100) limit
    endif
    
    #151553 quote
    nonetheless
    Participant
    Master

    You’ve got the wrong itf, that’s a robustness test algo.

    Click ‘View all attachments’ and look through the list for DJ 5m MoD v5.1

    Mitchy14 and ayrton78 thanked this post
    #151554 quote
    Mitchy14
    Participant
    Average

    Oh, wow… told you it would be something embarrassing

    hugely appreciate your help in any case!

    #151794 quote
    Onetime
    Participant
    Junior

    Hi Guys,

    I have See that now the prt V11.1  available on the Demo version is. My question is to know if the algo version will works with this new prt Version Please ?

    If no what thinks we have to change.

    +++

    #151801 quote
    nonetheless
    Participant
    Master

    The backtest runs OK, so no reason it shouldn’t run in V11 demo.

    #151817 quote
    Onetime
    Participant
    Junior

    @Nonetheless thanks I will check it.

    #151831 quote
    Vonasi
    Moderator
    Master

    Anything that runs on v10.3 should run on v11. Anything that was developed on v11 ‘might’ not run on v10.3 because v11 has new instructions and new code words that are not compatible with previous versions.

Viewing 15 posts - 466 through 480 (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...