Strategy DayOpen Straddle for DAX

Viewing 15 posts - 61 through 75 (of 242 total)
  • Author
    Posts
  • #84989 quote
    Harrys
    Participant
    Junior

    Havent  thought about using seasonality before so thanks for the info!

    #85112 quote
    ullle73
    Participant
    Senior

    how come it takes a short on this trade? Look at my pic, opens up above x points. High of that candle is lower than lowest high of prev 2 daily?

    7.jpg 7.jpg
    #85114 quote
    ullle73
    Participant
    Senior

    how come it takes a short on this trade? Look at my pic, opens up above x points. High of that candle is lower than lowest high of prev 2 daily?

    thah should be a long?

    If High > Dayopen+nopl Then
    Mclong=1

    #85121 quote
    Paul
    Participant
    Master

    @ullle73, could you plz provide the settings you used and modified?

    #85130 quote
    ullle73
    Participant
    Senior

    @ullle73, could you plz provide the settings you used and modified?

    i only modified:

    NOP=2 //number of points

    and stoploss+target

    #85131 quote
    ullle73
    Participant
    Senior

    used the original code you did, from dax 3 min

    #85133 quote
    volpiemanuele
    Participant
    Veteran
    L    = 0.88 // % Stoploss
    PT    = 1.41 // % Profit Target
    MFETS = 0.35 // % Mfe Trailing Stop
    BES   = 0.35 // % Break Even Stop
    BESMP = 0.05 // % Break Even Stop Minimum Profit
    WTSMP = 0.50 // % Williams Trailing Stop Minimum Profit If Mfe Trailing Stop Is Not Used
    ETD   = 0    //   Exclude a Trade Day; Sunday = 0
    If Usepercentage Then
    Nopl=((Dayopen*0.15)/100)/pointsize
    Nops=((Dayopen*0.15)/100)/pointsize
    Else
    Nopl=13 //number of points long
    Nops=14 //number of points short
    Endif
    

    These are my settings for time frame 3 minutes. Best result with optimization and WFA analysis with 7 period.

     

    Nopl and Nops are the point that the system add to Dayopen (Open of candle of 09:00) in order to test for the high for each candles starting from 9:00 until 10:00

    GraHal, armin, Paul and capgros thanked this post
    #85134 quote
    volpiemanuele
    Participant
    Veteran

    With the copy and paste I have made a mistak…replace L with SL…sorry

    GraHal and armin thanked this post
    #85153 quote
    Paul
    Participant
    Master

    @ullle73, I can’t duplicate your trade, but here’s a quick indicator code which can be used to understand trades.

    TimeOpen=090000
    nopL=2
    nopS=2
    
    If time = TimeOpen then
    BaseLine=open
    BuyLine=BaseLine+nopL
    ShortLine=BaseLine-nopS
    endif
    
    RETURN BaseLine COLOURED(0,0,0) as "BaseLine", BuyLine COLOURED(0,128,0) as "BuyLine", ShortLine COLOURED(255,0,0) as "ShortLine"
    

    If you add this to the pricechart, you will see that the open is taken 1 bar before 9u am.

    #85212 quote
    ullle73
    Participant
    Senior

    @ullle73, I can’t duplicate your trade, but here’s a quick indicator code which can be used to understand trades.

    If you add this to the pricechart, you will see that the open is taken 1 bar before 9u am.

    what? no? in my pic it shows the daily on the front pic, and the big  pic behind is 5 min.

    #85214 quote
    ullle73
    Participant
    Senior

    so if it opens down 4 points, and my settings on nopl/nops = 4, it only takes longs? and if it opens up by 4 points, it only takes shorts?

    #85215 quote
    Inertia
    Participant
    Master

    Hi, this picture may help you.

    thx.

    Indic.jpg Indic.jpg
    #85217 quote
    ullle73
    Participant
    Senior

    Hi, this picture may help you.

    thx.

    so it decides to long/short based on what line gets hit the first? If price reach green it takes a short? and if it reaches red first, it takes a long?

    #85219 quote
    ullle73
    Participant
    Senior

    “At 9’ am the strategy defines the open and buys x points above or sellshort x points below, whichever comes first.

    The assumption is, that once it’s opened, there is high probability that it continues at least x points in that direction.”

     

    This does not seem correct. Look at my picture, as Paul wrote in the original text, if price goes x points above open, it should be a long? my system takes shorts when that happens

    why.jpg why.jpg
    #85224 quote
    ullle73
    Participant
    Senior

    something is really off here. When i look at my code who got in short yesterday, here is the code:

    //-------------------------------------------------------------------------
    // Main code : DailyOpen Straddle OMX NYY
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Main Code : Straddle Dayopen V2.0
    //-------------------------------------------------------------------------
    // Test On DAX 30 Cash 10 Minute Timeframe 200k bars or from 1/1/2015
    
    // Common Rules
    Defparam Cumulateorders = False
    Defparam Preloadbars = 1000
    
    // On/off
    Extratradecriteria   = 1 // I.e. Long; Only Enters When The Current Bar High Is Lower Then The Lowest Daily High From Today, Yesterday And Day Before.
    Usepercentage        = 0 // The Minimum Difference In Percentage [[1] From Dayopen Or In Points [0] From Dayopen
    Mfetrailing          = 1 // Mfe Trailing Stop
    Wtrailing            = 1 // Williams 3 Bar Trailing Stop
    Breakevenstop        = 1 // Breakevenstop, Move Stoploss When Position Is In Profit.
    Excludefirsttwoweeks = 1 // Exclude The First 2 Weeks Of Every Year (Weeknumber 1 And 2)
    
    // Settings
    Positionsize = 1
    SL    = 1.00 // % Stoploss
    PT    = 1.50 // % Profit Target
    MFETS = 0.35 // % Mfe Trailing Stop
    BES   = 0.35 // % Break Even Stop
    BESMP = 0.05 // % Break Even Stop Minimum Profit
    WTSMP = 0.50 // % Williams Trailing Stop Minimum Profit If Mfe Trailing Stop Is Not Used
    ETD   = 0    //   Exclude a Trade Day; Sunday = 0
    If Usepercentage Then
    Nopl=((Dayopen*0.15)/100)/pointsize
    Nops=((Dayopen*0.15)/100)/pointsize
    Else
    Nopl=2 //number of points long
    Nops=2 //number of points short
    Endif
    
    // Day & Time
    Once Entertime = 090000
    Once Lasttime  = 100000
    Once Closetime = 240000 // Greater Then 23.59 Means It Continues Position Overnight
    Once Closetimefr=173000
    
    If Excludefirsttwoweeks=1 Then
    If Year=2015 And Month=1 And (Day>=1 And Day<=18) Then
    Notrading = 1
    Elsif Year=2016 And Month=1 And (Day>=1 And Day<=24) Then
    Notrading = 1
    Elsif Year=2017 And Month=1 And (Day>=1 And Day<=22) Then
    Notrading = 1
    Elsif Year=2018 And Month=1 And (Day>=1 And Day<=21) Then
    Notrading = 1
    Elsif Year=2019 And Month=1 And (Day>=1 And Day<=20) Then
    Notrading = 1
    Else
    Notrading = 0
    Endif
    Endif
    
    Tt1 = Time >= Entertime
    Tt2 = Time <= Lasttime
    Tradetime = Tt1 And Tt2 and Notrading = 0 And Dayofweek <> ETD
    
    // Reset At Start
    If Intradaybarindex = 0 Then
    Longtradecounter = 0
    Shorttradecounter = 0
    Tradecounter = 0
    Mclong = 0
    Mcshort = 0
    Endif
    
    // [pc] Position Criteria
    Pclong  = Countoflongshares < 1 And Longtradecounter < 1 And Tradecounter < 1
    Pcshort = Countofshortshares < 1 And Shorttradecounter < 1 And Tradecounter < 1
    
    // [mc] Main Criteria
    If Time = Entertime Then
    Dayopen=open
    Endif
    
    If High > Dayopen+nopl Then
    Mclong=1
    Else
    Mclong=0
    Endif
    
    If Low < Dayopen-nops Then
    Mcshort=1
    Else
    Mcshort=0
    Endif
    
    // [ec] Extra Criteria
    If Extratradecriteria Then
    Min1 = Min(Dhigh(0),dhigh(1))
    Min2 = Min(Dhigh(1),dhigh(2))
    
    Max1 = Max(Dlow(0),dlow(1))
    Max2 = Max(Dlow(1),dlow(2))
    
    Eclong = High < Min(Min1,min2)
    Ecshort = Low > Max(Max1,max2)
    else
    Eclong=1
    Ecshort=1
    Endif
    
    // Long & Short Entry
    If Tradetime Then
    If Pclong and Mclong And Eclong Then
    Buy Positionsize Contract At Market
    Longtradecounter=longtradecounter + 1
    Tradecounter=tradecounter+1
    Endif
    If Pcshort and Mcshort And Ecshort Then
    Sellshort Positionsize Contract At Market
    Shorttradecounter=shorttradecounter + 1
    Tradecounter=tradecounter+1
    Endif
    Endif
    
    // Break Even Stop
    If Breakevenstop Then
    If Not Onmarket Then
    Newsl=0
    Endif
    If Longonmarket And close-tradeprice(1)>=((Tradeprice/100)*BES)*pipsize Then
    Newsl = Tradeprice(1)+((Tradeprice/100)*BESMP)*pipsize
    Endif
    If Shortonmarket And Tradeprice(1)-close>=((Tradeprice/100)*BES)*pipsize Then
    Newsl = Tradeprice(1)-((Tradeprice/100)*BESMP)*pipsize
    Endif
    If Newsl>0 Then
    Sell At Newsl Stop
    Exitshort At Newsl Stop
    Endif
    Endif
    
    // Exit Mfe Trailing Stop
    If Mfetrailing Then
    Trailingstop = (Tradeprice/100)*MFETS
    If Not Onmarket Then
    Maxprice = 0
    Minprice = Close
    Priceexit = 0
    Endif
    If Longonmarket Then
    Maxprice = Max(Maxprice,close)
    If Maxprice-tradeprice(1)>=trailingstop*pipsize Then
    Priceexit = Maxprice-trailingstop*pipsize
    Endif
    Endif
    If Shortonmarket Then
    Minprice = Min(Minprice,close)
    If Tradeprice(1)-minprice>=trailingstop*pipsize Then
    Priceexit = Minprice+trailingstop*pipsize
    Endif
    Endif
    If Onmarket And Wtrailing=0 And Priceexit>0 Then
    Sell At Market
    Exitshort At Market
    Endif
    Endif
    
    // Exit Williams Trailing Stop
    If Wtrailing Then
    Count=1
    I=0
    J=i+1
    Tot=0
    While Count<4 Do
    Tot=tot+1
    If (Low[j]>=low[i]) And (High[j]<=high[i]) Then
    J=j+1
    Else
    Count=count+1
    I=i+1
    J=i+1
    Endif
    Wend
    
    Basso=lowest[tot](Low)
    Alto=highest[tot](High)
    
    If Close>alto[1] Then
    Ref=basso
    Endif
    If Close<basso[1] Then
    Ref=alto
    Endif
    
    If Onmarket And Mfetrailing=0 And Positionperf>WTSMP Then
    If Low[1]>ref And High<ref Then
    Sell At Market
    Endif
    If High[1]<ref And Low>ref Then
    Exitshort At Market
    Endif
    Endif
    
    If Onmarket And Mfetrailing=1 And Priceexit>0 Then
    If High<ref Then
    Sell At Market
    Endif
    If Low>ref Then
    Exitshort At Market
    Endif
    Endif
    Endif
    
    // Exit At Closetime
    If Onmarket Then
    If Time >= Closetime Then
    Sell At Market
    Exitshort At Market
    Endif
    Endif
    
    // Exit At Closetime Friday
    If Onmarket Then
    If (Currentdayofweek=5 And Time>=closetimefr) Then
    Sell At Market
    Exitshort At Market
    Endif
    Endif
    
    // Build-in Exit
    Set Stop %loss SL
    Set Target %profit PT
    
    //graph 0 Coloured(300,0,0) As "Zeroline"
    //graph (Positionperf*100)coloured(0,0,0,255) As "Positionperformance"
    

    BUT when i backtest it today, it enters long, but on automatic it took a short?! why?

    wtf.jpg wtf.jpg
Viewing 15 posts - 61 through 75 (of 242 total)
  • You must be logged in to reply to this topic.

Strategy DayOpen Straddle for DAX


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paul @micky75d Participant
Summary

This topic contains 241 replies,
has 39 voices, and was last updated by Monobrow
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/04/2018
Status: Active
Attachments: 100 files
Logo Logo
Loading...