PureBytes Links
Trading Reference Links
|
Hi All,
I'm trying to write the formula for Pivot Point, support and resistance as it showing in the following code.
/*
Pivot Point = [Yesterday's High + Yesterday's Low + Yesterday's Close] / 3
Support Levels
S1 = [Pivot Point * 2] - Yesterday's High
S2 = Pivot Point - Yesterday's High + Yesterday's Low
S3 = S2 - Yesterday's High + Yesterday's Low
Resistance Levels
R1 = [Pivot Point * 2] - Yesterday's Low
R2 = Pivot Point + Yesterday's High - Yesterday's Low
R3 = R2 + Yesterday's High - Yesterday's Low
*/
Piv = Ref(H,-1) + Ref(L,-1) + Ref(C,-1)/ 3; S1 = Piv*2 - Ref(H,-1); S2 = Piv - Ref(H,-1) + Ref(L,-1); S3 = S2 - Ref(H,-1) + Ref(L,-1);
R1 = Piv*2 - Ref(L,-1); R2 = Piv + Ref(H,-1) - Ref(L,-1); R3 = R2 + Ref(H,-1) - Ref(L,-1);
Plot(S1,"S1",colorgreen, styleLine); Plot(S2,"S3",colorgreen, styleLine); Plot(S3,"S3",colorgreen, styleLine);
Plot(R1,"R1",colorRed, styleLine); Plot(R2,"R2",colorRed, styleLine); Plot(R3,"R3",colorRed, styleLine);
BUT this gives me wrong result???
Any one can help please Why I got wrong result?
Also I would like to plot it as a horizontal line not as indicator. As it showing here
FloorTrader Pivots
All the best.
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
|