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

[EquisMetaStock Group] Re: Need help in coding a reference to High/Low of previous bar



PureBytes Links

Trading Reference Links

Try this:

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

{ User inputs }
pdsIn:=Input("Entry SMA periods",2,252,50);
pdsEx:=Input("Exit SMA periods",2,252,50);
plot:=Input("plot:  [1]Signals,  [2]UpTrends",
 1,2,1);

{ UpTrend flags }
In:=C>Mov(C,pdsIn,S);
Ex:=C<Mov(C,pdsEx,S);
Init:=Cum(In+Ex>-1)=1;
flag:=BarsSince(Init OR In)
 <BarsSince(Init OR Ex)+(Cum(In)=1);
flagStart:=flag AND Alert(flag=0,2);

{ Highest in UpTrend flags }
HighestCurrent:=HighestSince(1,flagStart,H);
HighestPrev:=HighestSince(2,flagStart,H);
signals:=HighestCurrent>=HighestPrev AND flag;

{ Plot in own window }
If(plot=1,signals,flag)

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


jose '-)



--- In equismetastock@xxxxxxxxxxxxxxx, "gogobuddy888" <gogobuddy888@xx
..> wrote:
> bellamy_29m:
> 
> i think you didn't get my question right.
> 
> you can imagine i divide it into two regions, one is Bullish where 
C>
> (MOV,50,S) and another regions which is Bearish is C<(MOV,50,S).
> 
> say today, the region change from Bearish to Bullish Region where 
> where C>(MOV,50,S). But I also want the High of this current bar, is 
> Higher than the High of the previous Bullish Region, which could 
> occured 100bars ago. I hope everyone get what I try to address here.
> 
> How can I code this?
> 
> Thank you.
> 
> - Stanley
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "bellamy_29m" 
> <bellamy_29m@xxxx> wrote:
> > Have a look throught the Users manual for the Ref() function.  
> This 
> > will help you out with your query.
> > 
> > To answer your question for you, you can do what are trying to 
> > achieve a number of ways:
> > 
> > This way will achieve you aim, bit is a little clumsy and doesn't 
> > look that neat:
> > ref(c,-1)>ref(mov(c,50,s),-1) and c>mov(c,50,s)
> > 
> > whereas this is a little neater:
> > x:=c>mov(c,50,s);
> > x and ref(x=1,-1)
> > 
> > Have a good read, also, of the Equis Formula Primer...
> > 
> > Hope this helps.
> > 
> > wabbit
> > 
> > <snip>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/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/