BE pour un trade Short

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #200972 quote
    overspinoverspin
    Participant
    Junior

    Bonjour,

    j’utilise le code suivant pour mise à BE, il fonctionne parfaitement pour les trades LONG, que faudrait il modifier pour qu’il fonctionne aussi pour les trades Short ?

    d’avance merci

    //Unité pour le BE
    timeframe(15 minute,updateonclose)
    
    startBreakeven = 40 //distance d'activation
    PointsToKeep = 5 //distance au dessus de l'entrée (Long)
     
    //reset 
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
     
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF

     

     

     

    #200977 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Voilà:

    //Unité pour le BE
    timeframe(15 minute,updateonclose)
    
    startBreakeven = 40 //distance d'activation
    PointsToKeep   = 5 //distance au dessus de l'entrée (Long)
     
    //reset 
    IF NOT ONMARKET THEN
       breakevenLevel=0
    ENDIF
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
       breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ELSIF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven*pipsize THEN
       breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    ENDIF
     
    IF breakevenLevel>0 THEN
       SELL      AT breakevenLevel STOP
       EXITSHORT AT breakevenLevel STOP
    ENDIF
    #201031 quote
    NicolasNicolas
    Keymaster
    Legend

    On peut aussi utiliser l’instruction SET STOP BREAKEVEN pour placer ton stoploss au point de breakeven.

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

BE pour un trade Short


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
overspin @overspin Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by NicolasNicolas
4 years, 1 month ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 09/18/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...