Discussing the strategy VECTORIAL DAX (M5)

Viewing 15 posts - 46 through 60 (of 1,264 total)
  • Author
    Posts
  • #94203 quote
    Balmora74
    Participant
    Veteran

    Hi Vonasi ! I recently worked on a new version of the code based on the various suggestions of this thread (Paul and Jebus89 in particular). I also did a Walk Forward on the variable “lag”. I also took into account your recommendations on the size of the positions and I added your code on money management. Here is the code and below the results. I would be happy to have your feedback and opinion. Thank you.

    // ROBOT VECTORIAL DAX
    // M5
    // SPREAD 1.5
    // by BALMORA 74 - FEBRUARY 2019
    
    DEFPARAM CumulateOrders = false
    DEFPARAM Preloadbars = 50000
    
    
    //VARIABLES
    CtimeA = time >= 080000 and time <= 180000
    CtimeB = time >= 080000 and time <= 180000
    
    
    MoneyManagement = 2
    RiskManagement = 0
    Capital = 10000
    MinBetSize = 1
    RiskLevel = 20
     
    Equity = Capital + StrategyProfit
     
    IF MoneyManagement = 1 THEN
    PositionSize = Max(MinBetSize, Equity * (MinBetSize/Capital))
    ENDIF
     
    IF MoneyManagement = 2 THEN
    PositionSize = Max(LastSize, Equity * (MinBetSize/Capital))
    LastSize = PositionSize
    ENDIF
     
    IF MoneyManagement <> 1 and MoneyManagement <> 2 THEN
    PositionSize = MinBetSize
    ENDIF
     
    IF RiskManagement THEN
    IF Equity > Capital THEN
    RiskMultiple = ((Equity/Capital) / RiskLevel)
    PositionSize = PositionSize * (1 + RiskMultiple)
    ENDIF
    ENDIF
     
    PositionSize = Round(PositionSize)
    
     
    // TAILLE DES POSITIONS
    PositionSizeLong = 1 * positionsize
    PositionSizeShort = 1 * positionsize
     
    
    //STRATEGIE
    
    //VECTEUR = CALCUL DE L'ANGLE
    ONCE PeriodeA = 10
    ONCE nbChandelierA= 15
    MMA = Exponentialaverage[PeriodeA](close)
    ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA
    ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE
    CondBuy1 = ANGLE >= 35
    CondSell1 = ANGLE <= - 40
    
    
    //VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE
    ONCE PeriodeB = 20
    ONCE nbChandelierB= 35
    lag = 1.5
    MMB = Exponentialaverage[PeriodeB](close)
    pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB
    trigger = Exponentialaverage[PeriodeB+lag](pente)
    CondBuy2 = (pente > trigger) AND (pente < 0)
    CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
    
    
    
    //ENTREES EN POSITION
    CONDBUY = CondBuy1 and CondBuy2 and CTimeA
    CONDSELL = CondSell1 and CondSell2 and CtimeB
    
    
    //POSITION LONGUE
    IF CONDBUY THEN
    buy PositionSizeLong contract at market
    SET STOP %LOSS 2
    ENDIF
    
    //POSITION COURTE
    IF CONDSELL THEN
    Sellshort PositionSizeShort contract at market
    SET STOP %LOSS 2
    ENDIF
    
    //VARIABLES STOP SUIVEUR
    ONCE trailingStopType     = 1    // Trailing Stop - 0 OFF, 1 ON
    ONCE trailingstoplong     = 4    // Trailing Stop Atr Relative Distance
    ONCE trailingstopshort    = 4    // Trailing Stop Atr Relative Distance
    
    ONCE atrtrailingperiod    = 14  // Atr parameter Value
    ONCE minstop              = 0    // Minimum Trailing Stop Distance
    
    
    // TRAILINGSTOP
    //----------------------------------------------
    atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pipsize)/1000
    trailingstartl = round(atrtrail*trailingstoplong)
    trailingstartS = round(atrtrail*trailingstopshort)
    if trailingStopType = 1 THEN
    TGL =trailingstartl
    TGS=trailingstarts
    if not onmarket then
    
    MAXPRICE = 0
    MINPRICE = close
    PREZZOUSCITA = 0
    ENDIF
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close)
    if MAXPRICE-tradeprice(1)>=TGL*pointsize then
    if MAXPRICE-tradeprice(1)>=MINSTOP then
    PREZZOUSCITA = MAXPRICE-TGL*pointsize
    ELSE
    PREZZOUSCITA = MAXPRICE - MINSTOP*pointsize
    ENDIF
    ENDIF
    ENDIF
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close)
    if tradeprice(1)-MINPRICE>=TGS*pointsize then
    if tradeprice(1)-MINPRICE>=MINSTOP then
    PREZZOUSCITA = MINPRICE+TGS*pointsize
    ELSE
    PREZZOUSCITA = MINPRICE + MINSTOP*pointsize
    ENDIF
    ENDIF
    ENDIF
    if onmarket and PREZZOUSCITA>0 then
    EXITSHORT AT PREZZOUSCITA STOP
    SELL AT PREZZOUSCITA STOP
    ENDIF
    ENDIF
    
    capgros and winnie37 thanked this post
    Capture-décran-2019-03-20-21.31.38.png Capture-décran-2019-03-20-21.31.38.png Capture-décran-2019-03-20-21.31.57.png Capture-décran-2019-03-20-21.31.57.png Capture-décran-2019-03-20-21.32.05.png Capture-décran-2019-03-20-21.32.05.png Capture-décran-2019-03-20-21.32.18.png Capture-décran-2019-03-20-21.32.18.png
    #94209 quote
    Vonasi
    Moderator
    Master

    My at glance feelings are that there are quite a number of variables that could all be curve fitted or a combination of variables be curve fitted which is going to be quite a bit of analysis to see how much affect each variable or combination of variables has. Even simple variables like the stop loss distances can be very curve fitted and will need to be included or eliminated from the analysis.

    One thing I do notice is that you have MINSTOP set to zero which will always massively improve a strategy performance. In the real world the brokers set a minimum stop distance and even change this based on volatility so a setting of zero is the perfect world and the perfect world is not something we can trade in!

    Balmora74, Jeremy8 and swedshare thanked this post
    #94211 quote
    Balmora74
    Participant
    Veteran

    Yes i understand. But a interesting thing is that if you turn off the trailing stop (ONCE trailingStopType = 0) the equity curve is quite good and the strategy profit is the same (we just have a highest draw down).

    #94213 quote
    Vonasi
    Moderator
    Master

    I’ve given up trying to find a trailing stop that actually improves a strategy. It might just be my trading style but also there are usually too many variables in a trailing stop code that make me fear curve fitting.

    Please post the non-trailing code equity curves if you can.

    Also I would recommend only ever developing and forward testing with level stakes as money management just adds one extra level of confusion to strategy development. Once you are totally happy and confident in a strategy then add it and put it live if it still backtests well with the money management active.

    Wilko thanked this post
    #94214 quote
    Balmora74
    Participant
    Veteran

    Ok so i put on value = 0 the variables “MoneyManagement” and “trailingStopType”. These a the results :

    Capture-décran-2019-03-20-22.21.26.png Capture-décran-2019-03-20-22.21.26.png Capture-décran-2019-03-20-22.21.41.png Capture-décran-2019-03-20-22.21.41.png Capture-décran-2019-03-20-22.21.51.png Capture-décran-2019-03-20-22.21.51.png
    #94218 quote
    Balmora74
    Participant
    Veteran
    #94236 quote
    Vonasi
    Moderator
    Master

    That still looks like a very nice equity curve, especially considering the 49% win rate and proves that the trailing stop adds very little to the basic concept. Now you just need to check how various combinations of variables (including the % stop levels) change results to find out if you are sitting on a curve fitted cliff edge. Unfortunately I have to drive up to Athens and back again today so I won’t be able to help much with this.

    #94244 quote
    Balmora74
    Participant
    Veteran

    I will put on demo account different version for 6 month and look at if after…

    #94325 quote
    Vonasi
    Moderator
    Master

    I’m back from Athens now! Forward testing for a long period is the best test possible – and so much easier than testing and analysing all variable combinations in backtests!

    winnie37 thanked this post
    #94334 quote
    Balmora74
    Participant
    Veteran

    When you speak of forward testing you wan to say on a demo account ? Or with Walk Forward ?

    #94343 quote
    Vonasi
    Moderator
    Master

    Live on demo.

    Balmora74 and nfulcher thanked this post
    #94605 quote
    capgros
    Participant
    Average

    Good morning everyone,

    Thanks Balmora74 for this strategy, I am trying to run it on live demo since last thursday 21, but it took one trade that day and since then, last friday and today system stops because order requests fail… I am a newbie so I can´t understand why this is happening, if someone can help me to understand and try to solve it. Attach you can find the message I get and all the failed attempts from this morning. Thanks a lot in advance!

    Captura-de-pantalla-2019-03-25-a-las-10.34.28.png Captura-de-pantalla-2019-03-25-a-las-10.34.28.png Captura-de-pantalla-2019-03-25-a-las-10.39.58.png Captura-de-pantalla-2019-03-25-a-las-10.39.58.png
    #94612 quote
    Balmora74
    Participant
    Veteran

    Hello capgros ! I have the same problem since friday on my account for different strategy based on CFD Dax 30 (1 euros). Strategy have shutdown and i have to re-start them manually. I think it’s perhaps a problem who can be linked to ongoing account migrations from IG Markets to IG Europe… ?

    capgros thanked this post
    #94618 quote
    capgros
    Participant
    Average

    Aaaaah, maybe you are right, because it is the same for me, not only your strategy stopped but some of them, and some not. Ok I will keep restarting all of them manually and will see what´s going on next days. Will keep you updated. Cheers

    Balmora74 thanked this post
    #94636 quote
    Vonasi
    Moderator
    Master

    See here for a discussion regarding stopped strategies and rejected orders.

    Strategies stopped due to rejected orders – lack of info

    capgros thanked this post
Viewing 15 posts - 46 through 60 (of 1,264 total)
  • You must be logged in to reply to this topic.

Discussing the strategy VECTORIAL DAX (M5)


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Balmora74 @balmora74 Participant
Summary

This topic contains 1,263 replies,
has 125 voices, and was last updated by VinzentVega
1 year ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/24/2019
Status: Active
Attachments: 470 files
Logo Logo
Loading...