PureBytes Links
Trading Reference Links
|
F, try the indicator code below.
========================
Signal/Value accumulator
========================
---8<-------------------------------------
{ Signal/Value accumulator v2.0
Accumulates & resets values between signals.
http://www.metastocktools.com }
{ Start count signal }
start:=TroughBars(1,C,5)=0;
{ End count signal }
end:=PeakBars(1,C,5)=0;
{ Value to accumulate - Volume }
value:=V;
{ Indicator output choice }
plot:=Input("plot: [1]Accumulation, [2]Signals",1,2,1);
{ Remove redundant interim start/end signals }
init:=Cum(IsDefined(start+end))=1;
flag:=ValueWhen(1,start-end<>0 OR init,start);
start:=flag*(Alert(flag=0,2)
OR start*Cum(start)=1);
end:=(flag=0)*(Alert(flag,2)
OR end*Cum(end)=1);
{ Accumulate values }
acc:=Cum(flag*value);
accVal:=acc-ValueWhen(1,end,acc);
{ Plot in own window }
If(plot=1,accVal,start-end)
---8<-------------------------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "robinhood@xxx" <robinhood@xxx>
wrote:
>
> Hi all.
> I'd like to cumulate indicator values between the occurency of two
> events (the nearest one and the next).
> The cum function cumulates all data, but my idea was to reset the count
> to zero every time the event occours.
> Sum function requires a pre-definied period, so it doesn't work for me.
>
> Any suggestions?
>
> F.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|