Coder un ordre stop qui reste valable sur plusieurs barres

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #121368 quote
    midel
    Participant
    Senior

    Bonjour,

    J’ai ce code sur une stratégie 1 minute qui s’annule après la bougie suivante, si pas exécuté. Or, je voudrais que ces ordres restent effectifs sur les 5 bougies suivantes. Comment coder cela ?

    if cond1  and cond2 then
    buy 1 contract at prix stop
    
    elsif cond3 and cond4 then
    sellshort1 contract at prix stop
    
    endif

     

    #121372 quote
    Nicolas
    Keymaster
    Master

    Enregistrer le BARINDEX et faire une condition basée sur une soustraction avec celui courant :

    if cond1  and cond2 then
     buybar = barindex
    elsif cond3 and cond4 then
     sellbar = barindex
    endif
    
    if barindex-buybar<=5 then 
     buy 1 contract at prix stop
    endif 
    
    if barindex-sellbar<=5 then 
     sellshort1 contract at prix stop
    endif
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Coder un ordre stop qui reste valable sur plusieurs barres


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
midel @midel Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
6 years ago.

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