Stratégie DAX40 : retest de l’open drive 9h en ProOrder

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #261614 quote
    Lifen
    Participant
    Senior

    Bonjour,

    Merci de votre aide par avance pour coder l’algo avec les paramètres suivants pour le dax40. Setup : retest de l’open de la bougie de 9h quand elle fait un open drive. On vend avec 1 contrat le niveau de l’open de 9h si la bougie est partie à la baisse et quand ce niveau sera retesté. On achète 1 avec contrat le niveau de l’open de 9h si la bougie est partie à la hausse et quand ce niveau sera retesté. tp 40 points, sl 40 points. Question : la vente ou l’achat se fait bien au niveau de l’open ou au niveau de l’ouverture de la bougie suivante ? Il faut vraiment le prix de l’open de la bougie de 9h…

    DAX-5-minutes.png DAX-5-minutes.png
    #261630 quote
    Nicolas
    Keymaster
    Legend

    Bonjour,

    l’ordre est placé avec “BUY/SELLSHORT AT Open9h LIMIT”. Open9h est strictement l’open de la bougie de 9h00, capturé au tick près dès l’ouverture de cette bougie. Ce n’est PAS le prix d’ouverture de la bougie suivante. L’exécution se fait donc exactement au niveau de l’open 9h (ou mieux, c’est la définition d’un ordre LIMIT), au moment où le marché revient toucher ce niveau lors du retest.

    Logique du système:

    • Sur la bougie de 9h, on enregistre son open et son close.
    • Si close 9h > open 9h : open drive haussier → on place un ordre BUY LIMIT à l’open 9h, en attendant que le marché reteste ce niveau.
    • Si close 9h < open 9h : open drive baissier → on place un ordre SELLSHORT LIMIT à l’open 9h, idem.
    • TP à 40 points, SL à 40 points, tous deux calculés depuis l’open 9h (pas depuis le prix d’exécution, ce qui est identique puisque l’exécution se fait à ce niveau exact).
    • Clôture forcée à 17h30 si la position est encore ouverte.
    • Timeframe conseillé : 1 minute ou 5 minutes.
    // ============================================================
    // Open Drive 9h - Retest strategy - DAX40
    // Timeframe recommandé : 1 minute ou 5 minutes
    // ============================================================
    DEFPARAM CumulateOrders = False
    
    
    // --- Paramètres ---
    TPPoints = 40
    SLPoints = 40
    
    
    // --- Capture de l'open et de la direction de la bougie de 9h ---
    IF OpenTime = 090000 THEN
    Open9h      = open
    Close9h     = close
    Open9hSaved = 1
    ENDIF
    
    
    // Conserver les valeurs en mémoire sur les bougies suivantes
    IF Open9hSaved[1] = 1 AND OpenTime <> 090000 THEN
    Open9h      = Open9h[1]
    Close9h     = Close9h[1]
    Open9hSaved = 1
    ELSIF Open9hSaved[1] = 1 AND OpenTime = 090000 THEN
    Open9hSaved = Open9hSaved[1]
    ELSIF Open9hSaved = 0 AND Open9hSaved[1] = 0 THEN
    Open9h      = 0
    Close9h     = 0
    Open9hSaved = 0
    ENDIF
    
    
    // --- Direction de l'open drive ---
    BullishDrive = (Close9h > Open9h) AND Open9hSaved = 1 AND Open9h > 0
    BearishDrive = (Close9h < Open9h) AND Open9hSaved = 1 AND Open9h > 0
    
    
    // --- Fenêtre de trading : uniquement après 9h et avant 17h30 ---
    TradingWindow = OpenTime > 090000 AND OpenTime < 173000
    
    
    // ---------------------------------------------------------------
    // ENTREES en ordre LIMIT au niveau exact de l'open de 9h
    // ---------------------------------------------------------------
    IF NOT OnMarket AND BullishDrive AND TradingWindow and close>open9h THEN
    BUY 1 CONTRACT AT Open9h LIMIT
    ENDIF
    
    
    IF NOT OnMarket AND BearishDrive AND TradingWindow and close<open9h THEN
    SELLSHORT 1 CONTRACT AT Open9h LIMIT
    ENDIF
    
    
    // ---------------------------------------------------------------
    // SORTIES : TP et SL
    // ---------------------------------------------------------------
    IF LongOnMarket THEN
    ExitLongSL  = Open9h - SLPoints * PointSize
    ExitLongTP  = Open9h + TPPoints * PointSize
    SELL 1 CONTRACT AT ExitLongTP LIMIT
    SELL 1 CONTRACT AT ExitLongSL STOP
    ENDIF
    
    
    IF ShortOnMarket THEN
    ExitShortSL  = Open9h + SLPoints * PointSize
    ExitShortTP  = Open9h - TPPoints * PointSize
    EXITSHORT 1 CONTRACT AT ExitShortTP LIMIT
    EXITSHORT 1 CONTRACT AT ExitShortSL STOP
    ENDIF
    
    
    // --- Clôture forcée à 17h30 ---
    IF LongOnMarket AND OpenTime >= 173000 THEN
    SELL AT MARKET
    ENDIF
    
    
    IF ShortOnMarket AND OpenTime >= 173000 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    
    graphonprice open9h coloured("orchid")
    

    2 points qui pourraient être améliorés selon la stratégie ? soit:

    1. peut on trader plusieurs fois le même jour ?
    2. le prix doit il être strictement inférieure (ou supérieure) depuis l’ouverture pour autoriser un trade ?
    Iván González, Lifen and robertogozzi thanked this post
    #261631 quote
    Iván González
    Moderator
    Legend

    Bonjour ! Voilà !

    DEFPARAM CumulateOrders = false
    
    
    // ---- Paramètres (optimisables) ----
    minBody  = 10      // corps minimum de la bougie 9h pour valider le "drive" (points)
    tp       = 40      // take profit (points)
    sl       = 40      // stop loss (points)
    refHour  = 090000  // bougie de référence (HHMMSS, horaire de VOTRE plateforme)
    endHour  = 173000  // dernière heure valable pour le retest
    flatHour = 175500  // clôture forcée de la séance (pas d'overnight)
    
    
    // ---- Reset au début de la journée ----
    if IntradayBarIndex = 0 then
       tradeDone  = 0     // pas encore d'entrée aujourd'hui
       open9h     = 0
       driveLong  = 0
       driveShort = 0
    endif
    
    
    // ---- Open de 9h + direction du drive ----
    if opentime = refHour then
       open9h     = open
       driveLong  = close > open + minBody    // open drive haussier
       driveShort = close  refHour and opentime  0 then
       if driveLong then
          BUY 1 CONTRACT AT open9h LIMIT
       elsif driveShort then
          SELLSHORT 1 CONTRACT AT open9h LIMIT
       endif
    endif
    
    
    // ---- Gestion de la position ----
    SET TARGET pPROFIT tp
    SET STOP pLOSS sl
    
    
    // ---- Clôture forcée fin de séance ----
    if opentime >= flatHour then
       if LongOnMarket then
          SELL AT MARKET
       endif
       if ShortOnMarket then
          EXITSHORT AT MARKET
       endif
    endif
    

    J’ai envisagé d’entrer en position au même niveau que la bougie d’ouverture.

    Lifen and robertogozzi thanked this post
    #261635 quote
    Lifen
    Participant
    Senior

    Bonjour Nicolas,

    Merci pour ta précieuse aide. Réponse à tes questions:

    1. peut on trader plusieurs fois le même jour ? Non 1 seul trade , le premier retest
    2. le prix doit il être strictement inférieure (ou supérieure) depuis l’ouverture pour autoriser un trade ? Oui


    Bonne journée

    #261637 quote
    Nicolas
    Keymaster
    Legend

    Ok, voici donc ci-dessous une version plus adaptée selon tes réponses.

    // ============================================================
    // Open Drive 9h - Retest strategy - DAX40
    // Timeframe recommandé : 1 minute ou 5 minutes
    // ============================================================
    DEFPARAM CumulateOrders = False
    
    
    // --- Paramètres ---
    TPPoints = 40
    SLPoints = 40
    
    
    // --- Capture de l'open et de la direction de la bougie de 9h ---
    IF OpenTime = 090000 THEN
    Open9h      = open
    Close9h     = close
    Open9hSaved = 1
    traded=0
    baropen=barindex
    ENDIF
    
    
    // Conserver les valeurs en mémoire sur les bougies suivantes
    IF Open9hSaved[1] = 1 AND OpenTime <> 090000 THEN
    Open9h      = Open9h[1]
    Close9h     = Close9h[1]
    Open9hSaved = 1
    ELSIF Open9hSaved[1] = 1 AND OpenTime = 090000 THEN
    Open9hSaved = Open9hSaved[1]
    ELSIF Open9hSaved = 0 AND Open9hSaved[1] = 0 THEN
    Open9h      = 0
    Close9h     = 0
    Open9hSaved = 0
    ENDIF
    
    
    // --- Direction de l'open drive ---
    baroffset = max(1,barindex-baropen)
    BullishDrive = (Close9h > Open9h) AND Open9hSaved = 1 AND Open9h > 0 AND summation[baroffset](close>=open9h)=baroffset
    BearishDrive = (Close9h < Open9h) AND Open9hSaved = 1 AND Open9h > 0 AND summation[baroffset](close<=open9h)=baroffset
    
    
    // --- Fenêtre de trading : uniquement après 9h et avant 17h30 ---
    TradingWindow = OpenTime > 090000 AND OpenTime < 173000
    
    
    // ---------------------------------------------------------------
    // ENTREES en ordre LIMIT au niveau exact de l'open de 9h
    // ---------------------------------------------------------------
    if not traded then 
    IF NOT OnMarket AND BullishDrive AND TradingWindow and close>open9h THEN
    BUY 1 CONTRACT AT Open9h LIMIT
    ENDIF
    
    
    IF NOT OnMarket AND BearishDrive AND TradingWindow and close<open9h THEN
    SELLSHORT 1 CONTRACT AT Open9h LIMIT
    ENDIF
    endif 
    
    
    // ---------------------------------------------------------------
    // SORTIES : TP et SL
    // ---------------------------------------------------------------
    if onmarket then 
    traded=1
    endif
    
    
    IF LongOnMarket THEN
    ExitLongSL  = Open9h - SLPoints * PointSize
    ExitLongTP  = Open9h + TPPoints * PointSize
    SELL 1 CONTRACT AT ExitLongTP LIMIT
    SELL 1 CONTRACT AT ExitLongSL STOP
    ENDIF
    
    
    IF ShortOnMarket THEN
    ExitShortSL  = Open9h + SLPoints * PointSize
    ExitShortTP  = Open9h - TPPoints * PointSize
    EXITSHORT 1 CONTRACT AT ExitShortTP LIMIT
    EXITSHORT 1 CONTRACT AT ExitShortSL STOP
    ENDIF
    
    
    // --- Clôture forcée à 17h30 ---
    IF LongOnMarket AND OpenTime >= 173000 THEN
    SELL AT MARKET
    ENDIF
    
    
    IF ShortOnMarket AND OpenTime >= 173000 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    
    graphonprice open9h coloured("orchid")
    
    Lifen and robertogozzi thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Stratégie DAX40 : retest de l’open drive 9h en ProOrder


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Lifen @lifen Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Nicolas
1 week ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/31/2026
Status: Active
Attachments: 1 files
Logo Logo
Loading...