Advertisement
saisri

OB/OS IND

Jul 18th, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. _SECTION_BEGIN("Adaptave Zones O_B & O_S Oscillator");
  2. /*Adaptive Zones OB/OS OSCILLATOR*/
  3. /*Automatically Adjusts the overbought and oversold levels based on past performance*/
  4. /*Interpreted and coded by Anthony Faragasso*/
  5. /*Can be used with PrePackaged indicators,RSI,CCI,STOCHK,STOCHD,MFI,ULTIMATE,*/
  6. /*For ROC add the Close. ex.ROC(C,pds);*/
  7.  
  8. MaxGraph=10;
  9. /*Input */
  10. Lookback=60;
  11. PerCent=95;
  12. Pds =14;
  13.  
  14. /****Dimitri Code***********/
  15. /*14-Day RSI of MACD()*/
  16. //t=14; Replaced with pds= statement
  17. Var=MACD();
  18. Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
  19. Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
  20. Ut=Wilders(Up,Pds);
  21. Dt=Wilders(Dn,Pds);
  22. RSIt=100*(Ut/(Ut+Dt));
  23. /************End Code*************************/
  24.  
  25. /*******Variables******************/
  26.  
  27. A1=RSIt; B2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);
  28. F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);
  29.  
  30.  
  31. Osc=C3; /*insert variable by Identifier*/
  32.  
  33. /*Value of Osc*/
  34. Value1 = Osc;
  35.  
  36. /*Highest AND Lowest Values of Osc during Lookback Period*/
  37. Value2 = HHV(Value1,Lookback);
  38. Value3 = LLV(Value1,Lookback);
  39.  
  40. /*Range of Osc during Lookback Period*/
  41. Value4 = Value2 - Value3;
  42.  
  43. /*Define PerCent of Range to determine OB AND OS levels*/
  44. Value5 = Value4 * (PerCent / 100);
  45.  
  46. /*Calculate OB AND OS levels*/
  47. Value6 = Value3 + Value5;
  48. Value7 = Value2 - Value5;
  49.  
  50. baseline=IIf( Osc < 100 AND Osc > 10 ,50 ,IIf( Osc < 0 ,0,0));
  51.  
  52. Header=WriteIf(Osc==A1," RSI Of MACD",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)",""))))))));
  53.  
  54. Plot(Value1, Header,6,1+4); /*BLUE*/
  55. Plot(Value6," O/B",4,1+4); /*RED -TOP(SELL)*/
  56. Plot(Value7," O/S",5,1+4); /*GREEN-BOT(BUY)*/
  57. Plot(Baseline," Baseline",7,1+4); /* yellow*/
  58. _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement