PureBytes Links
Trading Reference Links
|
Hi there
Would anybody be able to suggesting the best way to modify this to produce Pivots and
S+R on hourly charts, and have the S+R lines set on each new hour rather than changing?
thanks,
//---- pivot points
DayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);//low
DayC = TimeFrameGetPrice("C", inDaily, -1);//close
DayO = TimeFrameGetPrice("O", inDaily);// current day open
HiDay = TimeFrameGetPrice("H", inDaily);
LoDay = TimeFrameGetPrice("L", inDaily);
PP = (DayH + DayL + DayO + DayO) / 4 ;
R1 = (2 * PP) - DayL;
S1 = (2 * PP) - DayH;
R2 = PP + R1 - S1;
S2 = PP + S1 - R1;
R3 = R2 + (R1 - PP);
S3 = S2 - (PP - S1);
style = styleLine | styleThick + styleNoRescale;
rcolor = ParamColor("R1 R2 R3 color",colorBlue);
scolor = ParamColor("S1 S2 S3 color",colorRed);
pcolor = ParamColor("Pivot color",colorBlack);
Plot(R1, "R1",rcolor,style);
Plot(S1, "S1",scolor,style);
Plot(R2, "R2",rcolor,style);
Plot(S2, "S2",scolor,style);
Plot(PP, "PP",pcolor,style);
Plot(s3, "S3", scolor, style);
Plot(R3, "R3", rcolor, style);
//HiDayTitle = EncodeColor(colorBlack) + "HOD ";
//HiDayTitle = HiDayTitle + EncodeColor(colorBlack) + HiDay;
//LoDayTitle = EncodeColor(colorBlack) + ", LOD ";
//LoDayTitle = LoDayTitle + EncodeColor(colorBlack) + LoDay;
RangeTitle = EncodeColor(colorBlack) + "Range= " + EncodeColor(colorBlack) +
StrToNum(NumToStr(HiDay - LoDay, 4.4)) + " points";
// High/Low of the Day plotting.
Hodcolorsheme=ParamColor("High of day color",colorYellow);
LodColorscheme=ParamColor("Low of day color",colorDarkRed);
tempnum = TimeNum();
temphi[0] = H[0];
temphiColor[0] = Hodcolorsheme;
templo[0] = L[0];
temploColor[0] = LodColorscheme;
for( i = 1; i < BarCount; i++ )
{
if(tempnum[i] - tempnum[i-1] > Interval())
{
if(H[i] > temphi[i-1])
{
temphi[i] = H[i];
temphiColor[i] = Hodcolorsheme;
}
else
{
temphi[i] = temphi[i-1];
temphiColor[i] = Hodcolorsheme;
}
if(L[i] < templo[i-1])
{
templo[i] = L[i];
temploColor[i] = LodColorscheme;
}
else
{
templo[i] = templo[i-1];
temploColor[i] = LodColorscheme;
}
}
else
{
temphi[i] = H[i];
temphiColor[i] = Hodcolorsheme;
templo[i] = L[i];
temploColor[i] = LodColorscheme;
}
}
Plot(temphi,"", temphiColor,styleBar);
Plot(templo,"", temploColor,styleBar);
Titledisplaycode = "\n"+"" + Name() + ", " + Interval(2) + ", " + Date() + "\n"
+
EncodeColor(colorBlack) + "O " + EncodeColor(colorBlack) + O +
EncodeColor(colorBlack) + " H " + EncodeColor(colorBlack) + H +
EncodeColor(colorBlack) + " L " + EncodeColor(colorBlack) + L +
EncodeColor(colorBlack) + " C " + EncodeColor(colorBlack) + C + "\n" +
EncodeColor(rcolor) + "R1= " + EncodeColor(colorBlack) + R1 + "\n" +
EncodeColor(rcolor) + "R2= " + EncodeColor(colorBlack) + R2 + "\n" +
EncodeColor(rcolor) + "R3= " + EncodeColor(colorBlack) + R3 + "\n" +
EncodeColor(pcolor) + "PP= " + EncodeColor(colorBlack) + PP + "\n" +
EncodeColor(scolor) + "S1= " + EncodeColor(colorBlack) + S1 + "\n" +
EncodeColor(scolor) + "S2= " + EncodeColor(colorBlack) + S2+ "\n" +
EncodeColor(scolor) + "S3= " + EncodeColor(colorBlack) + S3 + "\n" +
EncodeColor(Hodcolorsheme) + "HOD= " + EncodeColor(colorBlack) + Hiday + "\n"
+
EncodeColor(LodColorscheme) + "LOD= " + EncodeColor(colorBlack) + Loday + "\n"
+ RangeTitle;
Title=WriteIf(Titledisplay==1,Titledisplaycode, "\n"+"" + Name() + ", " +
Interval(2) + ", " + Date() + "\n" +
EncodeColor(colorBlack) + "O " + EncodeColor(colorBlack) + O +
EncodeColor(colorBlack) + " H " + EncodeColor(colorBlack) + H +
EncodeColor(colorBlack) + " L " + EncodeColor(colorBlack) + L +
EncodeColor(colorBlack) + " C " + EncodeColor(colorBlack) + C + "\n");
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|