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

[EquisMetaStock Group] Re: Cannot get an indicator to trigger first time around.



PureBytes Links

Trading Reference Links

Steve, try something like this:

---8<--------------------------------------

{ http://www.metastocktools.com }

{Indicator user inputs}
ThresholdBuy:=Input("Buy threshold",0,1000,120);
ThresholdSell:=Input("Sell threshold",0,1000,80);
MoneyFlowThreshold:=Input("MoneyFlow threshold",0,999999999,1000000);
pds:=Input("Average V*C periods",1,252,5);
plot:=Input("plot:  [1]Signals,  [2]RoaR",1,2,1);

{RoAR Calculation}
RoaR:=1000*((LinearReg(C,52)-Ref(LinearReg(C,52),-26))/C);

{Calc bars since crossover}
Init:=Cum(IsDefined(RoaR))=2;
BarsSinceBuy:=
 BarsSince(Cross(RoAR,ThresholdBuy) OR Init);
BarsSinceSell:=
 BarsSince(Cross(ThresholdSell,RoAR) OR Init);
RoARValOK:=RoAR>=ThresholdSell
 AND (BarsSinceSell>BarsSinceBuy OR Init);

{Calc average V*C}
AvVol:=Mov(V,pds,S);
AvCl:=Mov(C,pds,S);
VCOk:=AvVol*AvCl>=MoneyFlowThreshold;

{RoaR signals}
signals:=Roar*RoARValOK*VCOk;

{Plot in own window}
If(plot=1,signals,ThresholdBuy);
If(plot=1,signals,ThresholdSell);
If(plot=1,signals,RoaR)

---8<--------------------------------------


jose '-)
http://www.metastocktools.com




--- In equismetastock@xxxxxxxxxxxxxxx, Stephen Dawson <dawsonsg@xxx> 
wrote:
>
> Hi Guys,
> 
> I have put the following formula in an indicator.It is just the Daily 
> RoAR from Alan Hull.
> 
> When the indicator is plotted it only starts plotting after the 
> ThresholdBuy value has been exceeded and then reduced to less than 
> Threshold Sell. Could someone please let me know how to get this 
> indicator to plot properly the first time it is triggered as well
> 
> Thanks
> Steve
> 
> 
> {Buy sell Av V*C Thresholds}
> ThresholdBuy:=120;
> ThresholdSell:=80;
> MoneyFlowThreshold:=1000000;
> 
> {RoAR Calculation}
> RoaR:=1000*((LinearReg(C,52)-Ref(LinearReg(C,52),-26))/C);
> 
> {Calc Days since the cross over}
> BarsSinceBuy  := BarsSince(Cross(RoAR, ThresholdBuy));
> BarsSinceSell := BarsSince(Cross(ThresholdSell, RoAR));
> RoARValOK:=RoAR>=ThresholdSell And BarsSinceSell>BarsSinceBuy;
> 
> 
> {Calculate the average v * c}
> AvVol:=Mov(V,5,S);
> AvCl:=Mov(C,5,S);
> VCOk:=If(AvVol*AvCl>=MoneyFlowThreshold,1,0);
> 
> If(RoARValOK And VCOk,RoAR,0)





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
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/