DAX Return to Open Strategy

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #168793 quote
    phoentzs
    Participant
    Master

    Hallo,

    kann mir bitte jemand folgende Strategie codieren?

    Dax return to open:

    Eröffnungs-Kurs DAX 09:00

    Preiskanal mit Limit-Orders +30Pips über dem Open und -30Pips unter dem open

    Risiko 1:1,5 zum Beispiel SL30 TP45

    nur ein Trade am Tag

    Offene Trades werden abends geschlossen.
    Manuell scheint dies langfristig gut zu funktionieren, leider habe ich bisher keinen Backtest dazu programmieren können.
    Kann mir bitte jemand helfen?

    #168813 quote
    robertogozzi
    Moderator
    Master

    Getan:

    DEFPARAM CumulateOrders = FALSE
    ONCE Pips       = 30 * PipSize
    OTD = Barindex - TradeIndex(1) > IntradayBarIndex   //OTD One Trade per Day
    IF OpenTime < 090000 THEN
       LONGentry  = 0
       SHORTentry = 0
    ENDIF
    IF OpenTime = 090000 THEN
       LONGentry  = open - Pips       //LONG  entry for a Limit order
       SHORTentry = open + Pips       //SHORT entry for a Limit order
    ENDIF
    IF OpenTime >= 090000 AND Not OnMarket AND OTD THEN
       BUY       1 Contract AT LONGentry  LIMIT
       SELLSHORT 1 Contract AT SHORTentry LIMIT
    ENDIF
    SET TARGET pPROFIT 45
    SET STOP   pLOSS   30
    #168848 quote
    VinzentVega
    Participant
    Veteran

    Ich komme auf ein negatives Ergebnis beim backtest ab 12/2019.

    Mit ein paar Änderungen wenigstens im positiven Bereich. Aber ob sich der Aufwand/Risk  lohnt, bleibt dahingestellt.

    #168867 quote
    phoentzs
    Participant
    Master

    Vielen Dank erstmal.
    Ich schau mirs an wenn ich wieder etwas Zeit habe.
    Ich weiß das jemand dieses System erfolgreich schon über Jahre handelt. Aber eben manuell. Deswegen ist SL, TP und der Preiskanal sicher nicht in Stein gemeißelt. Vielleicht statt Pipsize einen ATR-Kanal? Trendfilter per MACD oder MA? Dann noch einen Breakeven-Trailing dazu.
    Ich bin gespannt.

    #192851 quote
    imokdesign
    Participant
    Senior
    @robertogozzi is it possible to change it a little bit? Open just one order 45min after market open  (9:45) // Go Long if price at (9:45) < open (9:00) // Go short if Price at (9:45) > open (9:00) // Stop and Profit Profit should be at open (9:00) Stoploss and simple pTrailing 20 pips away. Cancel  order not later than 17:30 @robertogozzi ist es möglich, es ein wenig zu ändern? Eröffnen Sie nur eine Order 45 Minuten nach Markteröffnung (9:45)

    // Go Long if

    price at (9:45) < open (9:00)

    // Go short if

    Price at (9:45) > open (9:00)

    // Stop and Profit

    Price Profit sollte offen sein (9:00) Stoploss und einfaches pTrailing 20 Pips entfernt. Bestellung bis spätestens 17:30 stornieren
    #192909 quote
    imokdesign
    Participant
    Senior
    hmmmm, I’m doing something wrong. The backtest don’t want to start. Mabe it would be more elegant with a take profit order. hmmm, irgendwas mache ich falsch. Der Backtest will nicht starten. Eleganter wäre es vielleicht mit einer Take-Profit-Order.
    // Return_to_open (on TF 15min)
    
    // Allg.
    DEFPARAM CUMULATEORDERS = false
    DEFPARAM PRELOADBARS = 200
    
    // Positionen ab 9:45 Uhr
    noEntryBeforeTime = 094500
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Positionen bis 10 Uhr 
    noEntryAfterTime = 100000
    timeEnterAfter = time < noEntryAfterTime
    
    // Trading am Mo, Di, Mi, Do, Fr
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Menge der Kontrakte
    n = 1
    
    // Indikatoren
    MarketOpen = 090000
    EntryTime = 094500
    
    // Bedingungen
    c1 = close > MarketOpen
    c2 = close < MarketOpen
    c3 = high > MarketOpen
    c4 = low < MarketOpen
    
    // Long Buy
    IF c2 AND not LongOnMarket AND not daysForbiddenEntry AND timeEnterBefore AND timeEnterAfter THEN
    BUY n SHARES AT MARKET
    ENDIF
    
    // Long Exit
    IF c4 THEN
    SELL AT MARKET
    ENDIF
    
    // Short Sell
    IF c1 AND not LongOnMarket AND not daysForbiddenEntry AND timeEnterBefore AND timeEnterAfter THEN
    SELLSHORT n SHARES AT MARKET
    ENDIF
    
    // Short Exit
    IF c3 THEN
    SELL AT MARKET
    ENDIF
    
    //Stop + Trailing
    SET STOP pLoss 20
    // SET STOP pTRAILING 10
    #192912 quote
    robertogozzi
    Moderator
    Master
    @imokdesign Poste nur in der Sprache des Forums in dem du postest. Zum Beispiel Englisch nur in englischen Foren und Deutsch nur in deutschen Foren. Danke 🙂 Ich schaue es mir schnellstmöglich an.
    #192993 quote
    robertogozzi
    Moderator
    Master
    Sie weisen der Variablen in den Zeilen 26-29 einen logischen (booleschen) Wert zu, keinen Preis. Was ist der Zweck dieser vier Zeilen?
    c1 = close > MarketOpen
    c2 = close < MarketOpen
    c3 = high > MarketOpen
    c4 = low < MarketOpen
    #192996 quote
    imokdesign
    Participant
    Senior
    Mit diesen Zeilen wollte ich die Eröffnung einer Long- oder einer Short Position um 9:45 zuweisen: – Ist der aktuelle Kurs um 9:45 Uhr tiefer als der Kurs um 9:00 Uhr wird eine Long order eröffnet. – Ist der aktuelle Kurs um 9:45 Uhr höher als der Kurs um 9:00 Uhr wird eine Short order eröffnet. Der Profit soll an der Stelle liegen, bei dem sich der Kurs um 9:00 Uhr befunden hat.
    #193095 quote
    robertogozzi
    Moderator
    Master
    Ersetzen Sie die Zeilen 26-29 durch diese:
    IF OpenTime = MarketOpen THEN
       MarketPrice = open
    ENDIF
    c1 = close > MarketPrice
    c2 = close < MarketPrice
    c3 = high  > MarketPrice
    c4 = low   < MarketPrice
    #193837 quote
    imokdesign
    Participant
    Senior
    thx robertogozzi … ich weiß grad nur nicht ob ich einen unterschied zwischen einem Long Stop und Profit und einem Short Stop und Profit machen muss:    
    // Return_to_open (on TF 15min)
    
    // Allg.
    DEFPARAM CUMULATEORDERS = false
    DEFPARAM PRELOADBARS = 200
    
    // Trading am Mo, Di, Mi, Do, Fr
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    OTD = Barindex - TradeIndex(1) > IntradayBarIndex   //OTD One Trade per Day
    
    // Menge der Kontrakte
    n = 1
    
    // Indikatoren
    MarketOpen = 090000
    EntryTime = 094500
    
    // Bedingungen
    IF OpenTime = MarketOpen THEN
    MarketPrice = open
    ENDIF
    
    c1 = close > MarketPrice
    c2 = close < MarketPrice
    c3 = high  > MarketPrice
    c4 = low   < MarketPrice
    
    // Long Buy
    IF c2 AND not LongOnMarket AND not daysForbiddenEntry AND OTD THEN 
    BUY n SHARES AT MARKET
    ENDIF
    
    // Short Sell
    IF c1 AND not ShortOnMarket AND not daysForbiddenEntry AND OTD THEN 
    SELLSHORT n SHARES AT MARKET
    ENDIF
    
    //Profit
    SET TARGET PROFIT TP
    
    IF EntryTime then
    myprice=MarketPrice
    Tp = close-myprice
    endif
    
    
    //Stop
    SET STOP LOSS SL
    SL = (close-myprice)*1
    #194178 quote
    robertogozzi
    Moderator
    Master
    Ersetzen Sie die Zeilen 42 – 50 durch diese:
    IF EntryTime then
    myprice=MarketPrice
    Tp = abs(close-myprice)
    endif
     
    
    //Stop
    SET STOP LOSS SL
    SL = abs(close-myprice)*1
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

DAX Return to Open Strategy


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

This topic contains 11 replies,
has 4 voices, and was last updated by robertogozzi
3 years, 8 months ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 05/04/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...