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

[amibroker] Re: The top10 ROC(C,1)



PureBytes Links

Trading Reference Links

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/ 
> > 
> > 
> >


------------------------ 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/