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

[EquisMetaStock Group] Problems with BarsSince()



PureBytes Links

Trading Reference Links

I'd be grateful for any help with BarsSince() in the following 
formula fragment.

Regards,
Alan


{-----------------------------------}
....
....
R; {MACD}
Z; {Signal} {end of Roy's stuff}
Hist:=(R-Z); {Histogram}
Hist;
{1}Buy:=ROC(Hist,1,POINTS)>0 AND Hist<0;
{2}Sell:=ROC(Hist,1,POINTS)<0 AND Hist>0;
{3}{If(Buy,1,0);}
{4}If((Buy AND (BarsSince(Buy)>BarsSince(Sell))),1,0);
{5}{If(Sell,-1,0);}
{6}If((Sell AND (BarsSince(Sell)>BarsSince(Buy))),-1,0);
{-----------------------------------}

Explanation:
{1} Buy if histogram ticks up from below its centreline.
{2} Sell if histogram ticks down from above its centre line.
{3}(Commented out.) Plot the buy trigger .  This worked fine, but as 
long as the histogram is oscillating below its centre line, it 
continues to give buy signals on each up-tick.
{4} This is my attempt. I thought it said: "Buy if histogram ticks up 
from below its centreline AND the previous buy/sell signal was a 
sell." In other words, if the previous signal was a buy, don't add to 
the position.  This doesn't work.  The plot is a horizontal line at 
Y=0 (the histogram centre line).
{5} (Commented out.)  Again, this worked fine, but could give 
multiple contiguous sell signals.
{6} Similar to {4}.




 
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/