Strategy Eur/Usd mini, how to reduce the maximum % drawdown?

Viewing 15 posts - 31 through 45 (of 55 total)
  • Author
    Posts
  • #102125 quote
    TempusFugit
    Participant
    Veteran

    Hi Vonasi,

    Thanks for the feedback. I am not sure to follow you, do you mean to just exit everyday at 21:00? If that is what you mean I think is normal that the result is not good, IMHO that goes against the logic of the system.

    I added two exits:

    • the first one anyday at 21:00 if the positionperf>0 and barindex-tradeindex>70. I wanted to reduce the time in market and take quick profits after several days without reaching the limit exit order. This one make the result of the system better but without it, still is a good result.
    • Another one is with positionperf<0  and other conditions, but doesn´t matter because it almost don´t act, you can take it out and won´t change much.

    But IMHO if you just put to exit EVERYDAY at 21:00 you won´t let the logic of the system to work properly, because often it needs several days to get to the exit´s limit price of the original system. If you put the same condition in the original system I think it won´t work also.

    I would like to hear also the opinion of the creator of the system (Coscar) about all this

    #102168 quote
    Vonasi
    Moderator
    Master

    Sorry TempusFugit but I just realised that I read through your code rather quickly and misread it. I was working under the illusion that the conditions were all separate exit conditions whereas they are actually all combined as one

    I’m still not sure that they add anything to the strategy of much worth. In my 100k bar test the LOSSEXIT condition was only ever met once. The WINEXIT condition was met 49 times but this just resulted in less overall gain. Time in market was less but with a long and short forex strategy overnight fees are not a major concern as you get paid to be short and you pay to be long.

    The win rate was higher by just over 5% but the gain/loss ratio was lower.

    With the exit conditions the longest trade was held for 116 bars/hours. Without the conditions only seven trades went longer than this 116 hours and the longest was still only 159 hours.

    I’m just not sure that the extra conditions add very much and they definitely reduced profit per trade in the tested data sample.

    Screenshot_6.png Screenshot_6.png Screenshot_7.png Screenshot_7.png
    #102176 quote
    TempusFugit
    Participant
    Veteran

    I agree with you Vonasi, the exit conditions I added are not essential to the  system, I like them because they reduce the time in the market quite a lot but the system don´t need them if you don´t want them.

    The important point of my version is that I translated this fine system from the 1D TF to  1H TF keeping the good results. I just wanted to share that.

    #102180 quote
    coscar
    Participant
    Senior

    Thank you all for your interest and collaboration in implementing the code. An alternative may be to modify the exit of trades with instruments that do not require optimization. I am currently testing with john ehlers filters. When I get results I’ll post the code. good job

    #102196 quote
    Vonasi
    Moderator
    Master

    I have had the end of day version running live on demo since 18 December 2018 and I thought that the comparison between backtesting and live forward testing might be of interest to others so I post the results here.

    My demo account had several issues that meant that the strategy was stopped several times and many of my strategies went through a long phase of not opening positions – although I can’t confirm that this was one of them but because of all this the trade quantities are different and my live version missed the biggest loser. Despite all this the strategy seems to have traded pretty well so far.

    Live test is on the left in the images and backtest is on the right.

    TempusFugit thanked this post
    Screenshot_8.png Screenshot_8.png Screenshot_9.png Screenshot_9.png Screenshot_10.png Screenshot_10.png
    #102836 quote
    coscar
    Participant
    Senior

    Hi guys presents a variant of the code created with the addition of an output based on the filter by John Ehlers, plus I added some optional features like Martingala, Capital reinvestment. I tested the system starting from a minimum capital of € 500.00 and I always got the same result, it seems that the system is quite stable in the long run. I hope someone can take an interest and improve it. Share the variations. Thank you

    //@Coscar Break Out Point| Eur/Usd mini - 1D  Capital Ini Eur 500,00
     
    DEFPARAM CUMULATEORDERS= false
    DEFPARAM PRELOADBARS = 10000
    
    //***********************************************************************************************************
    CapitalIni = 10000       // Capitale iniziale cifra intera min € 500,00
    CapitalRisk = 10        // Percentuale di rischio del capitale
    NrContratti = 0.5        // numero di contratti iniziali
    MargineBroker = 378      // Margine richiesto dal broker IG MARKET per 1 contratto Eur/Usd Mini
    Martingala = 1          // "1" per ON , "0" per OFF del sistema Martinagala
    Multi = 1.8             //Martingala Moltiplicatore in caso di vincita - "1" per OFF
    Reinvestimento = 1      // "1" per ON , "0" per OFF reinvestimento Capitale e profitto
    Perc = 20              // Percentuale del capitale destinato al reinvestimento (consiglio max 30%)
    Protec = 100           // "0" per OFF, Contratti massimi consentiti al sistema -Ricordarsi di inserire questo valore in fase di Trading Automatico in PRT
    
    //------------------ EVENTUALI VARIABILI DEL SISTEMA---------------------------------------
    Avg = 2                // Moving Average Period DEFAULT 2 Day
    Atrs = 0.16            // Multiplier coefficient Atr
    m = 2.1//1.8           // Multiplier coefficient Stop Loss
    
    //***********************************************************************************************
    ONCE OrderSize = NrContratti
    ONCE ExitIndex = -2
    
    Capital= CapitalIni + strategyprofit
    
    IF Reinvestimento = 1 THEN
    NR = ((Capital * Perc/100)/MargineBroker)*1000
    n = (ROUND(NR)/1000)
    ELSE
    n = 0.5
    ENDIF
    
    IF Protec>0 AND n>Protec THEN
    n=Protec
    ENDIF
    
    //**************************************Indicator**************************************
    a1 = exp (-1.414 * 3.14159 / 10)
    b1 = 2 * a1 * cos (1.414 * 3.14159 / 10)
    c2 = b1
    c3 = -a1 * a1
    c1 = 1 - c2 - c3
    
    if barindex=0 then
    Filt = c1 * (Close) / 2
    elsif barindex=1 then
    Filt = c1 * (Close + Close[1]) / 2 + c2 * Filt[1]
    elsif barindex > 1 then
    Filt = c1 * (Close + Close[1]) / 2 + c2 * Filt[1] + c3 * Filt[2]
    endif
    
    closep=TotalPrice
    
    a1 = exp (-1.414 * 3.14159 / 10)
    b1 = 2 * a1 * cos (1.414 * 3.14159 / 10)
    c2 = b1
    c3 = -a1 * a1
    c1 = 1 - c2 - c3
    
    if barindex=0 then
    Filtp = c1 * (closep) / 2
    elsif barindex=1 then
    Filtp = c1 * (Closep + Closep[1]) / 2 + c2 * Filtp[1]
    elsif barindex > 1 then
    Filtp = c1 * (Closep + Closep[1]) / 2 + c2 * Filtp[1] + c3 * Filtp[2]
    endif
    Roofing =(Filt-Filtp)
    
    Atr = AverageTrueRange[14](close)
    x = average[Avg,3](Typicalprice)
    
    b1e = ((2*x)-high)+(ATR*ATRs)
    s1e = ((2*x)-Low)-(ATR*ATRs)
    Hbop = (2*x)-(2*Low)+High
    Lbop = (2*x)-(2*High)+Low
    
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND close<lbop THEN
    BUY OrderSize CONTRACTS AT b1e LIMIT
    SELL AT s1e LIMIT
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket THEN
    SELL AT s1e LIMIT
    IF close > positionprice THEN
    SELL AT MARKET
    ELSIF Roofing crosses under Roofing [1] THEN
    SELL AT MARKET
    ENDIF
    ExitIndex = BarIndex
    ENDIF
     
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND close>hbop THEN
    SELLSHORT OrderSize CONTRACTS AT s1e LIMIT
    EXITSHORT AT b1e LIMIT
    ENDIF
    
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket THEN
    EXITSHORT AT b1e LIMIT
    IF close < positionprice THEN
    EXITSHORT AT MARKET
    elsif Roofing crosses over Roofing [1] then
    EXITSHORT AT MARKET
    endif
    ExitIndex = BarIndex
    ENDIF
    
    SET STOP LOSS (m*ATR)
    
    //Martingala************************
    IF Barindex = ExitIndex + 1 THEN
    ExitIndex = 0
    IF PositionPerf(1) < 0 THEN
    OrderSize =  OrderSize + (Martingala*0)
    ELSIF PositionPerf(1) > 0 THEN
    OrderSize = 1 * n * Multi
    ENDIF
    ENDIF
    
    IF Capital<-CapitalIni*(CapitalRisk/100) THEN
    QUIT
    ENDIF
    
    
    //GRAPH OrderSize
    
    Cattura.png Cattura.png
    #102841 quote
    robertogozzi
    Moderator
    Master

    What’s the DRAWDOWN, on my test it was over 41K US$?

    I think starting with a minimun capital of 200K US$ would make IG/Esma much happier!

    #102847 quote
    coscar
    Participant
    Senior

    thanks roberto, currently I have suspended the prorealtime platform with IG in Reale, so the test is with 100000 bars. You could send me a screenshots to see the DD, it doesn’t come out to me. thank you

    #102849 quote
    robertogozzi
    Moderator
    Master

    It happens many times to me, too. It’s a real nuisance!

    Just repeat the backtest over and over until it appears!!!!

    #102850 quote
    coscar
    Participant
    Senior

    Hi Roberto, I reactivated PRT in Reale, this is the test on 200,000 bars, spread 1 pip. The overall DD is 27% and it is normal that in the end there is a value of 55,000 as proportionate to the contracts. Try disabling Reinvestment and Martingale. If there are errors, could you kindly highlight them? Thank you Greetings

    Cattura2.png Cattura2.png
    #102876 quote
    Gregg
    Participant
    Average

    Hi Coscar and Roberto,

    it seems that most profits are made in the day or in max 2 or 3 days. And the biggest losses in 3 to 6 days. So should not we close after 48h max?

    Capture-2.png Capture-2.png
    #102891 quote
    Vonasi
    Moderator
    Master

    it seems that most profits are made in the day or in max 2 or 3 days. And the biggest losses in 3 to 6 days. So should not we close after 48h max?

    There is not much logic in this as maybe at the 48 hour point all those trades were actually in bigger losses and recovered a bit in the following few days and were closed for a smaller loss than would have been achieved at the 48 hour point.

    You can add something to the code to test this but really it is just data mining as there is no good reason why future trades should be at smaller losses just because 48 hours has passed by since they were opened.

    Avoiding over night fees is not of major benefit as it is a long and short forex strategy so we pay to be long and get paid to be short.

    Gregg thanked this post
    #102906 quote
    Gregg
    Participant
    Average

    Thanks Vonasi for your explanation, I agree with you.

    However I am surprised when I look at the MFE column. It seems that all losing trades have been directly negative and have never gone positive even for a short time.  Unless I do not understand this column well  🙂

    #102923 quote
    GraHal
    Participant
    Master

    Just repeat the backtest over and over until it appears!!!!

    Until what appears?

    Depending what is your answer then I may have a quicker solution for you than repeating backtests.

    #102926 quote
    Gregg
    Participant
    Average

    I think he is talking about the Drawdown percent! Sometimes it doesn’t calculate and stay to 0 so we have to launch a backtest again.

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

Strategy Eur/Usd mini, how to reduce the maximum % drawdown?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
coscar @coscar Participant
Summary

This topic contains 54 replies,
has 7 voices, and was last updated by Gregg
6 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/18/2018
Status: Active
Attachments: 22 files
Logo Logo
Loading...