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

Viewing 15 posts - 1 through 15 (of 55 total)
  • Author
    Posts
  • #87328 quote
    coscar
    Participant
    Senior

    Hi I’m new and not very experienced and for some time I try to learn information from the community. I ask you advice to improve this simple code that I developed but I would like to reduce the% Ma DrawDown and I think there is some error. Thanks to anyone who wants to help me.

    //Eur/Usd mini - 1D  Capital Eur 500,00
    
    DEFPARAM CUMULATEORDERS= false
    DEFPARAM PRELOADBARS = 10000
    n=1
    Atr = AverageTrueRange[14](close)
    Atrs = 0.1
    x = average[A,3]((High+Low+close)/3)
    
    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 n CONTRACTS AT b1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket THEN
    SELL AT s1e limit
    ENDIF
    
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND close>hbop THEN
    SELLSHORT n CONTRACTS AT s1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket THEN
    EXITSHORT AT b1e limit
    ENDIF
    set stop loss (1.8*ATR)
    highlow-154507517148lcp.png highlow-154507517148lcp.png
    #87369 quote
    robertogozzi
    Moderator
    Master

    Variable A is missing, what’s its value?

    #87371 quote
    Vonasi
    Moderator
    Master

    Are you aware that if your long or short limit orders open positions then you will not have a sell or exitshort order on the market until the close of the bar? You should add them in like this:

    / Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND close<lbop THEN
    BUY n CONTRACTS AT b1e limit
    SELL AT s1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket THEN
    SELL AT s1e limit
    ENDIF
    
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND close>hbop THEN
    SELLSHORT n CONTRACTS AT s1e limit
    EXITSHORT AT b1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket THEN
    EXITSHORT AT b1e limit
    ENDIF
    #87375 quote
    coscar
    Participant
    Senior

    Variable A is missing, what’s its value?

    a = 2

    Tanks

    #87377 quote
    coscar
    Participant
    Senior
    DEFPARAM CUMULATEORDERS= false
    DEFPARAM PRELOADBARS = 10000
    capital = 500 + strategyprofit
    n=1
    Atr = AverageTrueRange[14](close)
    Atrs = 0.1
    x = average[2,3]((High+Low+close)/3)
    ema=average[3,6](close)
    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 and close>ema THEN
    BUY n CONTRACTS AT b1e limit
    SELL AT s1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket THEN
    SELL AT s1e limit
    ENDIF
    
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND close>hbop and close<ema THEN
    SELLSHORT n CONTRACTS AT s1e limit
    EXITSHORT AT b1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket THEN
    EXITSHORT AT b1e limit
    ENDIF
    set stop loss (1.8*ATR)
    If Capital<-300 then
    quit
    endif
    

    I’ve applied some variations like an EMA filter

    #87378 quote
    coscar
    Participant
    Senior

    New Test

    variant.png variant.png
    #87380 quote
    robertogozzi
    Moderator
    Master

    You have to try changing values until you find the ones that you think are what suit you (not the market!) best.

    Setting an average type of 2 (wma), instead of 3, then 1.3 at line 34, provided variable A has been assigned 2, my drawdown drops to 267.30 as from screenshot.

    Try to walk forward your strategy.

    x-8.jpg x-8.jpg
    #87382 quote
    Vonasi
    Moderator
    Master

    I prefer to take stuff away rather than add it. I have removed the fixed level stop loss (it doesn’t add much anyway) and you have levels set to reverse the trades anyway. Most trades don’t seem to be more than one day so I have added exits at the close of any day that you are in profit. The ATRS variable has been optimised to 0.16. It seems pretty stable for a EUR/USD strategy. I wouldn’t add EMA’s as you are just adding an extra level of curve fit and EMA’s are oh so easy to curve fit!

    //Eur/Usd mini - 1D  Capital Eur 500,00
    
    DEFPARAM CUMULATEORDERS= false
    DEFPARAM PRELOADBARS = 10000
    
    a = 2
    t = 2
    //m = 2.7
    
    n=1
    Atr = AverageTrueRange[14](close)
    Atrs = 0.16
    x = average[A,3]((High+Low+close)/3)
    
    b1e = ((t*x)-high)+(ATR*ATRs)
    s1e = ((t*x)-Low)-(ATR*ATRs)
    Hbop = (t*x)-(t*Low)+High
    Lbop = (t*x)-(t*High)+Low
    
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND close<lbop THEN
    BUY n 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
    endif
    ENDIF
    
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND close>hbop THEN
    SELLSHORT n 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
    endif
    ENDIF
    //set stop loss (m*ATR)
    

    [attachment file=87383]

    [attachment file=87384]

    GraHal and Gregg thanked this post
    Screenshot_2-6.png Screenshot_2-6.png Screenshot_3-5.png Screenshot_3-5.png
    #87387 quote
    pippo999
    Participant
    Junior

    Great Work guys.

    Vanosi, is m = 2.7 ?

    #87388 quote
    Vonasi
    Moderator
    Master

    The name is Vonasi not Vanosi!

    m is the multiple of the ATR for the stoploss. If you unremark the stoploss and unremark the m = 2.7 then you can run it with a stoploss. 2.7 was the value that gave highest results.

    pippo999 thanked this post
    #87401 quote
    Vonasi
    Moderator
    Master

    Just out of interest I decided to take my version of your strategy and convert it to an end of day strategy. So I removed the limit orders and just bought or sold if it was above or below lbop and hbop. I reinstated the stop loss and optimised it and ATRS. I tested back to the beginning of 1995. Even if the ride was a little rough especially through the 2008 recession it was still ultimately a good equity curve. You may be on to something with your ATR band calculations. Are you sure that you’re new to this game?

    [attachment file=87402]

    [attachment file=87403]

     

    //Eur/Usd mini - 1D  Capital Eur 500,00
    
    DEFPARAM CUMULATEORDERS = false
    DEFPARAM PRELOADBARS = 10000
    
    a = 2
    t = 2
    m = 1.8
    
    n=1
    Atr = AverageTrueRange[14](close)
    Atrs = 0.01
    x = average[A,3]((High+Low+close)/3)
    
    b1e = ((t*x)-high)+(ATR*ATRs)
    s1e = ((t*x)-Low)-(ATR*ATRs)
    Hbop = (t*x)-(t*Low)+High
    Lbop = (t*x)-(t*High)+Low
    
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND close <= lbop THEN
    BUY n CONTRACTS AT market//b1e limit
    //SELL AT s1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket and close > s1e THEN
    SELL AT market//s1e limit
    if close > positionprice then//positionprice then
    sell at market
    endif
    ENDIF
    
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND close >= hbop THEN
    SELLSHORT n CONTRACTS AT market//s1e limit
    //EXITSHORT AT b1e limit
    ENDIF
    
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket and close < b1e THEN
    EXITSHORT AT market//b1e limit
    if close < positionprice then
    exitshort at market
    endif
    ENDIF
    set stop loss (m*ATR)
    
    //graph b1e
    //graph s1e
    //graph Hbop
    //graph Lbop
    //
    
    Screenshot_4-3.png Screenshot_4-3.png Screenshot_5-3.png Screenshot_5-3.png
    #87405 quote
    pippo999
    Participant
    Junior

    Ok ok sorry Vonasi 🙂 Have a nice weekend…..

    #87406 quote
    robertogozzi
    Moderator
    Master

    What an early weekend! You’re lucky Vonasi.

    #87407 quote
    Vonasi
    Moderator
    Master

    Every day is a weekend on a boat! 🙂

    #87408 quote
    pippo999
    Participant
    Junior

    Roberto, I forgot that someone need still to work … 😁😁

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