Position Supertrend haussier et baissier

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

    Bonjour,

    je n’ai pas pu insérer le code donc je le mets ci-dessous.

    Supertrend Extended

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    //PRC_SuperTrend Extended | indicator
    //31.10.2017
    //Sharing ProRealTime knowledge
    // — settings
    //multiplier=2.236
    //period=66
    //type=1 //1 = use ATR , 2 = Use standard deviation , 3 = Use standard error
    //midperiod=10
    // — end of settings
    type=max(1,type)
    if type=1 then
    moy=averagetruerange[period](close)
    elsif type=2 then
    moy=std[period](close)
    elsif type=3 then
    moy=ste[period](close)
    endif
    price=(highest[midperiod](high)+lowest[midperiod](low))/2
    up=price+multiplier*moy
    dn=pricemultiplier*moy
    once trend=1
    if close>up[1] then
    trend=1
    elsif close<dn[1] then
    trend=1
    endif
    if trend<0 and trend[1]>0 then
    flag=1
    else
    flag=0
    endif
    if trend>0 and trend[1]<0 then
    flagh=1
    else
    flagh=0
    endif
    if trend>0 and dn<dn[1] then
    dn=dn[1]
    endif
    if trend<0 and up>up[1] then
    up=up[1]
    endif
    if flag=1 then
    up=price+multiplier*moy
    endif
    if flagh=1 then
    dn=pricemultiplier*moy
    endif
    if trend=1 then
    mysupertrend=dn
    offset=moy
    color1=0
    color2=191
    color3=255
    else
    mysupertrend=up
    offset=moy
    color1=255
    color2=69
    color3=0
    endif
    drawcandle(mysupertrend,mysupertrend+offset,mysupertrend,mysupertrend+offset) coloured(color1,color2,color3,50)bordercolor(100,100,100,0)
    if trend=1 and trend[1]<>1 then
    drawarrowup(barindex,mysupertrend) coloured(color1,color2,color3)
    endif
    if trend=1 and trend[1]<>1 then
    drawarrowdown(barindex,mysupertrend) coloured(color1,color2,color3)
    endif
    return mysupertrend coloured (color1,color2,color3) as “SuperTrend Extended 1”, mysupertrend+offset coloured (color1,color2,color3) as “SuperTrend Extended 2”

     

     

    Dans ce code, je souhaiterai savoir comment indiquer dans mon programme automatique s’il est haussier ou baissier.  Je les recopiais et indiquer pour entrer long l’indication suivante = Trend = 1 et pour entrer short Trend = -1. Sauf que je me suis aperçu en probacktest que des positions longues étaient prises lorsque trend = -1 (et vice-versa).

    Une petite aide serait appréciée.

    Merci et bon dimanche.

    #209957 quote
    finplus
    Participant
    Master

    Rebonjour,

    merci de ne pas tenir compte de ma demande. Je pense avoir trouvé la cause de mon problème (j’utilise dans un autre code le paramètre “Trend”).

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

Position Supertrend haussier et baissier


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by finplus
3 years ago.

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