Long et short en même temps

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #248526 quote
    PRC_2021
    Participant
    Average

    Oui je comprends. Sauf que là la SL est beaucoup plus haut que le High de la bougie précédente.

    J’aurais aimé qu’il soit juste au dessus comme ” >= high[1] ” pour un short et <= Low[1] pour un Long

    #248527 quote
    JS
    Participant
    Senior

    Salut,
    Lorsque tu veux utiliser la bougie qui precede l’ouverture d’une position, tu peux utiliser “High” et “Low” au lieu de “High[1]” et “Low[1]”…

    DEFPARAM CUMULATEORDERS = false
    
    TIMEFRAME(5 Minute)
    //Réinitialisation VALEUR
    if Not OnMarket THEN
    SLFinance = 0
    //SL = 0
    //TP1 = 0
    //TP2 = 0
    endif
    
    niveau = 42400
    
    Achat = open < niveau and close > niveau+2*pipsize
    Vente = open > niveau and close < niveau+2*pipsize
    
    if Achat and Not OnMarket then
    // POUR UN ACHAT
    //Ordre Achat
    BUY 2 CONTRACT AT MARKET
    SLFinance = 1
    SLA = Close-abs(Close - Low) 
    TP1A = Close+2*(abs(Close-Low)) 
    TP2A = Close+3*(abs(Close-Low))         
    SET STOP Price SLA
    ELSIF Vente and Not OnMarket THEN
    //Ordre VENTE
    SELLSHORT 2 CONTRACT AT MARKET
    SLFinance = 1
    SLV = Close+abs(close - High)
    TP1V = Close-2*(abs(Close-High))                                       
    TP2V = Close-3*(abs(Close-High))                                        
    SET STOP Price SLV
    ENDIF
    
    //SL et TP pour la position d'achat
    if longonmarket and close >= TP1A and SLFinance = 1 then
    sell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET
    set stop BREAKEVEN
    SLFinance = 2
    endif
    
    //SL et TP pour la position de vente
    If shortonmarket and close <= TP1V and SLFinance = 1 then
    EXITSHORT abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET
    set stop BREAKEVEN
    SLFinance = 2
    endif
    
    
    GRAPHONPRICE SLV  coloured("Red")
    GRAPHONPRICE TP1V coloured("Blue")
    GRAPHONPRICE TP2V coloured("GREEN")
    GraphOnPrice 42400
    PRC_2021 thanked this post
    #248528 quote
    PRC_2021
    Participant
    Average

    Entendu, merci pour tes conseils.

    JS thanked this post
Viewing 3 posts - 16 through 18 (of 18 total)
  • You must be logged in to reply to this topic.

Long et short en même temps


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
PRC_2021 @manu35250 Participant
Summary

This topic contains 17 replies,
has 4 voices, and was last updated by PRC_2021
8 months, 1 week ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/20/2025
Status: Active
Attachments: 3 files
Logo Logo
Loading...