| 
 PureBytes Links 
Trading Reference Links 
 | 
Actually AmiBroker allows to built composite securities in 
very easy way.
 
The composite from spread can be created using single line of 
code:
 
AddToComposite( Close - Foreign("SYMBOL2", "C" ), "~SPREAD " + 
Name() + "-SYMBOL2", "X" );
 
(replace SYMBOL2 by the ticker symbol of your 
choice)
Use Auto-analysis "SCAN" feature to build composite 
symbols.
You can create many composites in one run (if you apply to 
multiple symbols) or for just one symbol.
 
See also:
<A 
href="">http://www.amibroker.net/3rdparty/IntroToAtc.pdf
 
Hope this helps.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Alberto 
  Torchio 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, July 24, 2003 1:27 
  PM
  Subject: RE: [amibroker] SCAN for 
  Spreads
  
  <FONT 
  face="Courier New">Daniel
  <BLOCKQUOTE 
  >
    Is it possible with 
    Amibroker to scan the commodities market to find an interesting spread? 
    (one nearby future price getting higher than a more distant future?) 
    Does somebody trade commodities spreads? Some experience with analysis 
    and scanning?Regards.  
    Daniel           
    
  I sometimes trade commodity spreads, 
  but it doesn't seem to be that easy to chart and analyze them with 
  AB.
   
  I use the following formula to chart 
  the spread and 3 EMAs:
   <SPAN 
  class=360301511-24072003>
  
    spread = Close - <FONT 
    color=#0000ff>Foreign(<FONT 
    color=#0000ff>ParamStr(<FONT 
    color=#ff00ff>"2nd Symbol",<FONT 
    color=#ff00ff>"S`X"), <FONT 
    color=#ff00ff>"C" ); 
    
    
    Plot( spread, 
    "Spread", 
    colorYellow ); 
    Plot( 
    EMA( spread, 
    20 ), <FONT 
    color=#ff00ff>"20 EMA", colorOrange ); 
    
    Plot( 
    EMA( spread, 
    60 ), <FONT 
    color=#ff00ff>"60 EMA", colorRed ); 
    
    Plot( 
    EMA( spread, 
    120 ), <FONT 
    color=#ff00ff>"120 EMA", colorDarkRed 
    ); <FONT face=Arial 
    color=#0000ff> 
  And the following to 
  chart one price oscillator based on the spread.<FONT 
  color=#000000 size=1>
  
    spread = Close - <FONT 
    color=#0000ff>Foreign(<FONT 
    color=#0000ff>ParamStr(<FONT 
    color=#ff00ff>"2nd Symbol",<FONT 
    color=#ff00ff>"S`X"), <FONT 
    color=#ff00ff>"C" ); 
    
    oscillatorofspread = <FONT 
    color=#0000ff>EMA( spread, <FONT 
    color=#ff00ff>3 ) - <FONT 
    color=#0000ff>EMA( spread, <FONT 
    color=#ff00ff>10 ); <FONT 
    color=#0000ff>
    Plot( 
    oscillatorofspread , ""<FONT 
    color=#000000>, IIf( 
    oscillatorofspread > 0<FONT 
    color=#000000> , colorGreen , colorRed ) , 
    styleHistogram ) ;
    Plot( 
    oscillatorofspread , "Price 
    Oscillator", <FONT 
    color=#0000ff>IIf( oscillatorofspread > 
    0 , colorGreen , colorRed ) 
    , styleNoLabel ) ;
  The problem I have found is that the 
  first formula has the spread's second leg built in: so that every time you 
  change it, it gets changed for every chart using the same formula.
  As long as you chart, like I am 
  doing Soybeans it works fine: I have August vs. November and Septmeber vs. 
  November. The problem arises when I decide to chart KC Wheat vs. Chicago 
  Wheat: I can't do it with the same formula, unless I enter a different 
  contract name (instead of S`X) like WZ3, but this changes all the charts where 
  I have the spread formula... Even those where S`X is OK.
  So what am I planning to do? Build 
  spread formulas for (let's say) soybeans, one for wheat, one for 
  sugar...
  A better solution would be to create 
  a composite security, like it is done with Metastock... But so far I can't see 
  how.
   
  <FONT face=Arial color=#0000ff 
  size=2>albertoSend 
  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.
 |