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

Re: [amibroker] NO WAY [Was]: New Variable Class



PureBytes Links

Trading Reference Links




Ken,
 
You are welcome. Just note that code I provided re-ranks every 
bar. You can easily modify it
to perform ranking/sorting only on bars of your choice, and of 
course perform
other type of calculations.  This is one of the possible 
solutions, Dimitris may probably come up with something better :-)
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Ken Close 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, November 07, 2003 3:30 
  PM
  Subject: RE: [amibroker] NO WAY [Was]: 
  New Variable Class
  
  
  <SPAN 
  >Tomasz: thank you 
  very much for the &#8220;hints&#8221;.  This looks like way more than &#8220;hints&#8221;, but I 
  shall dive in and see what I can do with it.
  <SPAN 
  > 
  <SPAN 
  >Many thanks for 
  now.  I will report back.
  <SPAN 
  > 
  <SPAN 
  >Ken
  <SPAN 
  > 
  <SPAN 
  >-----Original 
  Message-----From: Tomasz 
  Janeczko [mailto:amibroker@xxxxxx] <SPAN 
  >Sent: Friday, November 07, 2003 9:00 
  AMTo: <A 
  href="">amibroker@xxxxxxxxxxxxxxx<SPAN 
  >Subject: Re: [amibroker] NO WAY [Was]: 
  New Variable Class
  <SPAN 
  > 
  
  <SPAN 
  >Ken,
  
  <SPAN 
  > 
  
  <SPAN 
  >As for hints: you would do the 
  following:
  
  <SPAN 
  >1. iterate through watch list and store scores (in 
  case of osaka plugin osTabSetNumber)
  
  <SPAN 
  >2. find top ranked symbols (this can be done even 
  entriely in AFL as Dimitris has shown,
  
  <SPAN 
  >or using Osaka plugin sort capability - osTabSort 
  function)
  
  <SPAN 
  >3. create average from top ranked symbols. 
  
  
  <SPAN 
  > 
  
  <SPAN 
  >Below is the code that uses Osaka plugin 1.4. 
  
  
  <SPAN 
  > 
  
  <SPAN 
  >osInitialize<FONT 
  face="Courier New" color=black size=1><SPAN 
  >();
  <SPAN 
  > 
  <SPAN 
  >List = 
  <SPAN 
  >GetCategorySymbols<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(<SPAN 
  >categoryGroup, <FONT 
  face="Courier New" color=fuchsia size=1><SPAN 
  >254<FONT 
  face="Courier New" color=black size=1><SPAN 
  > ); 
  <SPAN 
  >// <-- 
  change wl number here
  <SPAN 
  >table=<FONT 
  face="Courier New" color=blue size=1><SPAN 
  >osTabCreate<FONT 
  face="Courier New" color=black size=1><SPAN 
  >();
  <SPAN 
  > 
  <SPAN 
  >// setup 
  columns
  <SPAN 
  >osTabAddColumn<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( 
  <SPAN 
  >"Ticker"<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, 
  <SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table, 
  <SPAN 
  >25<FONT 
  face="Courier New" color=black size=1><SPAN 
  > 
  );
  <SPAN 
  >for<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( j = 
  <SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; j < 
  BarCount; j++ 
)
  <SPAN 
  >{
  <SPAN 
  >  
  <SPAN 
  >osTabAddColumn<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( 
  <SPAN 
  >"Score"<FONT 
  face="Courier New" color=black size=1><SPAN 
  >+j, 
  <SPAN 
  >1<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table 
  );
  <SPAN 
  >  
  <SPAN 
  >osTabAddColumn<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( 
  <SPAN 
  >"Close"<FONT 
  face="Courier New" color=black size=1><SPAN 
  >+j, 
  <SPAN 
  >1<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table 
  );
  <SPAN 
  >}
  <SPAN 
  > 
  <SPAN 
  >// 
  CALCULATING SCORES and saving them to the table
  <SPAN 
  >for<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(i=<FONT 
  face="Courier New" color=fuchsia size=1><SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; ( ticker = 
  <SPAN 
  >StrExtract<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( List, i ) ) 
  != <SPAN 
  >""<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; 
  i++)
  <SPAN 
  >{
  <SPAN 
  > <FONT 
  face="Courier New" color=blue size=1><SPAN 
  >SetForeign<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(ticker);
  <SPAN 
  >  
  
  <SPAN 
  >  
  <SPAN 
  >osTabSetString<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( ticker, i, 
  <SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table 
  );
  <SPAN 
  >  
  
  <SPAN 
  > score = 
  <SPAN 
  >50<FONT 
  face="Courier New" color=black size=1><SPAN 
  >- 
  <SPAN 
  >RSI<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(); 
  <SPAN 
  >// YOUR SCORE 
  CALCULATION HERE !!!!
  <SPAN 
  > 
  <SPAN 
  > <FONT 
  face="Courier New" color=maroon size=1><SPAN 
  >for<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( j = 
  <SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; j < 
  BarCount; j++)
  <SPAN 
  > {
  <SPAN 
  >   
  <SPAN 
  >osTabSetNumber<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( 
  <SPAN 
  >abs<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( 
  <SPAN 
  >Nz<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( score[ j ] 
  ) ), i, <SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  > * j + 
  <SPAN 
  >1<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table 
  );
  <SPAN 
  >   
  <SPAN 
  >osTabSetNumber<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( <SPAN 
  >Close[ j ], i, <FONT 
  face="Courier New" color=fuchsia size=1><SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  > * j + 
  <SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table ); 
  <SPAN 
  >// for 
  calculation of average
  <SPAN 
  > }
  <SPAN 
  >}
  <SPAN 
  > 
  <SPAN 
  >// you can 
  export for debugging
  <SPAN 
  >//osTabExport( 
  "test.csv", ",", table );
  <SPAN 
  > 
  <SPAN 
  > 
  <SPAN 
  >// SORTING 
  SCORES AND finding top ranks:
  <SPAN 
  >average = 
  <SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; 
  <SPAN 
  >// init 
  avarage
  <SPAN 
  > 
  <SPAN 
  >for<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( j = 
  <SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; j < 
  BarCount; j++)
  <SPAN 
  >{
  <SPAN 
  >   
  <SPAN 
  >osTabSort<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( table, 
  <SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  > * j + 
  <SPAN 
  >1<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, <SPAN 
  >False );
  <SPAN 
  >    
  average[ j ] = <FONT face="Courier New" color=fuchsia 
  size=1><SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >;
  <SPAN 
  >    
  topnum = <SPAN 
  >10<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; 
  <SPAN 
  >// change 
  this iterate throgh other number than top-10  
  <SPAN 
  >    
  <SPAN 
  >for<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( k = 
  <SPAN 
  >0<FONT 
  face="Courier New" color=black size=1><SPAN 
  >; k < 
  topnum ; k++ ) <SPAN 
  >// 
  
  <SPAN 
  >    
  {
  <SPAN 
  >              
  fc = <SPAN 
  >osTabGet<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( k, 
  <SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  > * j + 
  <SPAN 
  >2<FONT 
  face="Courier New" color=black size=1><SPAN 
  >, table ); 
  
  <SPAN 
  >       
  average[ j ] = average[ j ] + fc;
  <SPAN 
  >    
  }
  <SPAN 
  >    
  
  <SPAN 
  >    
  average[ j ] = average[ j ]/topnum; <FONT face="Courier New" 
  color=green size=1><SPAN 
  >// calculate 
  average from top N symbols at given bar
  <SPAN 
  >    
  
  <SPAN 
  >}
  <SPAN 
  > 
  <SPAN 
  >osTabDelete<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( table 
  );
  <SPAN 
  > 
  <SPAN 
  >Filter<FONT 
  face="Courier New" color=black size=1><SPAN 
  >=<FONT 
  face="Courier New" color=fuchsia size=1><SPAN 
  >1<FONT 
  face="Courier New" color=black size=1><SPAN 
  >;
  <SPAN 
  >AddColumn<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(average, 
  <SPAN 
  >"AVG top10 
  (each bar different)"<FONT face="Courier New" color=black 
  size=1> 
  ); 
  <SPAN 
  >Plot<FONT 
  face="Courier New" color=black size=1><SPAN 
  >( average, 
  <SPAN 
  >"AVG top10 
  (each bar different)"<FONT face="Courier New" color=black 
  size=1><SPAN 
  >, <SPAN 
  >colorRed );<FONT 
  face="Courier New" size=2><SPAN 
  > 
  
  <SPAN 
  > 
  
  <SPAN 
  >Best regards,Tomasz 
  Janeczkoamibroker.com
  
  <SPAN 
  >----- Original Message ----- 
  
  <SPAN 
  >From: "Ken Close" <<A 
  href=""><SPAN 
  >closeks@xxxxxxxx<SPAN 
  >>
  
  <SPAN 
  >To: <<A 
  href=""><SPAN 
  >amibroker@xxxxxxxxxxxxxxx<FONT 
  size=2>>
  
  <SPAN 
  >Sent: Friday, November 07, 2003 1:50 
  PM
  
  <SPAN 
  >Subject: RE: [amibroker] NO WAY [Was]: New Variable 
  Class
  
  <SPAN 
  > 
  <SPAN 
  >Tomasz:Of course.  As usual you are 
  correct.  I knew it.  I am trying toprovoke/seek some more help 
  (not do it for me but point me in the rightdirection with some 
  hints/help).Ken-----Original Message-----From: Tomasz 
  Janeczko [mailto:amibroker@xxxxxx] Sent: Friday, November 07, 2003 7:39 
  AMTo: <FONT 
  size=2><SPAN 
  >amibroker@xxxxxxxxxxxxxxx<FONT 
  size=2>Subject: Re: [amibroker] NO WAY [Was]: 
  New Variable ClassKen,There is a huge difference 
  between:A. "not possible"B. "not possible by someone with my level of 
  exprerience"Your problem falls under B.Telling that something 
  is not possible in AFL is almost equivalentto saying that it is not 
  possible to write it at all (in any language).Best regards,Tomasz 
  Janeczkoamibroker.com----- Original Message ----- From: "Ken 
  Close" <<SPAN 
  >closeks@xxxxxxxx<SPAN 
  >>To: <<A 
  href=""><SPAN 
  >amibroker@xxxxxxxxxxxxxxx<FONT 
  size=2>>Sent: Friday, November 07, 2003 
  1:02 PMSubject: [amibroker] NO WAY [Was]: New Variable 
  ClassDT:You said:"I like your expression "no way" 
  !!I donīt like the same expression, when we talk AFL."I offer my 
  opinion in a long message in the AB-Beta message list that Ihave a trading 
  approach that AFL can not (NOT) handle.  Maybe usingcomplex script 
  and intricate internal handling of tables, but not AFL.And not by someone 
  with my level of experience.I do not know if you use the new Portfolio 
  Backtester, nor if you havetime or interest in my 
  plight/problem.But for now and as several others have advised me about 
  my tradingsystem, "NO WAY" for 
  AFL.Comment??Ken-----Original Message-----From: 
  DIMITRIS TSOKAKIS [mailto:TSOKAKIS@xxxxxxxxx]Sent: Friday, November 07, 
  2003 4:21 AMTo: <A 
  href=""><SPAN 
  >amibroker@xxxxxxxxxxxxxxx<FONT 
  size=2>Subject: [amibroker] Re: New Variable 
  ClassStephane,We have AddToComposite()[we should be 
  happy...]We are not programmers [at least me][we should be also 
  happy...]I like your expression "no way" !!I donīt like the same 
  expression, when we talk AFL.I shall see it again [the weekend, not 
  now...]As for the group of composites, they may be constructed all 
  togetherwith a loop.Dimitris Tsokakis--- In <A 
  href=""><SPAN 
  >amibroker@xxxxxxxxxxxxxxx<FONT 
  size=2>, "Stephane 
  Carrasset"<<FONT 
  size=2>nenapacwanfr@x<FONT 
  size=2>...> wrote:> 
  Dimitri,>> yes you're right,> no way to optimize directly 
  in a composite...> we must create separatly each composite for each 
  numeric value.>> stephane>Send BUG 
  REPORTS to <FONT 
  size=2><SPAN 
  >bugs@xxxxxxxxxxxxx<FONT 
  size=2>Send SUGGESTIONS to <A 
  href=""><SPAN 
  >suggest@xxxxxxxxxxxxx<FONT 
  size=2><SPAN 
  >-----------------------------------------Post 
  AmiQuote-related messages ONLY to: <A 
  href=""><SPAN 
  >amiquote@xxxxxxxxxxxxxxx<FONT 
  size=2>(Web page: <A 
  href=""><SPAN 
  >http://groups.yahoo.com/group/amiquote/messages/<FONT 
  size=2><SPAN 
  >)--------------------------------------------Check 
  group FAQ at:<A 
  href=""><FONT 
  size=2><SPAN 
  >http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
  size=2>Your use of Yahoo! Groups is subject 
  to<FONT 
  size=2><SPAN 
  >http://docs.yahoo.com/info/terms/<FONT 
  size=2>Send BUG REPORTS to <A 
  href=""><SPAN 
  >bugs@xxxxxxxxxxxxx<FONT 
  size=2>Send SUGGESTIONS to <A 
  href=""><SPAN 
  >suggest@xxxxxxxxxxxxx<FONT 
  size=2><SPAN 
  >-----------------------------------------Post 
  AmiQuote-related messages ONLY to: <A 
  href=""><SPAN 
  >amiquote@xxxxxxxxxxxxxxx<FONT 
  size=2> (Web page: <A 
  href=""><SPAN 
  >http://groups.yahoo.com/group/amiquote/messages/<FONT 
  size=2><SPAN 
  >)--------------------------------------------Check 
  group FAQ at:<A 
  href=""><FONT 
  size=2><SPAN 
  >http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
  size=2> Your use of Yahoo! Groups is 
  subject to<FONT 
  size=2><SPAN 
  >http://docs.yahoo.com/info/terms/<FONT 
  size=2> 
  ------------------------ Yahoo! Groups Sponsor 
  ---------------------~-->Buy Ink Cartridges or Refill Kits for your HP, 
  Epson, Canon or LexmarkPrinter at MyInks.com. Free s/h on orders $50 or 
  more to the US & Canada.<A 
  href=""><SPAN 
  >http://www.c1tracking.com/l.asp?cid=5511<A 
  href=""><FONT 
  size=2><SPAN 
  >http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM<FONT 
  size=2><SPAN 
  >---------------------------------------------------------------------~->Send 
  BUG REPORTS to <FONT 
  size=2><SPAN 
  >bugs@xxxxxxxxxxxxx<FONT 
  size=2>Send SUGGESTIONS to <A 
  href=""><SPAN 
  >suggest@xxxxxxxxxxxxx<FONT 
  size=2><SPAN 
  >-----------------------------------------Post 
  AmiQuote-related messages ONLY to: <A 
  href=""><SPAN 
  >amiquote@xxxxxxxxxxxxxxx<FONT 
  size=2> (Web page: <A 
  href=""><SPAN 
  >http://groups.yahoo.com/group/amiquote/messages/<FONT 
  size=2><SPAN 
  >)--------------------------------------------Check 
  group FAQ at: <A 
  href=""><FONT 
  size=2><SPAN 
  >http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
  size=2> Your use of Yahoo! Groups is 
  subject to <FONT 
  size=2><SPAN 
  >http://docs.yahoo.com/info/terms/<FONT 
  size=2> <FONT 
  face="Courier New" size=2>Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxx<SPAN 
  ><FONT 
  face="Courier New">Send SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx<FONT 
  face="Courier New">-----------------------------------------<FONT 
  face="Courier New">Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face="Courier New">--------------------------------------------<FONT 
  face="Courier New">Check group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your 
  use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of 
  Service. Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.