Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Eddie
I gave an incomplete answer to LJ to encourage him to think for himself. Help that costs nothing is often treated as if it's worth nothing, whereas help that costs time, effort or money is more likely to be appreciated and of greater benefit to the recipient in the long run. However, there was no intended suggestion by me that LJ would have to pay for a more complete answer in the event that he couldn't get any further without further help.
I don't agree with your advice to "do only what you know because this is what comes easy". If this works for you then by all means stick with it. In my experience, however, there's little in life that comes easy without serious effort along the way.
Why you should be opposed to me charging for some of my MetaStock skills is a mystery, but if it's something that's bugging you then perhaps you should talk to me about it directly rather than through this forum.
LJ
Here's some code for basic event-based simple and exponential moving averages. Hopefully this adds some substance to my initial post. You will need to define the event you have in mind so that a TRUE signals a valid sample value and a FALSE inhibits value sampling.
Code:
{Event-based Simple Moving Average}
{Roy Larsen, 6/5/2013}
N:=Input("Event-based SMA Periods",1,99,10);
{Define the event to control price smoothing}
Event:= C>Ref(C,-1);
{Event-based SMA}
Z:=Cum(1); A:=Cum(Event);
Z:=Z-ValueWhen(N+1,Event,Z);
Z:=ExtFml("Forum.Sum",Event*C,Z);
ValueWhen(1,Event,Z)/N;
{Event-based Exponential Moving Average}
{Roy Larsen, 6/5/2013}
N:=Input("Event-based EMA Periods",1,99,10);
{Define event to control price smoothing}
Event:= C>Ref(C,-1);
{Event-based EMA}
R:=If(Event,N,Pwr(10,10));
ExtFml("Forum.Mov",C,R,E);
Roy
|