Multi TARGET PROFIT

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

    Bonjour à toute la communauté,

    J’utilise actuellement les instructions “SET STOP loss” et “SET TARGET PROFIT” pour placer mon SL et TP de façon dynamique :

    IF ConditionsLONG THEN
    BUY PositionSize CONTRACTS AT MARKET
    SET STOP loss customVar
    SET TARGET PROFIT TPfactor
    ENDIF
    
    IF ConditionsSHORT THEN
    SELLSHORT PositionSize CONTRACTS AT MARKET
    SET STOP loss customVar
    SET TARGET PROFIT TPfactor
    ENDIF

    Sur une position où PositionSize  = 2 je voudrais à présent placer un 2ème TP = customVar.

    En d’autres termes, je voudrais placer deux TP différents :

    • 1er contrat clôturé à 1 x SL pour sécuriser
    • 2e contrat clôturé à 2 x SL (ou éventuellement en trailing stop)

    Puisque les instructions “Set Stop” et “Set Target” ne peuvent être appelés qu’une seule fois par sens (long/short), quelle est la meilleure manière de structurer un ordre multi-TP, si c’est possible techniquement ?

    Merci pour votre aide !

    #248786 quote
    robertogozzi
    Moderator
    Master

    Vous devez utiliser SET TARGET PROFIT pour la dernière cible, la plus éloignée, et vérifier de combien le prix dépasse la première CIBLE, la plus proche, et sortir AT MARKET avec la moitié de votre position):

    IF ConditionsLONG THEN
       BUY PositionSize CONTRACTS AT MARKET
       SET STOP loss customVar
       SET TARGET PROFIT TPfactor*2
    ENDIF
     
    IF ConditionsSHORT THEN
       SELLSHORT PositionSize CONTRACTS AT MARKET
       SET STOP loss customVar
       SET TARGET PROFIT TPfactor*2
    ENDIF
    
    IF abs(CountOfPosition) < PositionSize THEN
       IF LongOnMarket AND (close - TradePrice) >= TPfactor THEN
          SELL (PositionSize / 2) Contract at Market
       ELSIF ShortOnMarket AND (TradePrice - close) >= TPfactor THEN
          EXITSHORT (PositionSize / 2) Contract at Market
       ENDIF
    ENDIF
    Epsilon and Iván González thanked this post
    #248787 quote
    Epsilon
    Participant
    New

    Super clair, merci beaucoup !

    #248811 quote
    GraHal
    Participant
    Master

    Lien vers le code ci-dessus ajouté en tant que journal 394 ici…

    Snippet Link Library

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

Multi TARGET PROFIT


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Epsilon @epsilon Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by GraHal
7 months, 3 weeks ago.

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