Disparity Index & Adaptive Zones for Amibroker (AFL)
morgen about 16 years ago Amibroker (AFL)
See in formula “SECTION OSC”, if you want to create other Oscillators & Adaptive Zones!
Indicator / Formula
Copy & Paste Friendly
/*Adaptive Zones OB/OS OSCILLATOR*/
/*Automatically Adjusts the overbought and oversold levels based on past performance*/
/*Interpreted and coded by Anthony Faragasso*/
/*Can be used with PrePackaged indicators,RSI,CCI,STOCHK,STOCHD,MFI,ULTIMATE,*/
/*For ROC add the Close. ex.ROC(C,pds);*/
MaxGraph=10;
/*Input */
Lookback=50;
PerCent=100;
Pds =14;
/****Dimitri Code***********/
/*14-Day RSI of MACD()*/
//t=14; Replaced with pds= statement
Var=MACD();
Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
Ut=Wilders(Up,Pds);
Dt=Wilders(Dn,Pds);
RSIt=100*(Ut/(Ut+Dt));
/************End Code*************************/
/*******Variables******************/
A1=RSIt; B2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);
F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);
//DISPARITY INDEX
dix=((Close - EMA(Close, 10)) / EMA(Close, 10)) * 100;
//Plot(dix,"",colorCustom12);
Plot(0,"",colorBrown,styleLine);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//SECTION OSC
//You can create here other Adaptive Zones OB/OS Oscillator Charts with up "Variables" (ex.: Osc=F6 etc.)
Osc=dix; /*insert variable by Identifier*/
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
/*Value of Osc*/
Value1 = Osc;
/*Highest AND Lowest Values of Osc during Lookback Period*/
Value2 = HHV(Value1,Lookback);
Value3 = LLV(Value1,Lookback);
/*Range of Osc during Lookback Period*/
Value4 = Value2 - Value3;
/*Define PerCent of Range to determine OB AND OS levels*/
Value5 = Value4 * (PerCent / 100);
/*Calculate OB AND OS levels*/
Value6 = Value3 + Value5;
Value7 = Value2 - Value5;
baseline=IIf( Osc < 100 AND Osc > 10 ,0 ,IIf( Osc < 0 ,0,0));
Header=WriteIf(Osc==A1," RSI Of MACD",WriteIf(osc==dix,"DIX",WriteIf(Osc==b2," RSI",WriteIf(Osc==C3," CCI",WriteIf(Osc==D4,"StochK",WriteIf(Osc==E5,"StochD",WriteIf(Osc==F6," MONEY FLOW INDEX",WriteIf(Osc==G7," Ultimate",WriteIf(Osc==H8," ROC(Close)","")))))))));
Plot(Value1, Header,6,1+4); /*BLUE*/
Plot(Value6," O/B",4,1+4); /*RED -TOP(SELL)*/
Plot(Value7," O/S",colorLime,1+4); /*GREEN-BOT(BUY)*/
//Plot(Baseline," Baseline",colorBrown,1+4); 0 comments
Leave Comment
Please login here to leave a comment.