logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
caseycheah  
#1 Posted : Saturday, March 26, 2011 11:00:48 PM(UTC)
caseycheah

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/20/2006(UTC)
Posts: 4

The flwg formula for Yrly HLC is great. It can be plotted with daily, weely or monthly bars. Now I'm looking for Quarterly HLC plot (with daily and weekly bars) , and Monthly HLC plot (at least for daily bars, and if possible also for weekly bars). Appreciate if some of you can help with the formula. Formula for Yearly HLC: {Input} plt:=Input("Year's [1]Hi/Lo/Cl, [0]Hi/Lo signals",0,1,1); {Year vars} y:=Year(); y0:=LastValue(y); nuYr:=y>Ref(y,-1) OR Cum(1)=2; {High} Hi:=HighestSince(1,nuYr,H)*Ref(nuYr,1); x0:=LastValue(HighestSince(1,nuYr,H))*(y=y0); x1:=y=y0-1; x1:=LastValue(Highest(Hi*x1))*x1; x2:=y=y0-2; x2:=LastValue(Highest(Hi*x2))*x2; x3:=y=y0-3; x3:=LastValue(Highest(Hi*x3))*x3; x4:=y=y0-4; x4:=LastValue(Highest(Hi*x4))*x4; x5:=y=y0-5; x5:=LastValue(Highest(Hi*x5))*x5; x6:=y=y0-6; x6:=LastValue(Highest(Hi*x6))*x6; x7:=y=y0-7; x7:=LastValue(Highest(Hi*x7))*x7; x8:=y=y0-8; x8:=LastValue(Highest(Hi*x8))*x8; x9:=y=y0-9; x9:=LastValue(Highest(Hi*x9))*x9; x10:=y=y0-10; x10:=LastValue(Highest(Hi*x10))*x10; x11:=y=y0-11; x11:=LastValue(Highest(Hi*x11))*x11; Hi:=x0+x1+x2+x3+x4+x5+x6+x7+x8+x9+x10+x11; Hi:=Hi+BarsSince(Hi>0); {Low} Lo:=LowestSince(1,nuYr,L)*Ref(nuYr,1); x0:=LastValue(LowestSince(1,nuYr,L))*(y=y0); x1:=y=y0-1; x1:=LastValue(Highest(Lo*x1))*x1; x2:=y=y0-2; x2:=LastValue(Highest(Lo*x2))*x2; x3:=y=y0-3; x3:=LastValue(Highest(Lo*x3))*x3; x4:=y=y0-4; x4:=LastValue(Highest(Lo*x4))*x4; x5:=y=y0-5; x5:=LastValue(Highest(Lo*x5))*x5; x6:=y=y0-6; x6:=LastValue(Highest(Lo*x6))*x6; x7:=y=y0-7; x7:=LastValue(Highest(Lo*x7))*x7; x8:=y=y0-8; x8:=LastValue(Highest(Lo*x8))*x8; x9:=y=y0-9; x9:=LastValue(Highest(Lo*x9))*x9; x10:=y=y0-10; x10:=LastValue(Highest(Lo*x10))*x10; x11:=y=y0-11; x11:=LastValue(Highest(Lo*x11))*x11; Lo:=x0+x1+x2+x3+x4+x5+x6+x7+x8+x9+x10+x11; Lo:=Lo+BarsSince(Lo>0); {Close} Cl:=C*Ref(nuYr,1); x0:=LastValue(C)*(y=y0); x1:=y=y0-1; x1:=LastValue(Highest(Cl*x1))*x1; x2:=y=y0-2; x2:=LastValue(Highest(Cl*x2))*x2; x3:=y=y0-3; x3:=LastValue(Highest(Cl*x3))*x3; x4:=y=y0-4; x4:=LastValue(Highest(Cl*x4))*x4; x5:=y=y0-5; x5:=LastValue(Highest(Cl*x5))*x5; x6:=y=y0-6; x6:=LastValue(Highest(Cl*x6))*x6; x7:=y=y0-7; x7:=LastValue(Highest(Cl*x7))*x7; x8:=y=y0-8; x8:=LastValue(Highest(Cl*x8))*x8; x9:=y=y0-9; x9:=LastValue(Highest(Cl*x9))*x9; x10:=y=y0-10; x10:=LastValue(Highest(Cl*x10))*x10; x11:=y=y0-11; x11:=LastValue(Highest(Cl*x11))*x11; Cl:=x0+x1+x2+x3+x4+x5+x6+x7+x8+x9+x10+x11; Cl:=Cl+BarsSince(Cl>0); {Hi/Lo signals} signals:=(H=Hi)-(L=Lo); {Plot HLC on price chart} plt*Hi; plt*Lo; If(plt=1,Cl,signals)
johnl  
#2 Posted : Monday, March 28, 2011 7:26:28 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

You might try changing y:=(Year(); to:

y:=(Year()*100)+Month();

for monthly
If that works for you then for weekly and quarterly you only need to figure out
how to "step" the "y" variable at the right time.:


caseycheah  
#3 Posted : Tuesday, March 29, 2011 4:05:01 AM(UTC)
caseycheah

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/20/2006(UTC)
Posts: 4

John1,

Thanks for your help. I'll try that out.

caseycheah  
#4 Posted : Friday, April 1, 2011 9:53:51 AM(UTC)
caseycheah

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/20/2006(UTC)
Posts: 4

Johnl, when I changed y as said, many names become unrecognisable. Cannot proceed with the plot.

johnl  
#5 Posted : Friday, April 1, 2011 7:09:18 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

I tried it again. It worked for me. It plots the monthly data for the current year.
What does your Y:=? code look like?
caseycheah  
#6 Posted : Saturday, April 2, 2011 7:24:52 PM(UTC)
caseycheah

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/20/2006(UTC)
Posts: 4

Thanks Johnl . The formula I originally posted can plot the Yearly HLC lines on daily, weekly, monthly and quarterly charts. Now I'm looking for a formula that plots Quarterly HLC lines on weekly chart (good if it can also plot on daily charts), and another formula to plot Monthly HLC lines on daily charts. The modification you suggested I believe still focuses on plotting Yearly HLC lines, but on monthly chart, whereas in the original formula you can just change the periodicity to monthly...and the yearly HLC lines will still remain unchanged.

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.