sortie d’une position sous condition

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #190175 quote
    finplus
    Participant
    Master

    Bonsoir,

    je souhaiterai avoir une aide pour coder une sortie automatique qui s’effectuerait de la manière suivante : en position longue par exemple, la vente s’effectuerait si le gain de la clôture actuel est inférieur au gain de la clôture précédente et sous réserve que le gain potentiel de la clôture précédente soit (par exemple) supérieure à 5 pips.

    j’ai programmé le petit programme ci-dessous mais la sortie ne correspond pas au programme. Quelqu’un pourrait il m’aider SVP ? Merci et bonne soirée.

    A = 5 * pipsize

    if longonmarket and (tradeprice – close < A) and (tradeprice -close[1] > A) then
    sell 1 contract at market
    endif

    #190176 quote
    GraHal
    Participant
    Master
    if longonmarket and (Close - tradeprice < A) and (Close[1] - tradeprice > A) then
    sell at market
    endif
    #190181 quote
    finplus
    Participant
    Master

    Merci pour cette réponse. Je viens de tester la ligne de code mais les résultats ne sont pas ceux que j’attendais. Je vais essayer de comprendre pourquoi. En effet, je me suis aperçu que le système ne clôturait pas la position ouverte si la plus value latente calculée sur la clôture de la bougie N était inférieure par rapport à la plus-value latente de la bougie N-1. Quelque chose m’échappe alors que la condition de sortie me paraissait simple. Bon dimanche.

    #190187 quote
    GraHal
    Participant
    Master

    On which instrument are you testing the above code?

    To try …

    1
    2
    3
    if longonmarket and (Close tradeprice < A*pipsize) and (Close[1] tradeprice > A*pipsize) then
    sell at market
    endif
    #190188 quote
    JS
    Participant
    Veteran
    A = 5 * PointSize
    
    If LongOnMarket and (Close[1] - TradePrice > A) and (Close - TradePrice < Close[1] - TradePrice) then
    Sell at Market
    EndIf
    
    #190211 quote
    finplus
    Participant
    Master

    Thanks. it seems it works fine now.

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

sortie d’une position sous condition


Trading Général : Analyse Marchés & Discrétionnaire

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by finplus
3 years, 12 months ago.

Topic Details
Forum: Trading Général : Analyse Marchés & Discrétionnaire
Language: French
Started: 03/19/2022
Status: Active
Attachments: No files
Logo Logo
Loading...