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

[amibroker] Re: Relative Indicator Values



PureBytes Links

Trading Reference Links

Tomasz,
I will agree now.
The solution you provide here [OHLCV substitution in fact] is much 
better than the analytic one you provided at
http://groups.yahoo.com/group/amibroker/message/40009
and does not need deeper indicator formula understanding.
Of course, it is always better to know full details, but it does not 
match to all users preferences.
It wouldn΄t be bad to add this general example in some next Users 
Guide, it may solve the majority of comparison problems.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Dimitris,
> 
> My role on this list is to show possibly the best ways
> to use AmiBroker. So I provided the sample code
> using functions that is in my opinion the best solution
> for given problem.
> Your AddToComposite-based code is very appreciated
> and obviously nice example of 'what can be done'
> but I try to focus on optimum solutions.
> I provide the code for the user who asked for this and
> I have no intention to hurt anyones ego.
> 
> Now to the subject:
> 
> User defined function has one MAJOR advantage:
> it is REUSABLE.
> 
> You write function ONCE, place it in common.afl
> and include it via #include command in any place you wish.
> 
> You gain:
> - better organization - write ONCE use MANY TIMES
> - much shorter and clearer code
> - no-need to copy/paste
> - no need to pre-scan (required AddToComposite)
> 
> Once you define function it becomes as easy to use
> as any built-in function.
> 
> As to your second concern about abilty to use any
> AFL function that way it is very easy:
> 
> /* WRITE ONCE */
>  function ForeignADX( symbol, period )
>  {
>   /* save original price arrays */
>   SC = C;
>   SO = O;
>   SH = H;
>   SL = L;
> 
>   C = Foreign( symbol, "C" );
>   H = Foreign( symbol, "H" );
>   L = Foreign( symbol, "L" );
>   O = Foreign( symbol, "O" );
> 
>   Result = ADX( period ); // REPLACE THIS BY ANY AFL FUNCTION
> 
>   /* restore original arrays */
>   C = SC;
>   O = SO;
>   H = SH;
>   L = SL;
> 
>   return Result;
>  }
> 
> 
> /* USE MANY TIMES */
> 
> Plot( ForeignADX( "MSFT", 14 ), "ADX MSFT", colorRed );
> 
>  Plot( ForeignADX( "IBM", 14 ), "ADX IBM", colorBlue );
> 
>  Plot( ForeignADX( "AAPL", 14 ), "ADX AAPL", colorGreen );
> 
> Plot( ForeignADX( "NVDA", 14 ), "ADX NVDA", colorGreen );
> 
> Plot( ForeignADX( "AMD", 14 ), "ADX AMD", colorGreen );
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, May 09, 2003 8:46 AM
> Subject: [amibroker] Re: Relative Indicator Values
> 
> 
> Tomasz,
> My intention was to present an [interesting IMO] AddToComposite()
> application, to show  "what can be done".
> I did not claim it was the shortest way to Rome.
> BTW, in your code you need the analytic definition of Stochastic
> functions .
> [do you consider it easily available to a user ? I love the
> definitions but, many messages in this list will not agree]
> I am not sure if people have an easy reference to the analytic
> definition for ANY AFL built-in function.
> Just some examples : accdist(), adx( ), chaikin(  ), mfi( ).
> Much more, who knows if adx(), for example, is a function of C or H
> or L or V or a combination ?
> You also suppose a user familiar to T/A anlytic expressions, ie an
> advanced user.
> [I do not have the same experience from the messages of this list]
> And, of course, I knew a quite simple solution without 
AddToComposite
> () or Function() or analytic definition use before posting
> this contribution.
> Just replace all HLCV arrays, redefine them at the end and thatīs 
it.
> H1=H;L1=L;C1=C;V1=V;
> N="^NDX";H=Foreign(N,"H");L=Foreign(N,"L");C=Foreign(N,"C");
> StochDNDX=StochD();
> N="MSFT";H=Foreign(N,"H");L=Foreign(N,"L");C=Foreign(N,"C");
> StochDMSFT=StochD();
> N="INTC";H=Foreign(N,"H");L=Foreign(N,"L");C=Foreign(N,"C");
> StochDINTC=StochD();
> Plot(StochDNDX,"^NDX",4,1);Plot(StochDMSFT,"MSFT",1,1);Plot
> (StochDINTC,"INTC",2,1);
> H=H1;L=L1;C=C1;V=V1;
> Plot(StochD(),Name(),7,2);
> Thank you for the interesting Function() example.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
> wrote:
> > Hello,
> >
> > Much easier to use (not requiring any pre-scan) and less resource
> consuming is
> > ( AB 4.33 or higher )
> >
> > function ForeignStochD( symbol, Kperiod, Dperiod )
> > {
> >  FC = Foreign( symbol, "C" );
> >  FH = Foreign( symbol, "H" );
> >  FL = Foreign( symbol, "L" );
> >
> >  FASTSTOCHK = 100*(FC-LLV(FC,kPeriod))/(HHV(FH,kPeriod)-LLV
> (FL,kPeriod));
> >  SLOWSTOCHK = MA( FastStochK, Dperiod );
> >  SLOWSTOCHD = MA( SLOWSTOCHK, Dperiod );
> >  return SLOWSTOCHD;
> > }
> >
> > Plot( ForeignStochD( "MSFT", 14, 3 ), "Stoch MSFT", colorRed );
> >
> > Plot( ForeignStochD( "IBM", 14, 3 ), "Stoch MSFT", colorBlue );
> >
> > Plot( ForeignStochD( "AAPL", 14, 3 ), "Stoch MSFT", colorGreen );
> >
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Thursday, May 08, 2003 10:04 PM
> > Subject: [amibroker] Relative Indicator Values
> >
> >
> > > To compare indicator X values with some reference stocks, run in
> AA
> > > the
> > >
> > > X=StochD();
> > > AddToComposite(X,"~StochD"+Name(),"C");
> > > Buy=0;
> > >
> > > All individual Stochastics are now separate tickers
> > > ~StochD^NDX
> > > ~StochDAAPL
> > > ~StochDMSFT
> > > etc.
> > > In IB paste
> > >
> > > Plot(Foreign("~StochD^NDX","C"),"^NDX",4,8);
> > > Plot(Foreign("~StochDMSFT","C"),"MSFT",1,1);
> > > Plot(Foreign("~StochDINTC","C"),"INTC",2,1);
> > > Plot(Foreign("~StochD"+Name(),"C"),Name(),7,2);
> > >
> > > to compare each stock StochD with the 3 references ^NDX, MSFT,
> INTC.
> > >
> > > X may be any complicated function. Just place
> > >
> > > X=myFunction;
> > > AddToComposite(X,"~myFunctionName"+Name(),"C");
> > > Buy=0;
> > >
> > > Dimitris Tsokakis
> > >
> > >
> > >
> > > Send BUG REPORTS to bugs@xxxx
> > > Send SUGGESTIONS to suggest@xxxx
> > > -----------------------------------------
> > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > --------------------------------------------
> > > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/