[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: cum(1) function



PureBytes Links

Trading Reference Links


OK, this is just on the example specifically - see Roy's reply as
well for better examples of using the cum(1) function.

> buy:=If (some boolean test),cum(1),0)
> 
> Does this mean it's like this
> If TRUE then
> buy = buy + 1;
> else
> buy = 0;

This is actually NOT what the MS statement does.  It starts off
by creating a time series that accumulates by 1 each bar.  Let us
call this C1 to clarify, say

    C1 = cum(1)

so

    C1(1) = 0

and

    C1(t) = C1(t-1) + 1

or, simply,

    C1 = 1, 2, 3, 4 ....

Note (this is sometimes useful) if you had something like

    C2 = cum(5)

then

    C2 = 5, 10, 15, 20 ...

Now, what that MS line of code you gave does, is to switch between
either zero or C1.  So if you are at time period 100, and previously
the boolean test was false, but now is true, that function will return
100, then 101, 102 ..., and not 1, 2, 3 ... as your code implies.  So
maybe the code should be

increment c1 REGARDLESS
if true then
result = c1
else
result = zero

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com 


--- In equismetastock@xxxxxxxxxxxxxxx, "dpleydel" <dpleydel@xxxx> wrote:
> 
> 
> Hi 
> 
> I've looked at the primer but I still don't quite get what this 
> function is doing.
> 
> for example I've seen it used in a this this regard:
> 
> buy:=If (some boolean test),cum(1),0)
> 
> Does this mean it's like this
> If TRUE then
> buy = buy + 1;
> else
> buy = 0;
> 
> Thanks
> David





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
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/