PureBytes Links
Trading Reference Links
|
I am trying to write a MS6.52 formula to handle the situation where
there are less data points available than a nominated moving average
period, so I want the MA to show for the available data points until
there enough data points for the MA to operate normally. (Easily done
in VB, VBA, C, C++, just not MS!)
Not knowing exactly how to get around MS lack of flexibility, I was
trying:
prd:=Input("MA Periods...",1,100,5);
x:=Input("1-Open 2-High 3-Low 4-Close 5-Volume 6-P",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
ma:=If(Cum(1)<prd,Sum(x,Cum(1))/Cum(1),Mov(x,prd,S));
ma;
which didn't work, with the error message "This variable or
expression must contain only constant data"
... so I then tried to set the prd value using code:
prd:=Input("MA Periods...",1,100,5);
prd:=If(Cum(1)<prd,Cum(1),prd);
x:=Input("1-Open 2-High 3-Low 4-Close 5-Volume 6-P",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
ma:=Mov(x,prd,S);
ma;
which didn't work either, with the same error message "This variable
or expression must contain only constant data"
Hopefully, someone can see what I am trying to achieve and will be
able to help. Any assistance would be greatly appreciated.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|