Hi -- Does anyone have any experience with this indicator? Please PM me if you're willing to discuss: I've some questions about the way it "acts." Thanks!
This was another modified variant of it in another platform Fractal Adaptive Moving Average y:=Input("sample time periods",1,20,8); y2:=2*y; n1:=(HHV(H,y)-LLV(L,y))/y; n2:=Ref((HHV(H,y)-LLV(L,y))/y,-y); n3:=(HHV(H,y2)-LLV(L,y2))/y2; x:=(Log(n1+n2)-Log(n3))/Log(2); xt:=Exp(-4.6*(x-1)); x1:=If(xt<0.1,0.1,If(xt>1,1,xt)); x2:=1-x1; If(Cum(1)=y2, (MP() * x1) + (Ref(MP(),-1) * x2), (MP() * x1) + (PREV * x2))
this may or may not work in tradestation { The IntrabarOrderGeneration attribute is set to false in this strategy because strategy calculations depend on end-of-bar prices. } [IntrabarOrderGeneration = false] inputs: Price( 0.5 * ( H + L ) ), N( 16 ), NumDevsUp( 2 ), NumDevsDn( 2 ), TrailAmt( 0.5 ), BandColor( Yellow ), DataType( 1 ) ; { pass in 1 if you are working with the entire population, and 2 if you are working with a sample and want the standard deviation for the population } variables: Divisor( 0 ), Mean( 0 ), SumSqr( 0 ), AvgDiff( 0 ), FracStandardDev( 0 ), LowerBand( 0 ), UpperBand( 0 ), TL_ID1( -1 ), TL_ID2( -1 ) ; // AvgDiff = 0 ; Divisor = Iff( DataType = 1, N, N - 1 ) ; if Divisor > 0 then begin Mean = AdaptMovAvg_Fractal( Price, N ) ; SumSqr = 0 ; for Value1 = 0 to N - 1 begin SumSqr = SumSqr + Square( Price[Value1] - Mean ) ; end ; AvgDiff = SumSqr / Divisor ; end ; if AvgDiff > 0 then FracStandardDev = SquareRoot( AvgDiff ) else FracStandardDev = 0 ; LowerBand = Mean - NumDevsDn * FracStandardDev ; UpperBand = Mean + NumDevsUp * FracStandardDev ; if CurrentBar > 1 and Low crosses over LowerBand then { CB > 1 check used to avoid spurious cross confirmation at CB = 1 } Buy ( "BBandLE" ) next bar LowerBand stop ; if CurrentBar > 1 and High crosses under UpperBand then SellShort next bar at UpperBand Stop ; { ie, don't buy if next bar completely below current LowerBand, but wait for next crossing condition - an example of a non-persistent setup with an indefinite stop/limit trigger } SetStopShare ; SetDollarTrailing( TrailAmt ) ; SetProfitTarget ( 3 * TrailAmt ) ; { Use trendlines to "plot" the bands on the chart } TL_ID1 = TL_New( Date[1], Time[1], UpperBand[1], Date, Time, UpperBand ) ; TL_SetColor( TL_ID1, BandColor ) ; TL_ID2 = TL_New( Date[1], Time[1], LowerBand[1], Date, Time, LowerBand ) ; TL_SetColor( TL_ID2, BandColor ) ;
Hey, thanks. I do have the code. I'm puzzled by its tendancies, that's all. For example, the way it can be smoother at some smaller lengths than some larger ones. I say "some" because this is not consistently true across all values -- i.e., 10 may be smoother than 14, but 11 considerably jumpier than 12. I'm wondering if anyone out there might be able to explain the "why" of this phenomenon.
Ah! Thank you! Your clue just prompted me to reinspect the actual formula. The period "n" must be an even number. Thanks again!