Forums › ProRealTime forum Italiano › Supporto ProBuilder › Blackflag FTS indicator › Reply To: Blackflag FTS indicator
03/27/2025 at 10:15 AM
#245333
Ecco
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
//------------------------------------------------// //PRC_BlackFlags FTS //version = 0 //27.03.2025 //Iván González @ www.prorealcode.com //Sharing ProRealTime knowledge //------------------------------------------------// // Inputs //------------------------------------------------// trailType=1 //modified=1 unmodified=0 atrPeriod=28 atrFactor=5 ShowFibEntries=0 //------------------------------------------------// // True Range Calculations //------------------------------------------------// HiLo=min(high-low,1.5*average[atrPeriod](high-low)) if low<=high[1] then Href=high-close[1] else Href=(high-close[1])-0.5*(low-high[1]) endif if high>=low[1] then Lref=close[1]-low else Lref=(close[1]-low)-0.5*(low[1]-high) endif if trailType=1 then trueRange=max(HiLo,max(Href,Lref)) else trueRange=max(high-low,max(abs(high-close[1]),abs(low-close[1]))) endif //------------------------------------------------// // Trade Logic //------------------------------------------------// wildMa=WilderAverage[atrPeriod](trueRange) iloss=atrFactor*wildMa up=close-iloss dn=close+iloss trendUp=up trendDown=dn trend=1 if close[1]>trendUp[1] then TrendUp=max(Up,TrendUp[1]) else TrendUp=Up endif if close[1]<trendDown[1] then trendDown=min(Dn,trendDown[1]) else trendDown=Dn endif if close>trendDown[1] then Trend=1 elsif close<TrendUp[1] then Trend=-1 else Trend=Trend[1] endif if trend=1 then trail=TrendUp r=0 g=255 b=0 rex=0 gex=230 bex=118 else trail=TrendDown r=255 g=0 b=0 rex=225 gex=64 bex=251 endif ex=0 if trend crosses over 0 then ex=high elsif trend crosses under 0 then ex=low elsif trend=1 then ex=max(ex[1],high) elsif trend=-1 then ex=min(ex[1],low) else ex=ex[1] endif //------------------------------------------------// // Fibonacci levels //------------------------------------------------// fib1Level=61.8 fib2Level=78.6 fib3Level=88.6 f1=ex+(trail-ex)*fib1Level/100 f2=ex+(trail-ex)*fib2Level/100 f3=ex+(trail-ex)*fib3Level/100 l100=trail colorbetween(f1,f2,r,g,b,90) colorbetween(f3,f2,r,g,b,45) colorbetween(f3,l100,r,g,b,23) //------------------------------------------------// // Signals //------------------------------------------------// atr=averagetruerange[14](close) if ShowFibEntries=1 then if trend=1 and close crosses under f3[1] then drawtext("▲",barindex,low-2*atr)coloured("orange") elsif trend=1 and close crosses under f2[1] then drawtext("▲",barindex,low-1.5*atr)coloured("orange") elsif trend=1 and close crosses under f1[1] then drawtext("▲",barindex,low-1*atr)coloured("orange") elsif trend=-1 and close crosses over f3[1] then drawtext("▼",barindex,high+2*atr)coloured("purple") elsif trend=-1 and close crosses over f2[1] then drawtext("▼",barindex,high+1.5*atr)coloured("purple") elsif trend=-1 and close crosses over f1[1] then drawtext("▼",barindex,high+1*atr)coloured("purple") endif endif //------------------------------------------------// return f1 as "Fib1"style(line,1), f2 as "Fib2"style(line,1),f3 as "Fib3"style(line,1),l100 as "L100"style(line,1),trail as "trailing stop" coloured(r,g,b)style(line,2),ex as "extremun" coloured(rex,gex,bex)style(point,2) |