Advertisement
saisri

2013 jan 28 part 1

Jan 27th, 2013
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.22 KB | None | 0 0
  1.  
  2. /* wayneL's Daytrading Template - To be plotted on intraday charts */
  3.  
  4. GraphXSpace = 0;
  5.  
  6. /* This plots the price bars. Select whether you want candlesticks or ordinary bars via th "view" menu */
  7. _SECTION_BEGIN("Price");
  8. SetChartOptions(0,chartShowArrows|chartShowDates);
  9. _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
  10. Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
  11. _SECTION_END();
  12.  
  13.  
  14. /* The next section calculates and plots the dynamic 3 day pivots */
  15.  
  16. _SECTION_BEGIN("3 Day Pivots");
  17. Hi1 = IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,3),-1),0);
  18. Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
  19. Lo1 = IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,3),-1),0);
  20. Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
  21. Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
  22. Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);
  23.  
  24. rg = (Hi - Lo);
  25. bp = (Hi + Lo + Cl)/3;
  26. r1 = (bp*2)-Lo;
  27. s1 = (bp*2)-Hi;
  28. r2 = bp + r1 - s1;
  29. s2 = bp - r1 + s1;
  30.  
  31. Plot(s2,"",colorYellow,styleLine|styleNoRescale|styleNoLabel);
  32. Plot(r2,"",colorOrange,styleLine|styleNoRescale|styleNoLabel);
  33. Plot(s1,"",colorYellow,styleLine|styleNoRescale|styleNoLabel);
  34. Plot(r1,"",colorOrange,styleLine|styleNoRescale|styleNoLabel);
  35. _SECTION_END();
  36.  
  37. /* This next section calculates and plots the daily pivots using fibonacci ranges */
  38.  
  39. _SECTION_BEGIN("Daily Fib Pivots");
  40. Hi1 = IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
  41. Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
  42. Lo1 = IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
  43. Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
  44. Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
  45. Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);
  46.  
  47. rg = (Hi - Lo);
  48. bp = (Hi + Lo + Cl)/3;
  49. r1 = (bp*2)-Lo;
  50. s1 = (bp*2)-Hi;
  51. r2 = bp + rg;
  52. s2 = bp - rg;
  53. r2o = bp + (1.272*rg);
  54. s2o = bp - (1.272*rg);
  55. rh = bp + (0.5*rg);
  56. rl = bp - (0.5*rg);
  57. rh6 = bp + (0.618*rg);
  58. rl6 = bp - (0.618*rg);
  59.  
  60. Plot(s2,"",colorGreen,styleBar|styleNoRescale|styleNoLabel);
  61. Plot(r2,"",colorRed,styleBar|styleNoRescale|styleNoLabel);
  62. Plot(rh,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
  63. Plot(rl,"",colorRed,styleBar|styleNoRescale|styleNoLabel);
  64. Plot(bp,"",colorBlue,styleThick|styleNoRescale|styleNoLabel);
  65. Plot(rh6,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
  66. Plot(rl6,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
  67. Plot(r2o,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
  68. Plot(s2o,"",colorGreen,styleBar|styleNoRescale|styleNoLabel);
  69. _SECTION_END();
  70.  
  71. //--end----------------------------------------------------------------------------
  72.  
  73.  
  74.  
  75. _SECTION_BEGIN("Parameters");
  76. LB1= Param("Long LookBack Periods",42,1,60,1);
  77. LB3= Param("Mid LookBack Periods",18,1,30,1);
  78. LB2= Param("Short LookBack Periods",6,1,30,1);
  79.  
  80. _SECTION_END();
  81.  
  82. _SECTION_BEGIN("ResistanceLong");
  83.  
  84. RsColor=ParamColor("LongResColor",colorOrange);
  85. BrCount=Param("LongBarLength",65,1,500,1);
  86. for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
  87. {
  88. RsColor[i] = colorBlack;
  89. }
  90.  
  91. flowerClose = EMA((Open+High+Low+Close)/4,3) ;
  92. flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
  93. Temp = Max(High, flowerOpen);
  94. flowerHigh = EMA(Max(Temp, flowerClose),3);
  95. Temp = Min(Low,flowerOpen);
  96. flowerLow = EMA(Min(Temp, flowerClose),3);
  97.  
  98. R=ValueWhen(Cross(MA(flowerClose,LB1),C),HHV(flowerHigh,LB1),-1);
  99. Plot(R,"Resistance",RsColor,ParamStyle("LongResStyle",styleNoTitle|styleLine|styleDots|styleStaircase|styleThick,maskAll));
  100. _SECTION_END();
  101.  
  102. _SECTION_BEGIN("ResistanceMid");
  103. Rs3Color=ParamColor("MidResColor",colorCustom4);
  104. BrCount3=Param("MidBarLength",40,1,500,1);
  105. for (i=0;i<BarCount-BrCount3;i++) //hide the line except most recent 10 bars
  106. {
  107. Rs3Color[i] =colorBlack;
  108. }
  109.  
  110. flowerClose = EMA((Open+High+Low+Close)/4,3) ;
  111. flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
  112. Temp = Max(High, flowerOpen);
  113. flowerHigh = EMA(Max(Temp, flowerClose),3);
  114. Temp = Min(Low,flowerOpen);
  115. flowerLow = EMA(Min(Temp, flowerClose),3);
  116.  
  117. RM2=ValueWhen(Cross(EMA(flowerClose,LB3),C),HHV(flowerHigh,LB3),-1);
  118. Plot(RM2,"MidRes",Rs3Color,ParamStyle("MidResStyle",styleLine|styleStaircase|styleNoTitle,maskAll));
  119. _SECTION_END();
  120.  
  121. _SECTION_BEGIN("ResistanceShort");
  122. Rs2Color=ParamColor("ShortResColor",colorCustom12);
  123. BrCount2=Param("ShortResLength",12,1,500,1);
  124. for (i=0;i<BarCount-BrCount2;i++) //hide the line except most recent 10 bars
  125. {
  126. Rs2Color[i] = colorBlack;
  127. }
  128.  
  129. flowerClose = EMA((Open+High+Low+Close)/4,3) ;
  130. flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
  131. Temp = Max(High, flowerOpen);
  132. flowerHigh = EMA(Max(Temp, flowerClose),3);
  133. Temp = Min(Low,flowerOpen);
  134. flowerLow = EMA(Min(Temp, flowerClose),3);
  135.  
  136. RM=ValueWhen(Cross(TEMA(flowerClose,LB2),C),HHV(flowerHigh,LB2),-1);
  137. Plot(RM,"ShortRes",Rs2Color,ParamStyle("ShortResStyle",styleDashed|styleThick|styleNoTitle|styleStaircase,maskAll));
  138. _SECTION_END();
  139.  
  140.  
  141.  
  142.  
  143. _SECTION_BEGIN("SupportLong");
  144. Sup1Color=ParamColor("LongSupColor",colorBlue);
  145. BrCount4=Param("LongSupBarLength",65,1,500,1);
  146. for (i=0;i<BarCount-BrCount4;i++) //hide the line except most recent 10 bars
  147. {
  148. Sup1Color[i] =colorBlack;
  149. }
  150.  
  151. flowerClose = EMA((Open+High+Low+Close)/4,3) ;
  152. flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
  153. Temp = Max(High, flowerOpen);
  154. flowerHigh = EMA(Max(Temp, flowerClose),3);
  155. Temp = Min(Low,flowerOpen);
  156. flowerLow = EMA(Min(Temp, flowerClose),3);
  157.  
  158. S=ValueWhen(Cross(MA(flowerClose,LB1),C),LLV(flowerLow,LB1),-1);
  159. Plot(s,"Support",Sup1Color,ParamStyle("SupStyle",styleLine|styleDots|styleStaircase|styleThick|styleNoTitle,maskAll));
  160. _SECTION_END();
  161.  
  162. _SECTION_BEGIN("SupportMid");
  163. Sup3Color=ParamColor("MidSupColor",colorDarkYellow);
  164. BrCount6=Param("MidBarLength",40,1,500,1);
  165. for (i=0;i<BarCount-BrCount6;i++) //hide the line except most recent 10 bars
  166. {
  167. Sup3Color[i] =colorBlack;
  168. }
  169.  
  170. flowerClose = EMA((Open+High+Low+Close)/4,3) ;
  171. flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
  172. Temp = Max(High, flowerOpen);
  173. flowerHigh = EMA(Max(Temp, flowerClose),3);
  174. Temp = Min(Low,flowerOpen);
  175. flowerLow = EMA(Min(Temp, flowerClose),3);
  176.  
  177. SM2=ValueWhen(Cross(EMA(flowerClose,LB3),C),LLV(flowerLow,LB3),-1);
  178. Plot(SM2,"MidSup",Sup3Color,ParamStyle("MidSupStyle",styleLine|styleStaircase|styleNoTitle,maskAll));
  179. _SECTION_END();
  180.  
  181. _SECTION_BEGIN("SupportShort");
  182. Sup2Color=ParamColor("ShortSupColor",colorPink);
  183. BrCount5=Param("ShortSupBarLength",12,1,500,1);
  184. for (i=0;i<BarCount-BrCount5;i++) //hide the line except most recent 10 bars
  185. {
  186. Sup2Color[i] =colorBlack;
  187. }
  188.  
  189.  
  190. flowerClose = EMA((Open+High+Low+Close)/4,3) ;
  191. flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
  192. Temp = Max(High, flowerOpen);
  193. flowerHigh = EMA(Max(Temp, flowerClose),3);
  194. Temp = Min(Low,flowerOpen);
  195. flowerLow = EMA(Min(Temp, flowerClose),3);
  196.  
  197. SM=ValueWhen(Cross(TEMA(flowerClose,LB2),C),LLV(flowerLow,LB2),-1);
  198. Plot(SM,"ShortSup",Sup2Color,ParamStyle("ShortSupStyle",styleDashed|styleThick|styleNoTitle|styleStaircase,maskAll));
  199. _SECTION_END();
  200.  
  201. _SECTION_BEGIN("Isfandi Technical Viewer");
  202. //Plot(C,"",ParamColor( "Color", colorBlue ),ParamStyle("Style") );
  203. //---- pivot points
  204. GfxSetBkColor(colorBlack);
  205. GfxSetTextColor( colorGrey50 );
  206. GfxSelectFont("Edwardian Script ITC", 25, 500, True );
  207. DayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high
  208. DayL = TimeFrameGetPrice("L", inDaily, -1);//low
  209. DayC = TimeFrameGetPrice("C", inDaily, -1);//close
  210. DayO = TimeFrameGetPrice("O", inDaily);// current day open
  211. HiDay = TimeFrameGetPrice("H", inDaily);
  212. LoDay = TimeFrameGetPrice("L", inDaily);
  213. PP = (DayH + DayL + DayO + DayO) / 4 ;
  214. R1 = (2 * PP) - DayL;
  215. S1 = (2 * PP) - DayH;
  216. R2 = PP + R1 - S1;
  217. S2 = PP + S1 - R1;
  218. R3 = R2 + (R1 - PP);
  219. S3 = S2 - (PP - S1);
  220.  
  221. radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius
  222. textoffset = 0.1 * radius;
  223.  
  224. //====================
  225. GfxSetOverlayMode(0);
  226.  
  227. //-Paint Background
  228.  
  229. GfxSelectSolidBrush( colorBlack);
  230. GfxSelectPen( colorPink);
  231. GfxRoundRect( 2, 30, 500, 49, 32, 32);
  232. GfxSetBkMode( 1 );
  233.  
  234. GfxSelectFont("Arial", 8, 900);
  235.  
  236.  
  237. // OTHER INDICATOR
  238. MOMETUM =RSI(14);
  239. radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius
  240. textoffset = 0.1 * radius;
  241. GfxSelectFont("Arial", 9, 500, True );
  242. GfxSelectFont("Arial", 9 );
  243. GfxSetTextColor( colorLime);
  244. GfxTextOut( "R1 =" + R1, textoffset + 310, 32 );
  245. GfxSetTextColor( colorLime );
  246. GfxTextOut( "R2 = " +R2, textoffset + 410, 32);
  247. GfxSetTextColor( colorBlue );
  248. GfxTextOut( "PP = " +PP, textoffset + 210, 32);
  249. GfxSetTextColor( colorOrange );
  250. GfxTextOut( "S1 = " +S1, textoffset + 10, 32);
  251. GfxSetTextColor( colorRed );
  252. GfxTextOut( "S2 = " +S2, textoffset + 110, 32);
  253. GfxSelectFont("Arial", 9 );
  254. _SECTION_END();
  255.  
  256. _SECTION_BEGIN("Background");
  257. SetChartOptions(0,chartShowArrows|chartShowDates);
  258. SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border
  259. SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
  260. tchoice=Param("Title Selection ",2,1,2,1);
  261.  
  262. Plot(C, "", IIf(O>=C, colorRed, colorGreen), ParamStyle("Price Style",styleCandle,maskPrice));
  263.  
  264. //-Paint Background
  265.  
  266. GfxSelectSolidBrush( colorBlack);
  267. GfxSelectPen( colorBlue);
  268. GfxRoundRect( 500, 20, 930, 49, 32, 32 );
  269. GfxSetBkMode( 1 );
  270.  
  271. GfxSelectFont("Arial", 8, 900);
  272.  
  273.  
  274. _SECTION_BEGIN("Magnified Market Price");
  275. FS=Param("Font Size",12,30,100,1);
  276. GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
  277. GfxSetBkMode( colorGreen );
  278. GfxSetTextColor( ParamColor("Color",colorAqua) );
  279. Hor=Param("Horizontal Position",630,800,800,800);
  280. Ver=Param("Vertical Position",25,27,27,27);
  281. GfxTextOut("CMP: "+C,Hor , Ver );
  282. YC=TimeFrameGetPrice("C",inDaily,-1);
  283. DD=Prec(C-YC,2);
  284. xx=Prec((DD/YC)*100,2);
  285. GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
  286. GfxSetBkMode( colorGreen );
  287. GfxSetTextColor(ParamColor("Color",colorGreen) );
  288. GfxTextOut("change ("+DD+") ("+xx+"%)", Hor+130, Ver+0 );
  289. _SECTION_END();
  290.  
  291. _SECTION_BEGIN("system Ticker");
  292. function GetSecondNum()
  293. {
  294. Time = Now( 4 );
  295. Seconds = int( Time % 100 );
  296. Minutes = int( Time / 100 % 100 );
  297. Hours = int( Time / 10000 % 100 );
  298. SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
  299. return SecondNum;
  300. }
  301. RequestTimedRefresh( 1 );
  302. //----------------------------------------------------------------------------
  303. //----------------------------------------------------------------------------
  304. TimeFrame = Interval();
  305. SecNumber = GetSecondNum();
  306. Newperiod = SecNumber % TimeFrame == 0;
  307. SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
  308. SecsToGo = TimeFrame - SecsLeft;
  309.  
  310. x=Param(" xposn",520,100,1000,1000);
  311. y=Param(" yposn",27,40,1000,1);
  312.  
  313. GfxSelectSolidBrush( colorBlack );
  314. GfxSelectPen( colorRed, 2 );
  315. if ( NewPeriod )
  316. {
  317. GfxSelectSolidBrush( colorBlack );
  318. GfxSelectPen( colorBlack, 2 );
  319. }
  320. GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
  321. GfxSetBkMode(1);
  322. GfxSelectFont( "Arial", 9, 700, False );
  323. GfxSetTextColor( colorBrightGreen );
  324. GfxTextOut( "" +SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
  325. _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement