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

Re: [amibroker] Re: A technical question



PureBytes Links

Trading Reference Links




<SPAN 
class=160134605-16012004>You could test the "idea" first just using Equity 
charts. Run the code below using the OldBacktester and Click Equity to see the 
Equity charts. Trades could overlap and your sum equity starts with double the 
initial investment.
<SPAN 
class=160134605-16012004> 
<SPAN 
class=160134605-16012004>Good luck,
<SPAN 
class=160134605-16012004>herman.
<SPAN 
class=160134605-16012004> 
<FONT 
face=Arial>Short<FONT 
color=#000000>=Cover<FONT 
color=#000000>=0<FONT 
size=2>; <FONT 
color=#0000ff>SetForeign(<FONT 
color=#ff00ff>"CSCO");    <FONT 
color=#000000>// change to your 
ticker<FONT 
color=#000000> a = ROC<FONT 
color=#000000>(C<FONT 
color=#000000>,5<FONT 
color=#000000>);      <FONT 
color=#000000>// Substitute another price for C if 
needed<FONT 
color=#000000> SetForeign<FONT 
color=#000000>("MSFT"); 
   // change your other 
security<FONT 
color=#000000> b = ROC<FONT 
color=#000000>(C<FONT 
color=#000000>,5); 
      // 
Substitute another price for C if needed<FONT 
size=2> d = a - b; e = <FONT 
color=#0000ff>MA(d,<FONT 
color=#ff00ff>10<FONT 
color=#000000>); SetForeign<FONT 
color=#000000>("X"<FONT 
color=#000000>,1<FONT 
color=#000000>,1<FONT 
size=2>); <FONT 
color=#ff0000>Buy = <FONT 
color=#0000ff>Cross<FONT 
color=#000000>(d,e); <FONT 
color=#ff0000>Sell = <FONT 
color=#0000ff>Ref(<FONT 
color=#ff0000>Buy,<FONT 
color=#ff00ff>3);   <FONT 
color=#000000>// need some sell 
signal<FONT 
color=#000000> E1 = Equity<FONT 
color=#000000>(0<FONT 
size=2>); <FONT 
color=#0000ff>Plot(E1,<FONT 
color=#ff00ff>"Equity X",<FONT 
color=#ff00ff>4,<FONT 
color=#ff00ff>1<FONT 
color=#000000>); SetForeign<FONT 
color=#000000>("Y"<FONT 
color=#000000>,1<FONT 
color=#000000>,1<FONT 
size=2>); <FONT 
color=#ff0000>Buy = <FONT 
color=#0000ff>Cross<FONT 
color=#000000>(d,e); <FONT 
color=#ff0000>Sell = <FONT 
color=#0000ff>Ref(<FONT 
color=#ff0000>Buy,<FONT 
color=#ff00ff>3);   <FONT 
color=#000000>// need some sell 
signal<FONT 
color=#000000> E2 = Equity<FONT 
color=#000000>(0<FONT 
size=2>); <FONT 
color=#0000ff>Plot(E2,<FONT 
color=#ff00ff>"Equity Y",<FONT 
color=#ff00ff>6,<FONT 
color=#ff00ff>1<FONT 
color=#000000>); <FONT 
face=Arial>E = E1+E2; <FONT 
color=#0000ff>Plot(E,<FONT 
color=#ff00ff>"Total Equit",<FONT 
color=#ff00ff>1,<FONT 
color=#ff00ff>1<FONT face=Arial 
size=2>); /* 
<SPAN 
class=160134605-16012004> 

  <FONT face=Arial 
  size=2>-----Original Message-----From: joeemmett2000 
  [mailto:joeemmett@xxxxxxxxxxxxx]Sent: January 16, 2004 1:15 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
  Switching two securities!<FONT 
  face=Arial>I know this is probably way out in left field, so be gentle 
  with me!I would really appreciate it if someone could show me how to 
  write the code for this.a = ROC(Security "X",5);b = 
  ROC(Security "Y',5);d = a-b; e = MA(d,10);Buy "X' if 
  d>e;Buy "Y" if e>d;Thanks for all your help, 
  JoeSend 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 
  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 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.