.

Momentum Oscillator Histogram AFL - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Momentum Oscillator Histogram AFL

_SECTION_BEGIN("AO"); var1=MA( Avg , 34); var2=MA( Avg,5); diff = var2-var1; Graph0= diff; Graph0Name = "AO"; Graph0Style=2+4; Graph1=Wilders(diff ,5); Graph1Style=4+1; UpBar = diff > Ref(diff,-1); DownBar = diff < Ref(diff,-1); Graph0BarColor=IIf(UpBar, colorGreen, colorRed); SoucerUp = Ref(diff,-2) > Ref(diff,-1) AND Ref(diff,-1) < diff; SoucerDown = Ref(diff,-2) < Ref(diff,-1) AND Ref(diff,-1) > diff; SoucerBuy = SoucerUp AND (diff > 0 AND Ref(diff,-1) > 0 AND Ref(diff,-2) > 0); SoucerSell = SoucerDown AND (diff < 0 AND Ref(diff,-1) < 0 AND Ref(diff,-2) < 0); CrossBuy = diff > 0 AND Ref(diff,-1) < 0; CrossSell = diff < 0 AND Ref(diff,-1) > 0; Buy = SoucerBuy OR CrossBuy; Sell = SoucerSell OR CrossSell; PlotShapes( IIf(SoucerBuy ,shapeDigit1,0) ,colorBlue, 0, 0,-12); PlotShapes( IIf(CrossBuy ,shapeDigit2,0) ,colorBlue, 0, 0,-12); PlotShapes( IIf(SoucerSell ,shapeDigit1,0) ,colorOrange, 0, 0,12); PlotShapes( IIf(CrossSell ,shapeDigit2,0) ,colorOrange, 0, 0,12); LatestLowPeak = IIf(diff < 0, Ref(LowestSince(CrossSell, diff, 1), -1), 0); TwinPeaksBuy = diff < 0 AND Ref(DownBar, -1) AND UpBar AND Ref(diff,-1) > LatestLowPeak; //Move latest lowest peak to the new one created now: LatestLowPeak = IIf(TwinPeaksBuy, Ref(diff,-1), LatestLowPeak); PlotShapes( IIf(TwinPeaksBuy ,shapeDigit3,0) ,colorBlue, 0, 0,12); LatestHighPeak = IIf(diff > 0, Ref(HighestSince(CrossBuy, diff, 1), -1), 0); TwinPeaksSell = diff > 0 AND Ref(UpBar, -1) AND downBar AND Ref(diff,-1) < LatestHighPeak ; LatestHighPeak = IIf(TwinPeaksSell, Ref(diff,-1), LatestHighPeak ); PlotShapes( IIf(TwinPeaksSell ,shapeDigit3,0) ,colorOrange, 0, 0,-12); SuperAOBuy = Ref(DownBar, -3) AND Ref(UpBar, -2) AND Ref(UpBar, -1) AND UpBar; SuperAOSell = Ref(UpBar, -3) AND Ref(DownBar, -2) AND Ref(DownBar, -1) AND DownBar; PlotShapes( IIf(SuperAOBuy ,shapeDigit4,0) ,colorBlue, 0, 0,12); PlotShapes( IIf(SuperAOSell ,shapeDigit4,0) ,colorOrange, 0, 0,-12); /* Super AO Blue Light Special If you have a Super AO buy signal and it is not hit and the AO does not change color, and the next bar has a lower high then you will move your buy stop down to one tick above that high. You will continue to do this until the signal is hit or the AO changes color */ //Commentary: WriteIf(SuperAOBuy,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ SAO Add on)", WriteIf(SuperAOSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- SAO Add on)", WriteIf(SoucerBuy ,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ Soucer)", WriteIf(SoucerSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- Soucer)", WriteIf(CrossBuy ,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ Zero Cross)", WriteIf(CrossSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- Zero Cross)", WriteIf(TwinPeaksBuy ,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ Twin Peaks)", WriteIf(TwinPeaksSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- Twin Peaks)","")))))))); _SECTION_END();
Previous Post Next Post