Sortie TP+1 avec set target profit

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #116882 quote
    Nicolas Le Thuaut
    Participant
    Junior

    Bonjour,

    Je n’arrive pas à coder correctement le comportement suivant:

    Pour une position à l’achat

    si totalprice casse à la baisse une moyenne mobile adaptative alors tenter une sortir en TP+1

    Voici mon code actuel:

    //Kama
    Period = 9
    FastPeriod = 2
    SlowPeriod = 30
    Prix=totalprice
    
    Fastest = 2 / (FastPeriod+1)
    Slowest = 2 / (SlowPeriod+1)
    if barindex < Period+1 then
    Kama=close
    else
    Num = abs(Prix-Prix[Period])
    Den = summation[Period](abs(Prix-Prix[1]))
    ER= Num / Den
    Alpha = square(ER *(Fastest - Slowest)+ Slowest)
    Kama= (Alpha * Prix) + ((1 - Alpha)* Kama[1])
    endif
    
    //Strategie-------------------------
    
    //Entrée long
    
    SignalEntree1=totalprice > Kama and rsi[14](close)>rsi[14](close)[1]
    
    if not onmarket and SignalEntree1 then
    sLevel=max(lowest[BarreStop](low),BBinf20)
    buy n contract at BBsup20 limit
    
    endif
    
    //Sortie en perte
    if close<tradeprice and close crosses under BBinf20 then
    sell at market
    endif
    
    //Sortie TP+1
    if totalprice crosses under kama then
    set target pprofit 1
    endif

    Avec ce code il s’avère que le take profit est parfois placé alors qu’il ne devrait pas se déclencher. Je n’ai pas d’autre instruction take profit dans mon code.

    En pièce jointe le backtest

    US_Tech_100_Cash__1€____5_minutes___9-038_0___0_25_____15_janv__2020_14_49_03.png US_Tech_100_Cash__1€____5_minutes___9-038_0___0_25_____15_janv__2020_14_49_03.png
    #116909 quote
    Nicolas
    Keymaster
    Master

    Il faudrait commencer par vérifier que la Kama calculé dans le code de la stratégie et bien la même que celle affichée à l’écran, avec un GRAPHONPRICE par exemple.

    #116928 quote
    Nicolas Le Thuaut
    Participant
    Junior

    Bonsoir Nicolas,

    La Kama correspond bien à ce qui est affiché à l’écran. Ci-joint la capture d’écran avec l’instruction graphonprice (la Kama de l’affichage est en pointillés et celle du code en trait plein).

    Ce qui est assez étrange c’est que ce phénomène ne se produit pas systématiquement. Parfois le TP+1 n’est pas déclenché.

    US_Tech_100_Cash__1€____5_minutes___9-034_8___0_22_____15_janv__2020_21_10_10.png US_Tech_100_Cash__1€____5_minutes___9-034_8___0_22_____15_janv__2020_21_10_10.png
    #116992 quote
    Nicolas Le Thuaut
    Participant
    Junior
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Sortie TP+1 avec set target profit


ProOrder : Trading Automatique & Backtests

New Reply
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Nicolas Le Thuaut
6 years, 1 month ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 01/15/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...