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

[EquisMetaStock Group] Re: Need guidance in Building formula



PureBytes Links

Trading Reference Links

Sat,

Seems simple enough, we should be able to simply display an indicator 
sometime in the future. Problem is that using an if statement means 
we would need something else in its place while we are waiting on the 
date. The Gann Hi-Lo was an example of how this was done using one 
display or another.

The restricted display indicators that I wrote displays after the 
fact and only for a designated period of time. There are now three 
versions of the indicator. One based on regular or standard date, 
numerical date, and period of time. So what happens when there is no 
display? You get a NA for a value, which means there was not enough 
data to calculate.

Here is a date version:

{Restricted Display by Date v2.0}
{Written by Preston Umrysh}
{Displays an indicator within specified dates}
{Uses standard date inputs}

{Indicator} {Place your indicator/s here}
Ind:=MACD(); 
Ind2:=Mov(MACD(),9,E);

Sd:=Input("Start Day" ,1,31,1);
Sm:=Input("Start Month",1,12,1);
Sy:=Input("Start Year" ,1980,2015,2003);
Ed:=Input("End Day" ,1,31,31);
Em:=Input("End Month" ,1,12,12);
Ey:=Input("End Year" ,1980,2015,2004);

startdate:=Year()>SY OR 
(Year()=SY AND Month()>SM OR
Month()=SM AND DayOfMonth()>=SD);
enddate:=Year()<EY OR 
(Year()=EY AND Month()< EM OR
Month()=EM AND DayOfMonth()<=ED);

start:=startdate AND Alert(startdate=0,2);
end:=enddate=0 AND Alert(enddate=1,2);

{Restricted Display}
DisPds:=LastValue(Cum(1) - ValueWhen(1,Start,Cum(1)));
BackPds:=LastValue(Cum(1) - ValueWhen(1,End,Cum(1)));
Dispds:=Dispds-BackPds;
ResPds:= Alert(BarsSince(Cum(1)=LastValue(Cum(1)-
(DisPds+BackPds))=1),1);
Plot:=ValueWhen(1,ResPds,Ref(Ref(Ind,-BackPds),BackPds));
Plot2:=ValueWhen(1,ResPds,Ref(Ref(Ind2,-BackPds),BackPds));

Plot; Plot2; 
{end}


Everything that you need to produce your indicator is there. I won't 
restrict the display but will ask the indicator to display some time 
in the future.

Let's try something like this:

{Indicator} 
Ind:=MACD();{Place your indicator/s here} 

Sd:=Input("Start Day" ,1,31,1);
Sm:=Input("Start Month",1,12,1);
Sy:=Input("Start Year" ,1980,2015,2009);

startdate:=Year()>SY OR 
(Year()=SY AND Month()>SM OR
Month()=SM AND DayOfMonth()>=SD);

start:=startdate AND Alert(startdate=0,2);

DisPlay:= ValueWhen(1,Start,Ind);
Display;
{end}


If you compare the indicators you should be able to see the parts of 
the original that I used. Let me know if this is what you had in mind.

Preston


 



--- In equismetastock@xxxxxxxxxxxxxxx, "Sathya" <prassathya@xxx> 
wrote:
>
> Preston,
> how to restricted display with specified priode of future date 
> instead of back time priode. 
> 
> Rgds
> Sat
> --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> wrote:
> >
> > Vishal,
> > 
> > Try this one and see if its anything close to what you are 
looking 
> > for.
> >  
> > This is how it works. 
> > You would like to show the MACD and its trigger for 30 days but 
> > restrict that to a period of 10 days ago.
> > 
> > 
> > {Restricted Display v2.0}
> > {Written by Preston Umrysh}
> > {Correctly Displays an indicator for a specified period of time}
> >  
> > DisPds:=Input("Select Display Periods",1,1111,30);
> > BackPds:=Input("Select Setback Periods",0,1111,10);
> > 
> > {Indicator} {Place your indicator/s here}
> > Ind:=MACD(); 
> > Ind2:=Mov(Macd(),9,E);
> > 
> > {Restricted Display}
> > ResPds:= Alert(BarsSince(Cum(1)=LastValue(Cum(1)-
> > (DisPds+BackPds))=1),1);
> > Plot:=ValueWhen(1,ResPds,Ref(Ref(Ind,-BackPds),BackPds));
> > Plot2:=ValueWhen(1,ResPds,Ref(Ref(Ind2,-BackPds),BackPds));
> > 
> > Plot; Plot2; {end}
> > 
> > 
> > 
> > Hope this helps,
> > 
> > 
> > Preston
> > 
> >  
> >
>



------------------------------------

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/