Take profit changent

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #173739 quote
    Lebovvski_23
    Participant
    New

    Bonjour,

    je code un algorithme et je rencontre un problème quand je place mes TP.

    j’ai plusieurs conditions d’achats, et quand une nouvelle position est prise, alors mes TP sur les positions déjà en cours sont modifiés pour le nouveau TP de la position qui viens d’être prise.

    Comment corriger ça, si possible ?

    (je sais pas insérer du code alors le voici en texte avec mon problème expliqué en rouge)

     

    if close<0.50*highest[YY](high) and COUNTOFLONGSHARES<=0 and (barindex)>YY then
    BUY NBPos CONTRACTS AT MARKET
    set target pprofit 50
    endif

    Ici je prends une position longue (L1) avec TP 50 points

    if close<0.38*highest[YY](high) and COUNTOFLONGSHARES<=1 and (barindex)>YY then
    BUY 2*NBPos CONTRACTS AT MARKET
    set target pprofit 100
    endif

    Ici je prends une position longue (L2) avec TP 100 points, et ça modifie le TP de L1 qui passe de 50 à 100pts…

    Merci de votre aide,

    Cordialement.

    #173750 quote
    Nicolas
    Keymaster
    Master

    C’est un phénomène normal, l’instruction SET TARGET PPROFIT affectera l’ensemble des ordres ouverts avec la valeur indiquée.

    Dans ce cas de figure (objectifs différents selon le point d’entrée), je suggère de faire des sorties partielles à l’aide d’ordres conditionnels LIMIT :

    SELL x contract at y LIMIT

    ou x est la quantité de contrats à fermer au prix y

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

Take profit changent


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

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

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