Ordre BREAKEN ne fonctionne pas

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #247877 quote
    PRC_2021
    Participant
    Average

    Bonjour,

    Je me retrouve avec beaucoup de SL ou de TP à100 alors que j’ai mis un BREAKEVEN ainsi qu’une clôture partielle à 50% => donc je de vrait jamais avoir de TP complet (à 100) mais seulement à 50 max.

    Voici le code. Merci pour votre aide.

    /SECURISATION
    
    
    
    //Ordre Achat
    IF achat and Not OnMarket THEN
    BUY 1 CONTRACT AT MARKET
    SLFinance = 0
    ENDIF
    //StopLoss financé à x points en coupant la moitié de la position
    if longonmarket and close-tradeprice>=25 and SLFinance = 0 then
    sell COUNTOFPOSITION/2 CONTRACTS AT MARKET
    set stop BREAKEVEN //////////////////////////////////////////////////////////////
    SLFinance = 1
    endif
     
    //Ordre Vente
    IF vente and Not OnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    SLFinance = 0
    ENDIF
    //StopLoss financé à x points en coupant la moitié de la position
    If shortonmarket and tradeprice-close>=25 and SLFinance = 0 then
    BUY COUNTOFPOSITION/2 CONTRACTS AT MARKET
    set stop BREAKEVEN //////////////////////////////////////////////////////////////
    SLFinance = 1
    endif
     
    // Stops and targets
    SET STOP pLOSS 25
    SET TARGET pPROFIT 100
    #247893 quote
    robertogozzi
    Moderator
    Master

    Sur les lignes 12 et 23, il est préférable d’ajouter /PipSize, sinon 25 risque de ne pas être converti correctement en différence de prix :

    if longonmarket and close-tradeprice>=25/PipSize and SLFinance = 0 then
    
    If shortonmarket and tradeprice-close>=25/PipSize and SLFinance = 0 then

    Utilisez EXITSHORT pour quitter une position courte :

    EXITSHORT

    Utilisez ABS() avec CountOfPosition, car il renvoie une valeur négative pour les opérations courtes :

    EXITSHORT abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET
    Iván González thanked this post
    #247907 quote
    PRC_2021
    Participant
    Average

    Entendu merci Roberto pour le retour.

    Par contre, je n’ai toujours aucun trade stopé à BE sur un test de 50K Unité. La sortie BE est elle bien codé ?

    #247909 quote
    JS
    Participant
    Senior

    Le problème est que la commande Set Stop BreakEven à la ligne 13 et à la ligne 25 est écrasée par la commande Set Stop pLoss 25 à la ligne 30…

    Par conséquent, le BreakEven n’est jamais activé…

    Iván González, robertogozzi and PRC_2021 thanked this post
    #247918 quote
    robertogozzi
    Moderator
    Master

    JS a raison, voici le code mis à jour :

    //SECURISATION
    
    
    
    //Ordre Achat
    IF achat and Not OnMarket THEN
    BUY 1 CONTRACT AT MARKET
    SLFinance = 0
    SET STOP pLOSS 25
    SET TARGET pPROFIT 100
    ENDIF
    //StopLoss financé à x points en coupant la moitié de la position
    if longonmarket and close-tradeprice>=25/PipSize and SLFinance = 0 then
    sell COUNTOFPOSITION/2 CONTRACTS AT MARKET
    set stop BREAKEVEN //////////////////////////////////////////////////////////////
    SLFinance = 1
    endif
     
    //Ordre Vente
    IF vente and Not OnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    SLFinance = 0
    SET STOP pLOSS 25
    SET TARGET pPROFIT 100
    ENDIF
    //StopLoss financé à x points en coupant la moitié de la position
    If shortonmarket and tradeprice-close>=25/PipSize and SLFinance = 0 then
    EXITSHORT abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET
    set stop BREAKEVEN //////////////////////////////////////////////////////////////
    SLFinance = 1
    endif
    JS and PRC_2021 thanked this post
    #247973 quote
    PRC_2021
    Participant
    Average

    Merci à tout les 2. Ca avance 🙂

    JS and robertogozzi thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Ordre BREAKEN ne fonctionne pas


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
PRC_2021 @manu35250 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by PRC_2021
8 months, 4 weeks ago.

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