PureBytes Links
Trading Reference Links
|
Tomasz,
see, please, below.
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
> Dimitris,
>
> MACD( x, y ) depends only on last X + Y bars.
> You can safely assume that if X and Y are relatively
> small (12+26 for example) you have that many bars
> for all symbols in your database.
>
> Equity is different because by default it uses all
> quotes. Now if you use SetForeign it will return
> only as many bars as there are in CURRENT symbol
> see foreign explanation:
http://www.amibroker.com/guide/afl/afl_view.php?name=FOREIGN
>
> Now if each symbol in your database has DIFFERENT
> number of bars then you will get different values of equity
> because they will be calculated from different number of bars.
All 101 symbols have 943 bars.
All symbols begin the 3/1/2000 and are updated up to 3/10/2003.
My Plot(Foreign("~COUNT","V"),"",1,1); is absolutely flat horizontal
at 101 for all quotations.
No other ticker is in the holy group254.
I didnīt notice *any* problem for MACD(200,300) or MACD(10,500).
So, there should be another reason, because the modified
function select( listnum )
{
list = GetCategorySymbols( categoryGroup, listnum );
Rank = 0;
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign(SYM);
global Buy;
global Sell;
Buy=Cross(StochD(),30);Sell=Cross(50,StochD());
E1=Equity(0,1,100);
f=LastValue(E1);
Rank[BarCount-1-i] = f;
}
return Rank ;
}
No=254;
R= Select(No);H0=Select(No);G=0;
Plot(H0,"",2,2);
equally suffers from the same problem. The plot is not universal
and changes from stock to stock.
> Solution? You may calculate equity not from ALL bars
> but only from N-last bars:
http://www.amibroker.com/guide/afl/afl_view.php?name=EQUITY
> E1=Equity(0, 1, 100 );
But, this Equity(0, 1, 100 ), if I understand well, will give me the
result of the last 100 bars trading. I want the Lastvalue(Equity())
for all existing data.
> If you have no data holes in last 100 bars you will get the same
results
> on any ticker.
No, there are no holes at all and the results change from ticker to
ticker.
More confused now...
Dimitris Tsokakis
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, October 07, 2003 11:22 AM
> Subject: [amibroker] Re: The top10 ROC(C,1)
>
>
> > Tomasz,
> > thank you for your reply.
> > The situation now became very complicated.
> > The results change from ticker to ticker !!
> > [the same with the top5, it is different from ticker to ticker]
> >
> >
> > // SELECT LAST EQUITY() VALUE
> > function select( listnum )
> > {
> > list = GetCategorySymbols( categoryGroup, listnum );
> > Rank = 0;
> > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > {
> > SetForeign(SYM);
> > global Buy;
> > global Sell;
> > Buy=Cross(StochD(),30);Sell=Cross(50,StochD());E1=Equity();
> > f=LastValue(E1);
> > Rank[BarCount-1-i] = f;
> > }
> > return Rank ;
> > }
> > No=254;
> > R= Select(No);H0=Select(No);
> > Plot(H0,"",2,2);
> >
> > On the other side, the
> >
> > // SELECT THE LAST MACD() VALUE
> > function select( listnum )
> > {
> > list = GetCategorySymbols( categoryGroup, listnum );
> > Rank = 0;
> > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > {
> > SetForeign(SYM);
> > f=LastValue(MACD());
> > Rank[BarCount-1-i] = f;
> > }
> > return Rank ;
> > }
> > No=254;
> > R= Select(No);H0=Select(No);
> > Plot(H0,"",2,2);
> >
> > is perfect. It plots the MACD() of the last bar and [as expected]
is
> > the same graph for any selected ticker.
> > Totally confused...
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
<amibroker@xxxx>
> > wrote:
> > > Hello,
> > >
> > > No, Equity works well too inside functions BUT.. you
> > > have to ensure that Buy/Sell/... BuyPrice/ ... variables used
> > inside function
> > > are declared as GLOBAL. This is so because Equity uses global
> > buy/sell
> > > variables to evaluate results.
> > >
> > > function BlahBlah()
> > > {
> > > global Buy;
> > > global Sell;
> > >
> > > Buy = ...
> > > Sel = ...
> > >
> > > e = Equity();
> > >
> > > ...
> > > }
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message -----
> > > From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Tuesday, October 07, 2003 8:09 AM
> > > Subject: [amibroker] Re: The top10 ROC(C,1)
> > >
> > >
> > > > Tomasz,
> > > > thank you for your comments, but, I was expecting a similar
> > behavior
> > > > with Equity() function.
> > > > As you see at
> > > > http://groups.yahoo.com/group/amibroker/message/49275
> > > > this attempt failed.
> > > > I can not explain it.
> > > > Equity() function worked properly inside loops, for example,
the
> > > > for(k=30;k<50;k=k+5)
> > > > {
> > > > Buy=Cross(RSI(),k);Sell=Cross(50,RSI());z1=Equity(1,0);
> > > > Plot(z1,"",1,1);
> > > > }
> > > > gives the expected result.
> > > > Is there any problem when we use Equity() inside a Function ?
> > > > TIA
> > > > Dimitris Tsokakis
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> > <amibroker@xxxx>
> > > > wrote:
> > > > > Dimitris,
> > > > >
> > > > > Your AFL coding is poetry !
> > > > > Thanks for showing the power of AFL.
> > > > >
> > > > > Best regards,
> > > > > Tomasz Janeczko
> > > > > amibroker.com
> > > > > ----- Original Message -----
> > > > > From: Dimitris Tsokakis
> > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > > Sent: Saturday, October 04, 2003 11:26 PM
> > > > > Subject: [amibroker] The top10 ROC(C,1)
> > > > >
> > > > >
> > > > > Hypothesis :
> > > > > *My Nasdaq100 stocks are placed in Group254.
> > > > > *They are 101, the 100 stocks and the index ^NDX.
> > > > > *They are absolutely aligned, they begin from the same
date
> > and
> > > > include the same bars.
> > > > > Question :
> > > > > The top10 last day ROCs.
> > > > > The idea :
> > > > > I will read the 101 ROC values for the last day and then
I
> > will
> > > > place them as the last 101 elements of an artificial array H0.
> > > > > Then, I will search for the highest value.
> > > > > As soon as it is detected and localised in detail, in the
> > very
> > > > next step it will be replaced by -1000 .
> > > > > In the new search the 2nd highest will be detected etc.
> > > > > There is an internal loop counter to give the rank #
> > > > > A solution :
> > > > > There is no need for any exploration.
> > > > > In indicator builder window paste the
> > > > >
> > > > > // Top10 ROCs
> > > > > function naming( listnum,ORdNo )
> > > > > {
> > > > > list = GetCategorySymbols( categoryGroup, listnum );
> > > > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > > > {
> > > > > if(i==ORdno)
> > > > > {
> > > > > n1=sym;
> > > > > }
> > > > > }
> > > > > return n1 ;
> > > > > }
> > > > > function select( listnum )
> > > > > {
> > > > > list = GetCategorySymbols( categoryGroup, listnum );
> > > > > Rank = 0;
> > > > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > > > {
> > > > > C1 = Foreign( sym, "C" );
> > > > > f=LastValue(ROC(C1,1));
> > > > > Rank[BarCount-1-i] = f[i];
> > > > > }
> > > > > return Rank ;
> > > > > }
> > > > > No=254;// my N100 database is in Group254
> > > > > R= Select(No);H0=Select(No);G=0;
> > > > > Plot(H0,"",2,2);
> > > > > G0=0;
> > > > > L1=LastValue(Cum(1));
> > > > > N=101;// the population of my database
> > > > > TOP=10;// 10 may change from 1 to 101
> > > > > Counter=0;Title="Top10 ROC"+"\n";
> > > > > for(K=1;K<=TOP;K++)
> > > > > {
> > > > > H1=LastValue(HHV(H0,n));
> > > > > BAR1=LastValue((ValueWhen(H0==H1,Cum(1)-1)));
> > > > > H0[BAR1]=-1000;
> > > > > Counter=Counter+1;
> > > > > G0[L1-CountER]=-H1;
> > > > > shape=IIf(Counter==1,shapeDigit1,
> > > > > IIf(Counter==2 ,shapeDigit2,
> > > > > IIf(Counter==3 ,shapeDigit3,
> > > > > IIf(Counter==4 ,shapeDigit4,
> > > > > IIf(Counter==5 ,shapeDigit5,
> > > > > IIf(Counter==6 ,shapeDigit6,
> > > > > IIf(Counter==7 ,shapeDigit7,
> > > > > IIf(Counter==8 ,shapeDigit8,
> > > > > IIf(Counter==9 ,shapeDigit9,
> > > > > shapeDigit0)))))))));
> > > > > PlotShapes((Cum(1)==bar1+1)*shape,Counter,0,Graph0,5);
> > > > > Title=Title+WriteVal(Counter,1.0)+")"+WriteVal(H1)+ "
> > ["+WriteVal
> > > > (L1-bar1-1,1.0)+"-"+naming(254,L1-bar1-1)+"]"+ "\n";
> > > > > }
> > > > > Plot((Cum(1)>L1-N)*R,"",(H0==-10)*6+1,2);
> > > > > Plot(0,"",1,1);
> > > > > GraphXSpace=3;
> > > > >
> > > > > and you will have all related info.
> > > > > The ROC magnitudes, for a useful visual outline at a
glance,
> > the
> > > > top10 ROCs, the values, the ordinal No of the stocks, the
names,
> > > > everything.
> > > > > The graph and its info is unique, it will remain the same
> > when
> > > > you move from ticker to ticker and will change by the next
EOD
> > update.
> > > > > A similar procedure may give the bottom10 stocks.
> > > > > Ranking questions for an individual stock, indicators
arrays
> > for
> > > > individuals or the whole WatchList/Group etc have clear and
quick
> > > > solutions
> > > > > thanks to the great GetCategorySymbols() function.
> > > > > The rest is looping tricks of a non-programmer and it is
> > better
> > > > to make an indulgent criticism...
> > > > > Dimitris Tsokakis
> > > > >
> > > > > Yahoo! Groups Sponsor
> > > > > ADVERTISEMENT
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 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 the Yahoo! Terms
of
> > > > Service.
> > > >
> > > >
> > > >
> > > > 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 ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/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/
|