Advertisement
saisri

heiken+rj signals+ levels

Aug 13th, 2012
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.69 KB | None | 0 0
  1. _SECTION_BEGIN("Heiken Ashi Smoothed");
  2. SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorBlack ));
  3. SetChartOptions(0,chartShowArrows|chartShowDates);
  4. GraphXSpace=5;
  5. p=Param("Period",6,2,30,1);
  6. Om=MA(O,p);
  7. hm=MA(H,p);
  8. lm=MA(L,p);
  9. Cm=MA(C,p);
  10. HACLOSE=(Om+Hm+Lm+Cm)/4;
  11. HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
  12. HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
  13. HaLow = Min( Lm, Min( HaClose, HaOpen ) );
  14. PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
  15. _SECTION_END();
  16.  
  17.  
  18. _SECTION_BEGIN("Background Color");
  19. BKswitch = ParamToggle("Background Color","On,Off");
  20.  
  21. OUTcolor = ParamColor("Outer Panel Color",colorBlack);
  22. INUPcolor = ParamColor("Inner Panel Upper",colorPink);
  23. INDNcolor = ParamColor("Inner Panel Lower",colorBlack);
  24. TitleColor = ParamColor("Title Color ",colorBlack);
  25.  
  26. if (NOT BKswitch)
  27. {
  28. SetChartBkColor(OUTcolor); // color of outer border
  29. SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
  30. }
  31. _SECTION_END();
  32.  
  33.  
  34. _SECTION_BEGIN("ERO ATR BUY SELL");
  35.  
  36. ero = Param("ATR multiple", 2.8, 0.5, 10, 0.1 )*Param("ATR period", 10, 3, 50 );
  37. ero_col=ParamColor( "Color", colorCycle );
  38.  
  39. r=HHV(H,ero);
  40. s=LLV(L,ero);
  41. ab=IIf(H>Ref(r,-1),1,IIf(L<Ref(s,-1),-1,0));
  42. ac=ValueWhen(ab!=0,ab,1);
  43. sl=IIf(ac==1,s,r);
  44.  
  45. Plot(sl, _DEFAULT_NAME(), ero_col, styleStaircase); // or styleaArea
  46.  
  47. Buy=Cross(H,sl);
  48. Sell=Cross(sl,L);
  49. PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
  50. PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
  51. PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
  52. PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
  53. PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
  54. PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
  55. _SECTION_END();
  56.  
  57. _SECTION_BEGIN("Moving Average");
  58.  
  59. x=Param("EMA 1",20,1,200,1);
  60. y=Param("EMA 2", 50,1,200,1);
  61. z=Param("EMA 3",100,1,200,1);
  62. zz=Param("EMA 4",200,1,200,1);
  63. EMA20= EMA(C,x);
  64. EMA50=EMA(C,y);
  65. EMA100= EMA(C,z);
  66. EMA200=EMA(C,zz);
  67.  
  68. SUT=EMA(C,5)>EMA20;
  69. SDT=EMA20>EMA(C,5);
  70. mut= EMA20>EMA50;
  71. mdt=EMA20<EMA50;
  72. _SECTION_END();
  73.  
  74.  
  75.  
  76.  
  77. _SECTION_BEGIN("LEVELS");
  78. PO=TimeFrameGetPrice( "O", inDaily, -1 );
  79. PL=TimeFrameGetPrice( "L", inDaily, -1 );
  80. PH=TimeFrameGetPrice( "H", inDaily, -1 );
  81. PC=TimeFrameGetPrice( "C", inDaily, -1 );
  82. TO= TimeFrameGetPrice( "O", inDaily, 0 );
  83. TH= TimeFrameGetPrice( "H", inDaily, 0 );
  84. TL= TimeFrameGetPrice( "L", inDaily, 0 );
  85. TC= TimeFrameGetPrice( "C", inDaily, 0 );
  86. PC1= TimeFrameGetPrice( "C", inDaily, -2 );
  87.  
  88. P=((PH+PL+PC)/3);
  89. R1=((2*P)-PL);
  90. S1=((2*P)-PH);
  91. R2=((P-S1)+R1);
  92. S2=(P-(R1-S1));
  93. R3=PH+(2*(P-PL));
  94. S3=PL-(2*(PH-P));
  95.  
  96. R=TH-TL;
  97. PP=(TH+TL+TO+TO)/4;
  98. RR1=PP+(R*0.38);
  99. RR2=PP+(R*0.62);
  100. SS1=PP-(R*0.38);
  101. SS2=PP-(R*0.62);
  102.  
  103. PPP=(TH+TL+TO+TO)/4;
  104. RRR1=((2*PPP)-TL);
  105. SSS1=((2*PPP)-TH);
  106. RRR2=((PPP-SSS1)+RRR1);
  107. SSS2=(PPP-(RRR1-SSS1));
  108.  
  109. Pchange=PC-PC1;
  110. PPerChange=(Pchange/PC1)*100;
  111. Tchange=TC-PC;
  112. TPerChange=(Tchange/TC)*100;
  113.  
  114. Title=Name()+
  115. "\nPrevious - O :-"+PO+" H :-"+PH+" L :-"+PL+" C :-"+PC+" Change:- "+Pchange+" %ge:- "+WriteVal(PPerChange,1.2)+
  116. "\nTodays - O :-"+TO+" H :-"+TH+" L :-"+TL+" C :-"+TC+" Change:- "+Tchange+" %ge:- "+WriteVal(TPerChange,1.2)+
  117. "\n"+
  118. "\n"+
  119. "\nLevels"+
  120. "\nEOD Pivot :-"+WriteVal(P,1.2)+
  121. "\nS-1 :-"+WriteVal(S1,1.2)+" - R-1 :-"+WriteVal(R1,1.2)+
  122. "\nS-2 :-"+WriteVal(S2,1.2)+" - R-2 :-"+WriteVal(R2,1.2)+
  123. "\nS-3 :-"+WriteVal(S3,1.2)+" - R-3 :-"+WriteVal(R3,1.2)+
  124. "\n"+
  125. "\nIntraday Pivot :-"+WriteVal(PP,1.2)+
  126. "\nS-1 :-"+WriteVal(SSS1,1.2)+" - R-1 :-"+WriteVal(RRR1,1.2)+
  127. "\nS-2 :-"+WriteVal(SSS2,1.2)+" - R-2 :-"+WriteVal(RRR2,1.2)+
  128. "\n"+
  129. "\nIntraday Retracement Levels"+
  130. "\nS-1 :-"+WriteVal(SS1,1.2)+" - R-1:-"+WriteVal(RR1,1.2)+
  131. "\nS-2 :-"+WriteVal(SS2,1.2)+" - R-2:-"+WriteVal(RR2,1.2);
  132. _SECTION_END();
  133. //------------------------------------------------------------------------------
  134.  
  135.  
  136.  
  137.  
  138. _SECTION_BEGIN("traing sl");
  139.  
  140. function vstop_func(trBull,trBear)
  141. {
  142. trailArray[ 0 ] = C[ 0 ]; // initialize
  143. for( i = 1; i < BarCount; i++ )
  144. {
  145. prev = trailArray[ i - 1 ];
  146.  
  147. if (C[ i ] > prev AND C[ i - 1 ] > prev)
  148. {
  149. trailArray[ i ] = Max(prev,C[ i ] - trBull[ i ]);
  150. }
  151. else if (C[ i ] < prev AND C[ i - 1 ] < prev)
  152. {
  153. trailArray[ i ] = Min(prev,C[ i ] + trBear[ i ]);
  154. }
  155. else if (C[ i ] > prev)
  156. {
  157. trailArray[ i ] = C[ i ] - trBull[ i ];
  158. }
  159. else
  160. {
  161. trailArray[ i ] = C[ i ] + trBear[ i ];
  162. }
  163. }
  164. return trailArray;
  165. }
  166.  
  167. per = Param("per",20, 1, 150, 1);
  168. multBull = Param("multBull",2, 1, 4, 0.05);
  169. multBear = Param("multBear",2, 1, 4, 0.05);
  170.  
  171. trBull = multBull * ATR(per);
  172. trBear = multBear * ATR(per);
  173.  
  174. trailArray = vstop_func(trBull,trBear);
  175. s0=trailArray;
  176.  
  177. s1= s0 > C ;
  178. s2= s0 <C ;
  179. ccresult1 = WriteIf( s1,"cu", "");
  180. ccresult2 = WriteIf( s2,"cd", "");
  181.  
  182. GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorRed);
  183. GfxSetTextColor( ParamColor("Color",colorRed) );
  184. Hor=Param("Horizontal Position",677,10,1200,1);
  185. Ver=Param("Vertical Position",50,100,50,50);
  186.  
  187. if ( ccresult1 =="cu")
  188.  
  189.  
  190. {
  191. GfxTextOut(""+s0,Hor , Ver );
  192. }
  193. else
  194.  
  195. GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorGreen );
  196. GfxSetTextColor( ParamColor("Color",colorGreen) );
  197. Hor=Param("Horizontal Position",75,10,1200,1);
  198. Ver=Param("Vertical Position",185,100,50,50);
  199.  
  200. if ( ccresult2 =="")
  201.  
  202. {
  203. GfxTextOut(""+s0,Hor , Ver );
  204. }
  205. _SECTION_END();
  206.  
  207. _SECTION_BEGIN("traing s2");
  208.  
  209. s0=trailArray;
  210.  
  211. s1= s0 > C ;
  212. s2= s0 <C ;
  213. ccresult1 = WriteIf( s1,"cu", "");
  214. ccresult2 = WriteIf( s2,"cd", "");
  215.  
  216. GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorBrightGreen );
  217. GfxSetTextColor( ParamColor("Color",colorBrightGreen) );
  218. Hor=Param("Horizontal Position",677,10,1200,1);
  219. Ver=Param("Vertical Position",50,100,50,50);
  220.  
  221. if ( ccresult2 =="cd")
  222.  
  223.  
  224. {
  225. GfxTextOut(""+s0,Hor , Ver );
  226. }
  227. else
  228.  
  229. GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorWhite );
  230. GfxSetTextColor( ParamColor("Color",colorWhite) );
  231. Hor=Param("Horizontal Position",75,10,1200,1);
  232. Ver=Param("Vertical Position",185,100,50,50);
  233.  
  234. if ( ccresult1 =="")
  235.  
  236. {
  237. GfxTextOut(""+s0,Hor , Ver );
  238. }
  239.  
  240. _SECTION_END();
  241.  
  242. _SECTION_BEGIN("CMP");
  243. GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorWhite );
  244. GfxSetTextColor( ParamColor("Color",colorWhite) );
  245. Hor=Param("Horizontal Position",777,10,1200,1);
  246. Ver=Param("Vertical Position",50,100,50,50);
  247. GfxTextOut(""+C,Hor , Ver );
  248.  
  249.  
  250. _SECTION_END();
  251.  
  252. _SECTION_BEGIN("buycircle");
  253. GfxSelectFont( "Arial", 1, 100 );
  254. GfxSetBkMode( 1 );
  255. GfxSetTextColor( colorBlue );
  256. GfxSelectPen( colorBlue, 1 );
  257. if ( ccresult2 =="cd")
  258. {
  259. GfxSelectSolidBrush( ColorRGB(0,255,0) );
  260. }
  261. else
  262. {
  263. GfxSelectSolidBrush( ColorRGB(0,0,94) );
  264. }
  265. GfxCircle( 700,10,10 );
  266.  
  267. _SECTION_END();
  268. _SECTION_BEGIN("sellcircle");
  269. GfxSelectFont( "Arial", 10, 100 );
  270. GfxSetBkMode( 1 );
  271. GfxSetTextColor( colorBlue );
  272. GfxSelectPen( colorBlue, 1 );
  273. if ( ccresult1 =="cu")
  274. {
  275. GfxSelectSolidBrush( ColorRGB(255,0,0) );
  276. }
  277. else
  278. {
  279. GfxSelectSolidBrush( ColorRGB(0,0,94) );
  280. }
  281.  
  282. GfxCircle( 800,10,10 );
  283. _SECTION_END();
  284.  
  285. _SECTION_BEGIN("Ribbon");
  286. uptrend=PDI()>MDI()AND Signal()<MACD();
  287. downtrend=MDI()>PDI()AND Signal()>MACD();
  288. Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon",
  289. IIf( uptrend, colorLime, IIf( downtrend, colorRed,IIf(Signal()<MACD(), colorWhite, colorWhite ))), /* choose color */
  290. styleOwnScale|styleArea|styleNoLabel, -0, 10 );
  291. _SECTION_END();
  292. _SECTION_BEGIN("system Ticker");
  293. function GetSecondNum()
  294. {
  295. Time = Now( 4 );
  296. Seconds = int( Time % 100 );
  297. Minutes = int( Time / 100 % 100 );
  298. Hours = int( Time / 10000 % 100 );
  299. SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
  300. return SecondNum;
  301. }
  302. RequestTimedRefresh( 1 );
  303. //----------------------------------------------------------------------------
  304. //----------------------------------------------------------------------------
  305. TimeFrame = Interval();
  306. SecNumber = GetSecondNum();
  307. Newperiod = SecNumber % TimeFrame == 0;
  308. SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
  309. SecsToGo = TimeFrame - SecsLeft;
  310.  
  311. x=Param(" xposn",555,100,1000,1000);
  312. y=Param(" yposn",0,40,1000,1);
  313.  
  314. GfxSelectSolidBrush( colorPink );
  315. GfxSelectPen( colorBlack, 2 );
  316. if ( NewPeriod )
  317. {
  318. GfxSelectSolidBrush( colorBlack );
  319. GfxSelectPen( colorBlack, 2 );
  320. Say( "New candle" );
  321. }
  322. GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
  323. GfxSetBkMode(1);
  324. GfxSelectFont( "Arial", 9, 700, False );
  325. GfxSetTextColor( colorBlack );
  326. GfxTextOut( "" +SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
  327. _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement