Metastock Indicator Formula |
Weekly Closing Curve |
This indicator has been written for those who want to use weekly closing or any other weekly price element in their formula's. Indicator provides you a clear curve for each day of weekly closing or according to your required price element. The advantage of this indicator is, you can analyse the daily price chart with weekly curve.
For selecting price element you only need to point out the specific number of the price element that which you want for finding values.
Through Scrolling 'Nth periods' (for preceding number of weeks) you will get specific weekly periods closing or required price element.
For Exploration purposes you only need to delete all narrations of variable portion and then correct output portion by writing '1' instead of 'xx' and by writing ‘close’ or required element of the price section.
|
Formula: |
{Variables}
x1:=Input("[1]Open [2]High [3]Low [4]Close [5]Vol",1,5,4);
xx:=Input("Nth Periods",1,365,1);
{Data Array}
x1:=If(x1=1,O,If(x1=2,H,If(x1=3,L,If(x1=4,C,If(x1=5,V,C)))));
{Logic}
x:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
{Out put}
(ValueWhen(xx,x>0,Ref(x1,-1)))
|
|
|