in Search

Plotting upper periodicities indicators

Last post 03-05-2007, 5:10 by fredcom_. 8 replies.
Sort Posts: Previous Next
  •  02-23-2007, 3:40 23072

    Plotting upper periodicities indicators

    Hi friends,

    My problem was to plot, in an intraday chart (or daily chart), indicators with upper periodicities.
    I know that there are indicators to plot Close, but I dind't find anything to plot something more complicated like Bollinger Band or other users indicators.

    If you have time, have a look at the 4 indicators below.
    They give the opportunity to plot Open, High, Low and Close in any Periodicity you want (greater than the periodicity basis, of course).
    First, you have to install the Alchan78.dll in your directory :"D:\Program Files\Equis\MetaStock\External Function DLLs" and restart Metastock.

    You can choose between Intraday (from 1 to 60 minutes), Daily, Monthly (from 1 to 12) and Yearly.

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

    {_Reduct_O_combo}
    { **>> _fredcom_ <<** 21fev07 }
    {necessite Alchan78.dll}
    {http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}

    periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
    nb:=Input("nb Minutes or Month, if appropriate ",1,60,1);

    intervI:=Ceiling((Minute()+Hour()*60)/nb);
    intervM:=ceiling(month()/nb);

    keep:=If(periodicity=0,intervI<>ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
    keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
    keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
    keep:=if(periodicity=3,intervM<>ref(intervM,-1),keep);
    keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
    keep2:=Cum(1)>=LastValue(Cum(1)) ;

    Vcomp:=ExtFml( "Alchan78.Select",keep , O);
    vcomp


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


    {_Reduct_H_combo}
    { **>> _fredcom_ <<** 21fev07}
    {necessite Alchan78.dll}
    {http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}

    periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
    nb:=Input("nb Minutes or Month, if appropriate ",1,600,1);

    intervI:=Ceiling((Minute()+Hour()*60)/nb);
    intervM:=Ceiling(Month()/nb);

    keep:=If(periodicity=0,intervI<>Ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
    keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
    keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
    keep:=If(periodicity=3,intervM<>Ref(intervM,-1),keep);
    keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
    keep2:=Cum(1)>=LastValue(Cum(1)) ;

    Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(HighestSince(1,keep,H),-1));
    vcomp:=Ref(vcomp,1);
    vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
    vcomp:=If(keep2,vcomp+HighestSince(1,keep,H),vcomp);
    vcomp

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


    {_Reduct_L_combo}
    { **>> _fredcom_ <<** 21fev07}
    {necessite Alchan78.dll}
    {http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}

    periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
    nb:=Input("nb Minutes or Month, if appropriate ",1,600,1);

    intervI:=Ceiling((Minute()+Hour()*60)/nb);
    intervM:=Ceiling(Month()/nb);

    keep:=If(periodicity=0,intervI<>Ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
    keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
    keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
    keep:=If(periodicity=3,intervM<>Ref(intervM,-1),keep);
    keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
    keep2:=Cum(1)>=LastValue(Cum(1)) ;

    Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(LowestSince(1,keep,L),-1));
    vcomp:=Ref(vcomp,1);
    vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
    vcomp:=If(keep2,vcomp+LowestSince(1,keep,L),vcomp);
    vcomp


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


    {_Reduct_C_combo}
    { **>> _fredcom_ <<** 21fev07}
    {necessite Alchan78.dll}
    {http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}

    periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
    nb:=Input("nb Minutes or Month, if appropriate ",1,600,1);

    intervI:=Ceiling((Minute()+Hour()*60)/nb);
    intervM:=ceiling(month()/nb);

    keep:=If(periodicity=0,intervI<>ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
    keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
    keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
    keep:=if(periodicity=3,intervM<>ref(intervM,-1),keep);
    keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
    keep2:=Cum(1)>=LastValue(Cum(1)) ;

    Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(C,-1));
    vcomp:=Ref(vcomp,1);
    vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
    vcomp:=If(keep2,vcomp+C,vcomp);
    vcomp

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

    For example, if I want to plot, on a 1minute basis, the 60minutes Close with the 20 periods moving average and the Bollinger bands (20 periods,2 deviations), I create the dediate indicators :
    {_Reduct_C60}
    { **>> _fredcom_ <<** 21fev07}
    {necessite Alchan78.dll}
    {http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}

    nb:=60;

    intervI:=Ceiling((Minute()+Hour()*60)/nb);

    keep:=intervI<>Ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1);
    keep2:=Cum(1)>=LastValue(Cum(1)) ;

    Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(C,-1));
    vcomp:=Ref(vcomp,1);
    vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
    vcomp:=If(keep2,vcomp+C,vcomp);
    C60:=vcomp;
    C60;
    Mov(C60,20,S);
    BBandTop(C60, 20,S, 2) ;
    BBandBot(C60, 20,S, 2) ;

    On the next photo, you could see on the left a chart in a 60minutes basis with, on the upper window the close & mov(c,20,s) & Bollband(c,20,2).
    On the right, the chart in a 1 minute basis with on the upper window the C60 Close & mov(C60,20,s) & BollBand(C60,20,s).

     

    Of course, it's usable in the Explorer.


    fred
  •  02-23-2007, 8:48 23078 in reply to 23072

    Re: Plotting upper periodicities indicators

    Fred, the main problem with this external function is that it *compresses* the higher periodicity into the existing data set, rather than *extending* the higher timeframe into the existing data.

    e.g., observe this plot::
    ExtFml( "Alchan78.Condense", C, W);

    Since the compressed data doesn't match the current data dates, there is a total disconnect between the two plots and thus the external function is useless for comparing higher timeframes to the current one. There is little or no difference between this form of data compression and MetaStock's own data compression, so there is no advantage to be found in using this external function for this purpose.

    A minor problem with the daily/weekly/monthly indicator signals is that they won't work properly with incomplete charts - i.e., with missing data.

    You'll find lots of higher timeframe indicators at Roy's site.
    http://www.metastocktips.co.nz/other_formulas.html


    jose '-)
    MetaStockTools.com
  •  02-23-2007, 9:16 23080 in reply to 23078

    Re: Plotting upper periodicities indicators

    Hi jose,

    Yes, datas on upper periodicities are compressed.

    But, if you need now (in real time) the exact value of any indicator, to use it as a filter in the lowest Time unity, it's a way to do it.--> No matter if datas are compressed because  it's only the last value that can be use in an Exploration or an Expert.

    With timeframe indicators at Roy's site, indicators are "limited" to Weekly and Daily. And it's hard to implement every indicators.

    You said : "A minor problem with the daily/weekly/monthly indicator signals is that they won't work properly with incomplete charts - i.e., with missing data. ". --> Try to use my indicator on an intraday timeframe with missing days, and ask it for, say, daily or weekly timeframe. You'll probably have (it works with me) the exact save values as if you ask the same indicator but in daily or Weekly time frame chart.

    I agree that my indicators are not for visual approach but for numeric approach. So it can be complementary to Roy's indicators.

    Perhaps I'm wrong, but it's useful for me.


    fred
  •  02-23-2007, 10:02 23081 in reply to 23080

    Re: Plotting upper periodicities indicators

    Hi Fred,

    This is an interesting Fred.  I notice that there are other usages of the DLL.  Nevertheless, the manual is written in French.  Is there an English translation?

    Sa

  •  02-23-2007, 10:39 23082 in reply to 23081

    Re: Plotting upper periodicities indicators

    Spaceant:

    Hi Fred,

    This is an interesting Fred.  I notice that there are other usages of the DLL.  Nevertheless, the manual is written in French.  Is there an English translation?

    Sa

    At my knowledge, there is no english version of the user manual.

    I'm going to try my best to make a traduction.

    But, be indulgent, beacause I didn't speak english fluently (as you can read in my messages)Wink [;)]


    fred
  •  02-28-2007, 10:26 23137 in reply to 23082

    Re: Plotting upper periodicities indicators

    Thanks for posting this, Fred.

    I've not yet given a try to it but to me it seems as it could be a very very juicy piece of tool... a mousse de chocolat!?! 

    Hoping to have found a valid alternative to TMW*** dll I'd like to ask you just a question: I've read that among the setting figures you've mentioned a period between 1 and 60 minutes... is this a rigid limit or is it possible to go round it with some tricky string? I ask this 'cos I need to visualize some 4H indicators in  15/60min charts... actually they are just higher-TF entry/stop price levels and some expert trend ribbon/symbols.

    Anyway this is a great work and I thank you again for posting.

    gabibbo

    ps: yes a translation in English should be of the great help... I'm thinking of using babel(altavista) translator for now... I've seen it shows even the French-Italian option, that's great!  

     

     

    *** this one should be still uploaded in the beta section IMHO... I've had great problems with it (never got it working)

     

  •  03-05-2007, 4:23 23228 in reply to 23137

    Re: Plotting upper periodicities indicators

    gabibbo:

    ...

    Hoping to have found a valid alternative to TMW*** dll I'd like to ask you just a question: I've read that among the setting figures you've mentioned a period between 1 and 60 minutes... is this a rigid limit or is it possible to go round it with some tricky string? I ask this 'cos I need to visualize some 4H indicators in  15/60min charts... actually they are just higher-TF entry/stop price levels and some expert trend ribbon/symbols.

    ...

    Hi,

    thanks for your message and for the "mousse de chocolat"Wink [;)]

    I didn't try timeframe greater than 60 minutes because my Metastock (Pro V8.0) cannot display timeframe greater than this 60 minutes. So I cannot check if the indicator with a 240 minutes input  has the exactly same values as a real 240minutes...

    But, you can try and you just have to enter 240 for the "nb" value in the indicator.

    Good trades.


    fred
  •  03-05-2007, 4:29 23229 in reply to 23082

    Re: Plotting upper periodicities indicators

    Hi,

    you can find a translation in english of the french user manual at :

    http://membres.lycos.fr/hostfiles/DLL_Alchan78_english.doc or http://hostfiles.site.voila.fr/DLL_Alchan78_english.doc

    Great thanks to Lance and Michel (a canadian trader) who made the translation.

    Hope this can help the Metastock community.Stick out tongue [:P]

     


    fred
  •  03-05-2007, 5:10 23230 in reply to 23072

    Re: Plotting upper periodicities indicators

    Another way to use Alchan78.dll

    Say you want to have the exact value of a Weekly Parabolic SAR (not only the SAR on the Close , but with High and Low) on a daily chart.It's easy. Just open 2 windows of the same stock, one in Weekly , one in Daily.On the Weekly chart, insert this indicator:

    {W_SAR_out}

    {fredcom/01-09-2005}

    Wz:=ExtFml("Alchan78.WriteData","C:\\Temp\\W_Sar.out",SAR(0.02,0.2));

    Wz

    and then, on the Daily chart, insert this indicator :

    {W_SAR_in}

    Ylu:=0;

    {fredcom/01-09-2005}

    z:=LastValue(Cum(1));

    wres:= ExtFml( "Alchan78.ReadData", "C:\\Temp\\W_SAR.out") ;

    wrez:=If(wres<>0,wres,PREV);

    wrez

    The result is (left Weekly chart, right Daily chart):

    If the two charts are in the same Layout, it's possible to switch with any stocks in the directory and have instantatly the Weekly Parabolic SAR on the Daily Chart.

     


    fred
View as RSS news feed in XML