PureBytes Links
Trading Reference Links
|
Tomasz Janeczko wrote:
> ValueWhen gives array, you may need to use LastValue to
> convert them to single number.
Thanks, Tomasz. That sort of worked, at least to the extent of producing a
result. Unfortunately, it's the wrong result. I'm really looking for a
simple moving average of the last five values, so I added them together and
divided by five. Unfortunately, the value remains the same throughout the
data file, beginning with the first bar--before the first event has
occurred--and this is clearly not correct. Also, inspecting the chart
suggests that the value should be in the neighborhood of 8, plus or minus 4;
it comes out as 11,523. I'd appreciate any further insights you might be
able to offer. Here is what I did:
N1=abs(LastValue(ValueWhen(XU,BarIndex(),1),True) -
LastValue(ValueWhen(XD,BarIndex(),1),True));
N2=abs(LastValue(ValueWhen(XU,BarIndex(),2),True) -
LastValue(ValueWhen(XD,BarIndex(),2),True));
N3=abs(LastValue(ValueWhen(XU,BarIndex(),3),True) -
LastValue(ValueWhen(XD,BarIndex(),3),True));
N4=abs(LastValue(ValueWhen(XU,BarIndex(),4),True) -
LastValue(ValueWhen(XD,BarIndex(),4),True));
N5=abs(LastValue(ValueWhen(XU,BarIndex(),5),True) -
LastValue(ValueWhen(XD,BarIndex(),5),True));
Val=(N1+N2+N3+N4+N5)/5;
Plot(Val,"",colorRed,styleLine);
Thanks again.
Owen Davies
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Remanufactured Ink Cartridges & Refill Kits at MyInks.com for: HP $8-20. Epson $3-9, Canon $5-15, Lexmark $4-17. Free s/h over $50 (US & Canada).
http://www.c1tracking.com/l.asp?cid=6351
http://us.click.yahoo.com/0zJuRD/6CvGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|