Set stop loss x trailing y // Code “manuel”

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #162074 quote
    Guibourse
    Participant
    Average

    Bonjour à tous,

    Est-ce qu’il serait possible de trouver une façon de coder en manuel le code suivant

    Set stop ploss x ptrailing y
    

    En l’occurence x = 27 et y = 5. Il ne peut en effet pas “tourner” en réel. J’ai essayé à partir de ce qui a déjà été fourni dans d’autres topics pour reproduire le trailing stop, sans succès.

    Merci beaucoup pour votre aide.

    #166298 quote
    Nicolas
    Keymaster
    Master

    Tu peux essayer avec ce type de trailing stop (“IG style”) pour obtenir un tant soit peu le même fonctionnement que celui d’IG, attention toutefois, les niveaux de prix se recalculent uniquement une seule fois à chaque bougie :

    StopLoss          = 10      //StopLoss size
    TrailingStopStart = 0      //Trailing Stop start at X points in profit
     
    buystoploss = close-StopLoss*pointsize
    sellstoploss = close+StopLoss*pointsize
     
    if not onmarket then
     ibuystoploss=buystoploss
     isellstoploss=sellstoploss
    endif
    if longonmarket then
     //checking and adjusting stoploss
     if close-tradeprice>=trailingstopstart*pointsize then
      ibuystoploss = max(ibuystoploss,high-(stoploss+trailingstopstart)*pointsize)
     endif
     //set the stoploss level
     sell at ibuystoploss stop
    endif
    if shortonmarket then
     //checking and adjusting stoploss
     if tradeprice-close>=trailingstopstart*pointsize then
      isellstoploss = min(isellstoploss,low+(stoploss+trailingstopstart)*pointsize)
     endif
     //set the stoploss level
     exitshort at isellstoploss stop
    endif
    Guibourse, GraHal and icharttop thanked this post
    #213594 quote
    ZeroCafeine
    Participant
    Senior

    Pourquoi le coder en manuel ? Le code ne fonctionne pas Chez IG ?

    Set stop ploss x ptrailing y
    #213602 quote
    GraHal
    Participant
    Master

    1. Set stop ploss x

    2. Réglez l’arrêt de la traînée y

    1. sur ses propres travaux.
    2. sur ses propres œuvres

      Mais 1. et 2. ne fonctionnent pas ensemble, la dernière commande annule tout ce qui se trouve sur la ligne précédente ou sur la même ligne.

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

Set stop loss x trailing y // Code “manuel”


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
Guibourse @guibourse Participant
Summary

This topic contains 3 replies,
has 4 voices, and was last updated by GraHal
2 years, 10 months ago.

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