breackout range

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #3593 quote
    yassel
    Participant
    Average

    bonsoir,

    j’aurais besoin d’aide pour coder la stratégie suivante :

    je veux définir un range sur 60 minutes et s’il est cassé, entrer en position

    Par exemple : entre 8h et 9h (preouverture): définition du range avec plus haut et plus bas en timeframe 15min

    à partir de 9h:

    si cassure du plus haut atteint entre 8h et 9h, entrer long directement avec stop ptrailing

    et short, si cassure du plus bas atteint entre 8h et 9h directement avec stop ptrailing

    merci d’avance pour votre aide

    Allemagne-30-au-comptant-Mini-contr-.png Allemagne-30-au-comptant-Mini-contr-.png
    #3596 quote
    yassel
    Participant
    Average

    Allemagne 30 au comptant (Mini-contr (-)

    #3606 quote
    Nicolas
    Keymaster
    Master

    Bonjour yassel,

    Voilà votre stratégie, je vous laisse régler le pTrailing à votre convenance. Cette stratégie de breakout est assez similaire de celle de la documentation et employé ici : http://www.prorealcode.com/prorealtime-trading-strategies/breakout-proorder-french-cac40/ (en un peu plus compliqué toutefois, puisqu’on y intègre des conditions restrictives sur la quantité d’ordre journalière et sur des conditions de prises de positions selon la largeur du range.

    rangestarthour = 080000
    rangeendhour = 090000
    
    if time < rangestarthour OR Intradaybarindex = 0 then
     hh = 0
     ll = 0
    endif
    
    if time>rangestarthour AND time  <= rangeendhour then
     if high[0]>hh then
      hh = high[0]
     endif
     if low[0]<ll OR ll=0 then
      ll = low[0]
     endif
    endif
    
    if NOT LONGONMARKET AND time >= rangeendhour AND close crosses over hh then
     BUY 1 CONTRACTS AT MARKET
    endif
    
    if NOT SHORTONMARKET AND time >= rangeendhour AND close crosses under ll then
     SELLSHORT 1 CONTRACTS AT MARKET
    endif
    
    SET STOP pTRAILING 50
    
    GRAPH hh as "range top"
    GRAPH ll as "range bottom"
    #3610 quote
    yassel
    Participant
    Average

    Merci beaucoup Nicolas

    Je pense que je peux également l’utiliser tel quelle pour du timeframe 5 min sans modification ? (Car j’ai mentionné le 15 min précédemment).

     

    Je vous remercie par avance

    #3614 quote
    yassel
    Participant
    Average

    est il possible d’ouvrir la position des que la condition est realisée et non pas attendre l’ouverture de la prochaine bougie ?

    merci Nicolas

    #3617 quote
    Nicolas
    Keymaster
    Master

    Oui pour le 5 minutes. Non pour le trade immédiat, PRT prend position à l’ouverture de bougie. Vous pouvez anticiper les conditions en changeant les valeurs des 2 variables horaires ou éventuellement travailler en 1 minute pour être plus précis sur les prix d’entrée.

    #4196 quote
    ghary
    Participant
    Veteran

    Bonjour

    Est il possible d’avoir cela mais sous forme d’indicateur et non de trade automatique ?

     

    Merci

    #4197 quote
    Doctrading
    Participant
    Master

    Bonjour,

    Pour l’avoir en indicateur, je te suggère juste de remplacer les ordres “Buy” et “Sellshort” par la définition de ton indicateur.
    Par exemple :

    en début de code tu mets : “indicateur = 0”

    et tu remplaces la ligne “Buy” par “indicateur = 1” ou “Sellshort” par “indicateur = -1”

    A la fin, on met Return indicateur as “INDICATEUR”

     

    Peut être le savais-tu déjà. En principe il est très facile de passer d’un backtest à un indicateur ou à un screener.
    Le plus dur c’est de trouver la bonne formule de backtest.
    En espérant avoir aidé,

    Bon courage !

    #4209 quote
    ghary
    Participant
    Veteran

    Merci pour la réponse rapide, ceci dit je ne suis pas un virtuose de la programmation PRT

    j’ai mis ça:

    indicateur =0

    rangestarthour = 080000
    rangeendhour = 090000
    if time < rangestarthour OR Intradaybarindex = 0 then
    hh = 0
    ll = 0
    endif

    if time>rangestarthour AND time <= rangeendhour then
    if high[0]>hh then
    hh = high[0]
    endif
    if low[0]<ll OR ll=0 then
    ll = low[0]
    endif
    endif

    if NOT LONGONMARKET AND time >= rangeendhour AND close crosses over hh then
    indicateur=1
    endif

    if NOT SHORTONMARKET AND time >= rangeendhour AND close crosses under ll then
    indicateur=-1
    endif

    Par contre lorsque je valide il me dit les ordres BUY/SELL ne sont pas autorisés mais pourtant je les ai enlevé…

    NON ?
    Return indicateur as “indicateur”

    #4210 quote
    Doctrading
    Participant
    Master

    Il faut retirer les “longonmarket” et “shortonmarket”

    C’est à cause de ça.

    Il faut revoir le code en conséquence. A la place, on peut mettre “if indicator = 1” ou “if indicator = -1” par exemple.
    Je n’ai pas accès à PRT depuis mon ordi au boulot, mais j’essaierai de corriger ce code peut être ce soir.
    Cordialement,

    #4312 quote
    ghary
    Participant
    Veteran

    Bonjour,

    Je vais regarder cela et changer les termes…merci

    #4323 quote
    ghary
    Participant
    Veteran

    Bon j’ai mis cela mais cela ne donne rien: bizarre

    rangestarthour = 080000
    rangeendhour = 090000
    
    if time < rangestarthour OR Intradaybarindex = 0 then
    hh = 0
    ll = 0
    endif
    
    if time>rangestarthour AND time <= rangeendhour then
    if high[0]>hh then
    hh = high[0]
    endif
    if low[0]<ll OR ll=0 then
    ll = low[0]
    endif
    endif
    
    if indicateur=1 AND time >= rangeendhour AND close crosses over hh then
    indicateur=1
    endif
    
    if indicateur=-1 AND time >= rangeendhour AND close crosses under ll then
    indicateur=-1
    endif
    
    Return indicateur as"indicateur"
    #4366 quote
    Doctrading
    Participant
    Master

    Ca ne peut pass marcher car tu as écrit :

    “if indicateur = 1 then” et “if indicateur = -1 then”

    Or, à aucun moment ta variable “indicateur” passe à 1 ou à -1

    donc ça ne déclenche rien.
    Il faut revoir ton code en retirant cela et en remettant les bons paramètres.

    Je n’ai pas étudié le code en détails, mais après ça fonctionnera forcément.

    Si j’ai le temps j’importerai ton code et je le testerai pour corriger l’erreur.

    #4368 quote
    Doctrading
    Participant
    Master

    Essaie ceci.
    J’ai donc retiré “indicateur = 1” ou “-1” dans les conditions, et rajouté “indicateur = 0” au début.

    Ca donne quelque chose de positif, à toi d’adapter en fonction.
    Cordialement,

    rangestarthour = 080000
    rangeendhour = 090000
    indicateur = 0
    
    if time < rangestarthour OR Intradaybarindex = 0 then
    hh = 0
    ll = 0
    endif
    
    if time>rangestarthour AND time <= rangeendhour then
    if high[0]>hh then
    hh = high[0]
    endif
    if low[0]<ll OR ll=0 then
    ll = low[0]
    endif
    endif
    
    if time >= rangeendhour AND close crosses over hh then
    indicateur=1
    endif
    
    if time >= rangeendhour AND close crosses under ll then
    indicateur=-1
    endif
    
    Return indicateur as"indicateur"
    
    #4377 quote
    Nicolas
    Keymaster
    Master

    Bravo Docteur Marc, merci du coup de main 🙂

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

breackout range


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
yassel @yassel Participant
Summary

This topic contains 15 replies,
has 4 voices, and was last updated by ghary
9 years, 11 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 03/11/2016
Status: Active
Attachments: No files
Logo Logo
Loading...