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

[EquisMetaStock Group] Re: Question regarding periodicity



PureBytes Links

Trading Reference Links

"On re-checking plot (re-activating the Hi: and Lo: formula lines),
 they do not plot ONLY the highest and lowest values WITHIN that
 period (flat lines within periods)."

Lantohsay, with all due respect, you are displaying an inability to 
understand a simple & basic logic:  there is no software in the world 
that can predict future values with 100% accuracy.
A flat line displaying highest/lowest values within that same period 
would have to know in advance the High/Low of that complete period, 
even before the period came to its end.

Perhaps the "Pivots - intraday" indicator formula at
http://www.metastocktools.com/MACDH/Forex.htm
may be of further assistance to you.


"Moreover, because cross and ref functions are used, N/A values
arise at left-end and right-end of chart."

Yes, it's best not to use any forward referencing in MetaStock code.
A few N/A values at the beginning of the chart do not generally pose 
any problem (other than possibly generating some time-consuming 
pedantic obsession) - they have little or no bearing to real-world 
trading.

Lantohsay, I would suggest that you stick to the originally posted 
code to avoid further confusion between the original code and your 
amended versions.


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




--- In equismetastock@xxxxxxxxxxxxxxx, lantohsay <no_reply@xxx> wrote:
>
> On re-checking plot (re-activating the Hi: and Lo: formula lines), 
> they do not plot ONLY the highest and lowest values WITHIN that 
> period (flat lines within periods). 
> 
> Moreover, because cross and ref functions are used, N/A values
> arise at left-end and right-end of chart.  
> 
> (I THOUGHT I could TRUST the formula initially worked out by one 
> called Jose Silva ! )
> 
> (On second thought, I think these were deliberately written !).  
> 
> So,
> Hi:=HighestSince(1,signal,H); {plot the highest value since event; 
> bar '2' could be a highest SINCE event but may not be highest
> within period} Lo:=LowestSince(1,signal,L);
> 
> Become,
> HSince:=HighestSince(1,signal,H);
> Hi:=ValueWhen(1,signal,Ref(HSince,(pds-1)));     {take the last 
> (HighestSince) bar of each period ie. the highest within period}
> LSince:=LowestSince(1,signal,L);
> Lo:=ValueWhen(1,signal,Ref(LSince,(pds-1)));     {take the last 
> (LowestSince) bar of each period ie. the lowest within period}
> 
> As for the N/A values, looking at weekly formulae at the MSTT site 
> (Roy's) might provide some hints (ALERT fn?).
> 
> (As further improvement, the first bar could be made an input 
> parameter instead of rigidly being the first in data set). 
> 
> (note: all formulae have not been fully tested).
> 
> Regards,
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, lantohsay <no_reply@> 
> wrote:
>
> (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@> wrote:
>
> 
> 
> 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









 
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/