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

RE: [amibroker] rotational trading



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>Hello,
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Below some code to tinker with. Instead of counting all pos 
and negative changes I sort the changes into ranges, like a range for zero 
change, one for >0 and <1, >1 and <2, etc. The code requires a 
preliminary Scan after which I run the OldBacktester and click Equity to display 
the charts. 
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>It is interesting to note that certain magnitudes of change are 
more indicative of price change than others, for example changes less than 1% 
don't have nice swings. But 3% lines have a nice rhythm and could be summed 
separately to provide you with a better (?) AD line. Run on N100 and plot 
beside the !NDX to see correlations. The chart should look something like 
this:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2><IMG alt="" hspace=0 src="jpg00003.jpg" align=baseline 
border=0>
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial 
color=#000000 size=2>// Advance Decline lines sorted into Ranges. Select 
Watchlist with Filter and run Scan on all quotations. Run OldBacktester and 
click Equity button to display charts, or copy code to indicator for display. 
Right-Click over chart and use Param to adjust filtering. Use Explore (on 
current stock else you get 1000s of rows) to see the values in Columns for 
export. 
I use the hbt3a() DLL for filtering (download from files under 
vandenbergen) you can comment it out and uncomment the DEMA() lines as a 
substitute. <FONT 
color=#ff0000>Buy=<FONT 
color=#ff0000>Sell=<FONT 
color=#ff0000>Short=<FONT 
color=#ff0000>Cover=<FONT 
color=#ff00ff>0<FONT 
color=#000000>; <FONT 
color=#ff0000>Filter = <FONT 
color=#ff00ff>1<FONT 
color=#000000>; Scan = Status<FONT 
color=#000000>("Action"<FONT 
color=#000000>)==3<FONT 
size=2>; Indicator = <FONT 
color=#0000ff>Status(<FONT 
color=#ff00ff>"Action")==<FONT 
color=#ff00ff>1<FONT 
color=#000000>; Explore = Status<FONT 
color=#000000>("Action"<FONT 
color=#000000>)==4<FONT 
size=2>; Bw = <FONT 
color=#ff00ff>1; 
         <FONT 
color=#000000>// Percent width of 
bands<FONT 
color=#000000> R = ROC<FONT 
color=#000000>((O<FONT 
color=#000000>+H<FONT 
color=#000000>+L<FONT 
color=#000000>+C<FONT 
color=#000000>)/4<FONT 
color=#000000>,1<FONT 
color=#000000>);   // Price 
change monitored (i use ave of OHLC)<FONT 
size=2> Lim = <FONT 
color=#ff00ff>5<FONT 
color=#000000>;         <FONT 
color=#000000>// Number of Pos/Neg Bands 
<FONT 
size=2>if<FONT 
color=#000000>(Scan <FONT 
color=#ff0000>OR<FONT 
face=Arial> Explore)    { 
   <FONT 
color=#ff0000>for<FONT 
face=Arial>(n=-Lim; n<=Lim; n++ ) 
      { 
      <FONT 
color=#ff0000>if(n==<FONT 
color=#ff00ff>0) B = R ==<FONT 
color=#ff00ff>0<FONT 
color=#000000>;            <FONT 
color=#000000>// Zero<FONT 
face=Arial> 
      <FONT 
color=#ff0000>else <FONT 
color=#ff0000>if(n==Lim) B = R 
>=(Lim-1<FONT 
color=#000000>)*Bw;      <FONT 
color=#000000>// All > Lim-1<FONT 
size=2> 
      <FONT 
color=#ff0000>else <FONT 
color=#ff0000>if(n==-Lim) B = R 
<=(-Lim+1<FONT 
color=#000000>)*Bw;      <FONT 
color=#000000>// All < -Lim+1<FONT 
size=2> 
      <FONT 
color=#ff0000>else <FONT 
color=#ff0000>if(n<<FONT 
color=#ff00ff>0) B = R < (n+<FONT 
color=#ff00ff>1)*Bw <FONT 
color=#ff0000>AND<FONT 
face=Arial> R > n*Bw;    
      <FONT 
color=#ff0000>else <FONT 
color=#ff0000>if(n><FONT 
color=#ff00ff>0) B = (R > (n-<FONT 
color=#ff00ff>1)*Bw <FONT 
color=#ff0000>AND<FONT 
face=Arial> R < n*Bw); 
      <FONT 
color=#0000ff>AddToComposite(B,<FONT 
color=#ff00ff>"~ADBand"+<FONT 
color=#0000ff>NumToStr(n,<FONT 
color=#ff00ff>2.1),<FONT 
color=#ff00ff>"X"<FONT 
color=#000000>);       <FONT 
color=#0000ff>AddColumn(<FONT 
color=#0000ff>IIf(B,R,<FONT 
color=#ff0000>Null),<FONT 
color=#0000ff>NumToStr(n,<FONT 
color=#ff00ff>2.1),<FONT 
color=#ff00ff>1.2<FONT 
color=#000000>);       } 
   AddToComposite<FONT 
color=#000000>(1<FONT 
color=#000000>,"~ADBandCount"<FONT 
color=#000000>,"X"<FONT 
size=2>);    } 
// End Scan or 
Explore<FONT 
color=#000000> <FONT 
color=#ff0000>if<FONT 
face=Arial>(Indicator)    { 
   Pd = Param<FONT 
color=#000000>("Pd"<FONT 
color=#000000>,5<FONT 
color=#000000>,1<FONT 
color=#000000>,100<FONT 
color=#000000>,1<FONT 
size=2>);    Cnt = 
Foreign(<FONT 
color=#ff00ff>"~ADBandCount",<FONT 
color=#ff00ff>"X"<FONT 
color=#000000>);    TitleString=<FONT 
color=#ff00ff>""<FONT 
color=#000000>;    Sup=Sdn=<FONT 
color=#ff00ff>0<FONT 
color=#000000>;    ColorOffSet = <FONT 
color=#ff00ff>8<FONT 
color=#000000>;    <FONT 
color=#ff0000>for<FONT 
face=Arial>(n=Lim; n>=-Lim; n--) 
      { 
      S = <FONT 
color=#0000ff>Foreign(<FONT 
color=#ff00ff>"~ADBand"+<FONT 
color=#0000ff>NumToStr(n,<FONT 
color=#ff00ff>2.1),<FONT 
color=#ff00ff>"X")/Cnt*<FONT 
color=#ff00ff>100<FONT 
color=#000000>;       <FONT 
color=#ff0000>if(n><FONT 
color=#ff00ff>0<FONT 
color=#000000>) Sup = Sup + S; 
      <FONT 
color=#ff0000>if(n<<FONT 
color=#ff00ff>0<FONT 
color=#000000>) Sdn = Sdn + S; 
      <FONT 
color=#ff0000>if(n==<FONT 
color=#ff00ff>0<FONT 
color=#000000>) Sz = Cnt-Sdn-Sup; <FONT 
color=#000000>//      Plot(DEMA(n*S,Pd),"S",n+ColorOffSet,1|styleNoLabel);<FONT 
size=2> 
      <FONT 
color=#0000ff>Plot(<FONT 
color=#0000ff>hbT3A(n*S,Pd,<FONT 
color=#ff00ff>0.84),<FONT 
color=#ff00ff>"S",n+ColorOffSet,<FONT 
color=#ff00ff>1|<FONT 
color=#ff0000>styleNoLabel<FONT 
size=2>); 
      TitleString = TitleString + <FONT 
color=#0000ff>EncodeColor<FONT 
face=Arial>(n+ColorOffSet)+ 
         <FONT 
color=#ff00ff>"Limit "+<FONT 
color=#0000ff>NumToStr(n*BW,<FONT 
color=#ff00ff>2.1)+<FONT 
color=#ff00ff>"%\n"<FONT 
color=#000000>;       } <FONT 
color=#000000>//   Plot(DEMA(Sup/5,Pd),"",colorBrightGreen,1|styleDots);<FONT 
size=2> <FONT 
color=#000000>//   Plot(DEMA(-Sdn/5,Pd),"",colorRed,1|styleDots);<FONT 
size=2>    <FONT 
color=#0000ff>Plot(<FONT 
color=#0000ff>hbT3A(Sup,Pd,<FONT 
color=#ff00ff>0.84),<FONT 
color=#ff00ff>"",<FONT 
color=#ff0000>colorBrightGreen<FONT 
color=#000000>,1<FONT 
color=#000000>|<FONT 
color=#ff0000>styleDots<FONT 
face=Arial>);    <FONT 
color=#0000ff>Plot(<FONT 
color=#0000ff>hbT3A(-Sdn,Pd,<FONT 
color=#ff00ff>0.84),<FONT 
color=#ff00ff>"",<FONT 
color=#ff0000>colorRed,<FONT 
color=#ff00ff>1|<FONT 
color=#ff0000>styleDots<FONT 
face=Arial>);    <FONT 
color=#ff0000>Title=<FONT 
color=#0000ff>EncodeColor(<FONT 
color=#ff0000>colorWhite<FONT 
color=#000000>)+"Advance-Decline Chart sorted by 
amount of change"<FONT 
color=#000000>+    "\nRight Y-axis 
indicates percent of stocks that changed Up or Down (ignore 
sign)"+ 
   "\nUse Param window to change 
filtering. Thick lines are total AD lines."<FONT 
size=2>+    <FONT 
color=#ff00ff>"\n"<FONT 
color=#000000>+TitleString;    } <FONT 
color=#000000>// End Indicator<FONT 
face=Arial color=#000000 size=2> <FONT 
color=#000000>/* 





  <FONT face=Arial 
  size=2>-----Original Message-----From: nb9trade 
  [mailto:clyde@xxxxxxxxxxx]Sent: January 15, 2004 7:07 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
  Advance Declone LineIs 
  it possible to make an advance decline line using Amibroker?If it can 
  be done, can it be done, for just one watch list like the Dow 
  30?Does anybody know how to do 
  it?ThanksClyde<FONT 
  face=Arial size=2>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS 
  to suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
  <FONT 
  face=Arial 
  size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face=Arial size=2>--------------------------------------------Check group 
  FAQ at: <A 
  href=""><FONT 
  face=Arial 
  size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
  size=2> 
  <FONT 
  face=Arial size=2>
  
  Yahoo! Groups Links
  
    To visit your group on the web, go 
    to:<FONT 
    face=Arial 
    size=2>http://groups.yahoo.com/group/amibroker/<FONT 
    face=Arial size=2>  
    To unsubscribe from this group, send an email 
    to:<A 
    href=""><FONT 
    face=Arial size=2>amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT 
    face=Arial size=2>  
    Your use of Yahoo! Groups is subject to the 
    <FONT face=Arial 
    size=2>Yahoo! Terms of Service. 
    


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








Yahoo! Groups Sponsor


  ADVERTISEMENT 









Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment: Description: ""