Backtest breakout

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #133922 quote
    manoloribera
    Participant
    New

    Bonjour,

    Je souhaiterais coder une technique afin de backtester son efficacité. Voici les conditions que j’aimerais passer sous forme de langage PRT :

    ACTIF : DAX
    UT : 15 min
    HORAIRES : 09h00 à 17h30

    Conditions:
    SI la bougie précédente = inside bar ET SI (high-low) de la bougie précédente <= 25 points ALORS :
    SI la bougie en cours dépasse (strictement supérieur) le + haut de la bougie précédente ALORS :
    LONG
    ET :
    TP1 50 % : +5 et stop à 0
    TP2 25 % : +20 et stop à +10
    TP3 25 % : +50
    STOP LOSS : + bas de la bougie précédente

    SI la bougie en cours dépasse (strictement inférieur) le + bas de la bougie précédente ALORS :
    SHORT
    TP1 50 % : +5 et stop à 0
    TP2 25 % : +20 et stop à +10
    TP3 25 % : +50
    STOP LOSS : + haut de la bougie précédente

    Conditions supplémentaires : jamais 2 positions ouvertes en même temps.
    Si à 17h30 une position est ouverte, laisser courir.

     

    Merci pour votre aide 🙂

    #133967 quote
    Nicolas
    Keymaster
    Master

    La fermeture partielle n’est pas encore possible sous ProOrder avec IG (après update v11 prévu).

    Est-ce un problème ? On peut toute de même le faire en backtest et vérifier la stratégie.

    #133969 quote
    manoloribera
    Participant
    New

    Bonjour monsieur,

    Merci pour votre retour.

    En effet, laissons les conditions telles que définies et remplaçons les TPs par un TP unique 100% à +5. Et STOP LOSS : + haut/bas de la bougie 15 min précédente.

     

    Voici le code pour l’inside bar :

    c1= high[0] < high[1]
    c2= low[0] > low[1]
    insidebar = c1 and c2
    return insidebar

     

    Pourriez-vous m’aider pour les autres paramètres du code ? A savoir comment définir l’actif, l’UT souhaité, les horaires de trading et la définition des conditions avec le TP et SL associé..

     

    Merci par avance 🙂

    #134156 quote
    Nicolas
    Keymaster
    Master

    Ci-joint le code de la stratégie à tester :

    DEFPARAM CumulateOrders = False 
    defparam flatbefore=090000
    defparam flatafter=173000
    
    takeprofit = 50 //parametre du takeprofit en points 
    
    c1= high[0] < high[1]
    c2= low[0] > low[1]
    insidebar = c1 and c2
    
    buyc = not onmarket and insidebar[1] and range[1]<=25*pointsize and high>high[1]
    
    if buyc then 
    buy at market 
    set target pprofit takeprofit 
    set stop loss close-low[1]
    endif
    
    sellc = not onmarket and insidebar[1] and range[1]<=25*pointsize and low<low[1]
    
    if sellc then 
    sellshort at market 
    set target pprofit takeprofit
    set stop loss high[1]-close
    endif
    

    Le takeprofit est réglable en tête de code.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Backtest breakout


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Nicolas
5 years, 9 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/30/2020
Status: Active
Attachments: No files
Logo Logo
Loading...