# Pivot System for Amibroker

Jul 20th, 2019
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
2. // Shared by AJEET SINGH ph: 8178773712
3. GraphXSpace = 5 ;
4. SetChartOptions(0,chartShowArrows|chartShowDates);
5.
6. Plot(C,"Close",colorBlack, styleCandle);
7. ppl = ParamToggle("Plot Pivot Levels","Off|On",1);
8.
9. numbars = LastValue(Cum(Status("barvisible")));
10. fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
11. hts = -33.5;
12.
13. /* This code calculates the previous days high, low and close */
14. Hi1 = IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
15. Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
16. Lo1 = IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
17. Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
18. Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
19. C1 = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);
20.
21. //----------------------------------------------------------------------------------
22.
23. /* This code calculates Daily Piovts */
24.
25. rg = (Hi - Lo);
26. bp = (Hi + Lo + C1)/3; bpI = LastValue (bp,1);
27. r1 = (bp*2)-Lo; r1I = LastValue (r1,1);
28. s1 = (bp*2)-Hi; s1I = LastValue (s1,1);
29. r2 = bp + r1 - s1; r2I = LastValue (r2,1);
30. s2 = bp - r1 + s1; s2I = LastValue (s2,1);
31. r3 = bp + r2 - s1; r3I = LastValue (r3,1);
32. s3 = bp - r2 + s1; s3I = LastValue (s3,1);
33. r4 = bp + r2 - s2; r4I = LastValue (r4,1);
34. s4 = bp - r2 + s2; s4I = LastValue (s4,1);
35.
36. if(ppl==1) {
37. Plot(bp,"",colorBlue,styleLine|styleDots|styleNoRescale);
38. Plot(s1,"",colorRed,styleLine|styleNoRescale);
39. Plot(s2,"",colorRed,styleLine|styleNoRescale);
40. Plot(s3,"",colorRed,styleLine|styleNoRescale);
41. Plot(s4,"",colorRed,styleLine|styleNoRescale);
42. Plot(r1,"",colorGreen,styleLine|styleNoRescale);
43. Plot(r2,"",colorGreen,styleLine|styleNoRescale);
44. Plot(r3,"",colorGreen,styleLine|styleNoRescale);
45. Plot(r4,"",colorGreen,styleLine|styleNoRescale);
46. PlotText("Pivot" , LastValue(BarIndex())-(numbars/Hts), bpI +0.05, colorBlue);
47. PlotText("R1", LastValue(BarIndex())-(numbars/Hts), r1I +0.05, colorGreen);
48. PlotText("S1" , LastValue(BarIndex())-(numbars/Hts), s1I +0.05, colorRed);
49. PlotText("R2", LastValue(BarIndex())-(numbars/Hts), r2I +0.05, colorGreen);
50. PlotText("S2" , LastValue(BarIndex())-(numbars/Hts), s2I +0.05, colorRed);
51. PlotText("R3" , LastValue(BarIndex())-(numbars/Hts), r3I +0.05, colorGreen);
52. PlotText("S3" , LastValue(BarIndex())-(numbars/Hts), s3I +0.05, colorRed);
53. PlotText("R4" , LastValue(BarIndex())-(numbars/Hts), r4I +0.05, colorGreen);
54. PlotText("S4" , LastValue(BarIndex())-(numbars/Hts), s4I +0.05, colorRed);
55. }
RAW Paste Data Copied