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

[EquisMetaStock Group] Re: Question regarding periodicity



PureBytes Links

Trading Reference Links

(Ignored message if there's an earlier reply).

Dear Jose,

Op:=ValueWhen(1,signal,O);
would return the Open when signal is true ie. of the last bar of the 
PREVIOUS period.  
[If plotted, it looks correct because the segmentation is right but 
actual bar count from start  is (-1)   ]. 
[Assumed that bar 1 is the beginning of data set]. 

And,
Cl:=ValueWhen(1,signal,Ref(C,-1));  
would be the (close - 1bar) ie. of the previous (of PREVIOUS) 
period.  

???
1)The signal should start +1bar after being true. 
2) Cl: should be forward referenced.

So,
signal:=Mod(Ref(Cum(1),-1),pds)=0;
Cl:=ValueWhen(1,signal,Ref(C,pds-1));  

From,
humble

--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" 
<josesilva22@xxx> wrote:
>
> Excellent work, Bellamy - I didn't see that simplicity when I 
> originally put the code together.
> 
> 
> MetaStock -> Tools -> Indicator Builder -> New
> -> copy & paste complete formulae below.
> 
> ==================================
> Periodicity marker and OHLC values
> ==================================
> ---8<-------------------------------
> 
> { Signals Nth bar periodicity - v2.2
> 
>  ©Copyright 2004~2006 Jose Silva.
>   The grant of this license is for personal use
>    only - no resale or repackaging allowed.
>   All code remains the property of Jose Silva.
>   http://www.metastocktools.com }
> 
> { User inputs }
> pds:=Input("Nth bar periodicity",1,252,21);
> plot:=Input("plot:  [1]Signals,  [2]OHLC",
>  1,2,1);
> 
> { Nth bar signals }
> signal:=Mod(Cum(1),pds)=0;
> 
> { Nth bar OHLC values }
> Op:=ValueWhen(1,signal,O);
> Hi:=HighestSince(1,signal,H);
> Lo:=LowestSince(1,signal,L);
> Cl:=ValueWhen(1,signal,Ref(C,-1));
> 
> { Plot signals in own window;
>    plot OHLC values on chart }
> If(plot=1,0,Op);     { Green }
> If(plot=1,0,Hi);     { Blue  }
> If(plot=1,0,Lo);     { Red   }
> If(plot=1,signal,Cl) { Black }
> 
> ---8<-------------------------------
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, 
> "bellamy_29m" <bellamy_29m@> wrote:
> >
> > Jose Silva <josesilva22@> wrote:
> > 
> > > pds:=Input("Nth bar periodicity",1,252,21)/2;
> > > signal:=Mod(Cum(1)/pds,2)=0;
> > 
> > 
> > Jose,
> > Can this be simplified?  I don't quite understand what you are
> > trying to do?  Isn't this the same?
> > 
> > pds:=Input("Nth bar periodicity",1,252,21);
> > signal:=Mod(Cum(1),pds)=0;
> > 
> > 
> > ?? or am I missing something ??
>









 
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/