Advertisement
saisri

pivot levels

Aug 7th, 2012
949
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. _SECTION_BEGIN("Price");
  2. SetChartOptions(0,chartShowArrows|chartShowDates);
  3. _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
  4. Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
  5. _SECTION_END();
  6. _SECTION_BEGIN("Background Color");
  7. BKswitch = ParamToggle("Background Color","On,Off");
  8.  
  9. OUTcolor = ParamColor("Outer Panel Color",colorLightBlue);
  10. INUPcolor = ParamColor("Inner Panel Upper",colorPink);
  11. INDNcolor = ParamColor("Inner Panel Lower",colorWhite);
  12. TitleColor = ParamColor("Title Color ",colorBlack);
  13.  
  14. if (NOT BKswitch)
  15. {
  16. SetChartBkColor(OUTcolor); // color of outer border
  17. SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
  18. }
  19. _SECTION_END();
  20.  
  21.  
  22.  
  23.  
  24.  
  25. _SECTION_BEGIN("KPL Swing1");
  26. //Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at http://www.vfmdirect.com/kplswing
  27. //Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
  28. no=Param( "Swing", 10, 1, 55 );
  29. tsl_col=ParamColor( "Color", colorCycle );
  30.  
  31. res=HHV(H,no);
  32. sup=LLV(L,no);
  33. avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
  34. avn=ValueWhen(avd!=0,avd,1);
  35. tsl=IIf(avn==1,sup,res);
  36.  
  37. Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea
  38.  
  39. Buy=Cross(C,tsl);
  40. Sell=Cross(tsl,C);
  41. shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
  42. PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
  43. _SECTION_END();
  44.  
  45. _SECTION_BEGIN("LEVELS");
  46. PO=TimeFrameGetPrice( "O", inDaily, -1 );
  47. PL=TimeFrameGetPrice( "L", inDaily, -1 );
  48. PH=TimeFrameGetPrice( "H", inDaily, -1 );
  49. PC=TimeFrameGetPrice( "C", inDaily, -1 );
  50. TO= TimeFrameGetPrice( "O", inDaily, 0 );
  51. TH= TimeFrameGetPrice( "H", inDaily, 0 );
  52. TL= TimeFrameGetPrice( "L", inDaily, 0 );
  53. TC= TimeFrameGetPrice( "C", inDaily, 0 );
  54. PC1= TimeFrameGetPrice( "C", inDaily, -2 );
  55.  
  56. P=((PH+PL+PC)/3);
  57. R1=((2*P)-PL);
  58. S1=((2*P)-PH);
  59. R2=((P-S1)+R1);
  60. S2=(P-(R1-S1));
  61. R3=PH+(2*(P-PL));
  62. S3=PL-(2*(PH-P));
  63.  
  64. R=TH-TL;
  65. PP=(TH+TL+TO+TO)/4;
  66. RR1=PP+(R*0.38);
  67. RR2=PP+(R*0.62);
  68. SS1=PP-(R*0.38);
  69. SS2=PP-(R*0.62);
  70.  
  71. PPP=(TH+TL+TO+TO)/4;
  72. RRR1=((2*PPP)-TL);
  73. SSS1=((2*PPP)-TH);
  74. RRR2=((PPP-SSS1)+RRR1);
  75. SSS2=(PPP-(RRR1-SSS1));
  76.  
  77. Pchange=PC-PC1;
  78. PPerChange=(Pchange/PC1)*100;
  79. Tchange=TC-PC;
  80. TPerChange=(Tchange/TC)*100;
  81.  
  82. Title=Name()+
  83. "\nPrevious - O :-"+PO+" H :-"+PH+" L :-"+PL+" C :-"+PC+" Change:- "+Pchange+" %ge:- "+WriteVal(PPerChange,1.2)+
  84. "\nTodays - O :-"+TO+" H :-"+TH+" L :-"+TL+" C :-"+TC+" Change:- "+Tchange+" %ge:- "+WriteVal(TPerChange,1.2)+
  85. "\n"+
  86. "\n"+
  87. "\nLevels"+
  88. "\nEOD Pivot :-"+WriteVal(P,1.2)+
  89. "\nS-1 :-"+WriteVal(S1,1.2)+" - R-1 :-"+WriteVal(R1,1.2)+
  90. "\nS-2 :-"+WriteVal(S2,1.2)+" - R-2 :-"+WriteVal(R2,1.2)+
  91. "\nS-3 :-"+WriteVal(S3,1.2)+" - R-3 :-"+WriteVal(R3,1.2)+
  92. "\n"+
  93. "\nIntraday Pivot :-"+WriteVal(PP,1.2)+
  94. "\nS-1 :-"+WriteVal(SSS1,1.2)+" - R-1 :-"+WriteVal(RRR1,1.2)+
  95. "\nS-2 :-"+WriteVal(SSS2,1.2)+" - R-2 :-"+WriteVal(RRR2,1.2)+
  96. "\n"+
  97. "\nIntraday Retracement Levels"+
  98. "\nS-1 :-"+WriteVal(SS1,1.2)+" - R-1:-"+WriteVal(RR1,1.2)+
  99. "\nS-2 :-"+WriteVal(SS2,1.2)+" - R-2:-"+WriteVal(RR2,1.2);
  100. _SECTION_END();
  101. //------------------------------------------------------------------------------
  102.  
  103.  
  104. _SECTION_BEGIN("Moving Average");
  105.  
  106. x=Param("EMA 1",20,1,200,1);
  107. y=Param("EMA 2", 50,1,200,1);
  108. z=Param("EMA 3",100,1,200,1);
  109. zz=Param("EMA 4",200,1,200,1);
  110. EMA20= EMA(C,x);
  111. EMA50=EMA(C,y);
  112. EMA100= EMA(C,z);
  113. EMA200=EMA(C,zz);
  114.  
  115. SUT=EMA(C,5)>EMA20;
  116. SDT=EMA20>EMA(C,5);
  117. mut= EMA20>EMA50;
  118. mdt=EMA20<EMA50;
  119. _SECTION_END();
  120. _SECTION_BEGIN("Mid Term Price Trend");
  121.  
  122.  
  123. MPT = IIf( mut, colorGreen, IIf( mdt, colorRed, colorYellow));
  124. Plot( 3, "", MPT, styleArea|styleOwnScale|styleNoLabel, 0, 100);
  125.  
  126. _SECTION_END();
  127.  
  128. _SECTION_BEGIN("Short Term Price Trend");
  129.  
  130. SPT = IIf( EMA(C,5)>EMA20, colorBrightGreen, IIf( EMA20>EMA(C,5), colorPink, colorYellow));
  131. Plot( 6, "", SPT, styleArea|styleOwnScale|styleNoLabel, 0, 100);
  132.  
  133. _SECTION_END();
  134.  
  135. _SECTION_BEGIN("Magnified Market Price");
  136. FS=Param("Font Size",30,30,100,1);
  137. GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
  138. GfxSetBkMode( colorGreen );
  139. GfxSetTextColor( ParamColor("Color",colorGreen) );
  140. Hor=Param("Horizontal Position",350,800,800,800);
  141. Ver=Param("Vertical Position",50,27,27,27);
  142. GfxTextOut(""+C,Hor , Ver );
  143. YC=TimeFrameGetPrice("C",inDaily,-1);
  144. DD=Prec(C-YC,2);
  145. xx=Prec((DD/YC)*100,2);
  146. GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
  147. GfxSetBkMode( colorGreen );
  148. GfxSetTextColor(ParamColor("Color",colorGreen) );
  149. GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
  150. _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement