Condition additionnelle PRCTrend
- This topic has 1 reply, 2 voices, and was last updated 4 years ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
Similar topics:
Forums › ProRealTime forum Français › Support ProBuilder › Condition additionnelle PRCTrend
Suite à une question posée sur la page de l’indicateur ASCTrend dont le code suit, je vous expose mon problème : j’aimerais trouver comment ajouter une condition à l’apparition des flèches par rapport à un autre indicateur. Par exemple : afficher les flèches qui montent uniquement si le close est supérieur à une moyenne mobile et inversement.
Nicolas m’avait déjà répondu que ça s’annonce en effet compliqué dans la mesure où cette version du code “trace dans le passé depuis la barre courante, plutôt qu’en lisant l’historique au chargement”.
Merci à tous !
|
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
//PRC_ASCTrend | indicator //13.01.2021 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //converted from MT4 version // --- settings RISK=3 CountBars=300 // --- end of settings value10=3+RISK*2 x1=67+RISK x2=33-RISK value11=value10 shift=CountBars-11-1 if islastbarupdate and barindex>CountBars then while(shift>=0) do Counter=shift iRange=0.0 AvgRange=0.0 for Counter=shift to shift+9 do AvgRange=AvgRange+Abs(High[Counter]-Low[Counter]) next iRange=AvgRange/10 Counter=shift TrueCount=0 while (Counter<shift+9 and TrueCount<1) do if (Abs(Open[Counter]-Close[Counter+1])>=iRange*2.0) then TrueCount=TrueCount+1 endif Counter=Counter+1 wend if (TrueCount>=1) then MRO1=Counter else MRO1=-1 endif Counter=shift TrueCount=0 while (Counter<shift+6 and TrueCount<1) do if (Abs(Close[Counter+3]-Close[Counter])>=iRange*4.6) then TrueCount=TrueCount+1 endif Counter=Counter+1 wend if (TrueCount>=1) then MRO2=Counter else MRO2=-1 endif if (MRO1>-1) then value11=3 else value11=value10 endif if (MRO2>-1) then value11=4 else value11=value10 endif value2=100-Abs(Williams[value11](close)[shift]) // PercentR(value11=9) $Tablevalue2[shift]=value2 $val1[shift]=0 $val2[shift]=0 value3=0 if (value2<x2) then i1=1 while ($Tablevalue2[shift+i1]>=x2 and $Tablevalue2[shift+i1]<=x1) do i1=i1+1 wend if ($Tablevalue2[shift+i1]>x1) then value3=High[shift]+iRange*0.5 if (shift = 1 and flagval1=0) then flagval1=1 flagval2=0 endif $val1[shift]=value3 drawarrowdown(barindex[shift],$val1[shift]) coloured(255,0,255) endif endif if (value2>x1) then i1=1 while ($Tablevalue2[shift+i1]>=x2 and $Tablevalue2[shift+i1]<=x1) do i1=i1+1 wend if ($Tablevalue2[shift+i1]<x2) then value3=Low[shift]-iRange*0.5 if (shift = 1 and flagval2=0) then flagval2=1 flagval1=0 endif $val2[shift]=value3 drawarrowup(barindex[shift],$val2[shift]) coloured(0,255,255) endif endif shift=shift-1 wend endif return |
Ci-dessous la version du code sans tableaux de données et qui utilise le temps réel pour s’afficher (version traditionnelle) :
|
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 77 78 79 80 81 82 83 84 85 86 87 |
// --- settings //RISK=3 // --- end of settings value10=3+RISK*2 x1=67+RISK x2=33-RISK value11=value10 shift=0//CountBars-11-1 buysig=0 sellsig = 0 Counter=shift iRange=0.0 AvgRange=0.0 for Counter=shift to shift+9 do AvgRange=AvgRange+Abs(High[Counter]-Low[Counter]) next iRange=AvgRange/10 Counter=shift TrueCount=0 while (Counter<shift+9 and TrueCount<1) do if (Abs(Open[Counter]-Close[Counter+1])>=iRange*2.0) then TrueCount=TrueCount+1 endif Counter=Counter+1 wend if (TrueCount>=1) then MRO1=Counter else MRO1=-1 endif Counter=shift TrueCount=0 while (Counter<shift+6 and TrueCount<1) do if (Abs(Close[Counter+3]-Close[Counter])>=iRange*4.6) then TrueCount=TrueCount+1 endif Counter=Counter+1 wend if (TrueCount>=1) then MRO2=Counter else MRO2=-1 endif if (MRO1>-1) then value11=3 else value11=value10 endif if (MRO2>-1) then value11=4 else value11=value10 endif value2=100-Abs(Williams[value11](close)[shift]) // PercentR(value11=9) $Tablevalue2[shift]=value2 $val1[shift]=0 $val2[shift]=0 value3=0 atr=AverageTrueRange[14](close) if (value2<x2) then //signals if value2[1]>x2[1] and lastsig>=0 then sellsig = 1 lastsig = -1 drawarrowup(barindex,low-atr/2) coloured(0,255,0) endif endif if (value2>x1) then //signals if value2[1]<x1[1] and lastsig<=0 then buysig = 1 lastsig = 1 drawarrowdown(barindex,high+atr/2) coloured(255,0,0) endif endif return buysig coloured(0,255,0) style(histogram),sellsig coloured(255,0,0) style(histogram) |
Tu pourras donc y ajouter toutes les conditions que tu souhaites.
Find exclusive trading pro-tools on 