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

Re: [amibroker] optimizing trades based on a foreign CCI not working as expected



PureBytes Links

Trading Reference Links




Dave,
 
CCI uses AVERAGE price (Avg) (not close, high, low, 
etc).
 
One would need to write either:
 
Avg = ( Foreign("!VIX", 
"H") + Foreign("!VIX", "L") + Foreign("!VIX", "C") ) / 3;
cc = CCI(period);or 
write:
 
cc = CCIa(  ( 
Foreign("!VIX", "H") + Foreign("!VIX", "L") + Foreign("!VIX", "C") ) / 
3, period );
 
 
Hope this helps.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Dave Merrill 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, September 02, 2003 7:10 
  AM
  Subject: RE: [amibroker] optimizing 
  trades based on a foreign CCI not working as expected
  
  <SPAN 
  class=360120705-02092003>um, it would appear that I'm asleep at the switch 
  tonight. there's no need for the gyrations with the price arrays to use a 
  foreign ticker, because CCIa takes any array you want. I know 
  this.
  <SPAN 
  class=360120705-02092003> 
  <SPAN 
  class=360120705-02092003>I still don't understand why swapping out the price 
  arrays doesn't work with the original price-based CCI, so if anyone has 
  an answer to that anyway, great.
  <SPAN 
  class=360120705-02092003> 
  <SPAN 
  class=360120705-02092003>but I'm going to bed now, a little behind my brain, 
  it seems.
  <SPAN 
  class=360120705-02092003> 
  <SPAN 
  class=360120705-02092003>dave
  <BLOCKQUOTE 
  >
    <SPAN 
    class=001364104-02092003>hi jayson, thanks for jumping 
    in.
    <FONT 
    face="Courier New" color=#0000ff size=2><SPAN 
    class=001364104-02092003> 
    <SPAN 
    class=001364104-02092003>aren't you supposed to put things back to the 
    underlying stock after you calculate a function that works directly off the 
    OHLVC arrays? otherwise, anything else you do, graph price for 
    example, will still be using the foreign infos. or maybe I don't 
    understand...
    <FONT 
    face="Courier New" color=#0000ff size=2><SPAN 
    class=001364104-02092003> 
    <SPAN 
    class=001364104-02092003>there's an unrelated error in this code, but I 
    don't think it explains the problem I asked about. the sign of the 
    thresholds in the buy and Sell assignments is reversed. without the foreign 
    CCI, it should read:
    <FONT 
    face="Courier New" color=#0000ff size=2><SPAN 
    class=001364104-02092003> 
    <SPAN 
    class=001364104-02092003>period = Optimize("period", 2, 1, 100, 
    1);threshold = Optimize("threshold", 25, -100, 100, 
    25);    //includes negative now
    <SPAN 
    class=001364104-02092003>Buy = Cross(cc, -threshold);    
    //sign changedSell = Cross(threshold, cc);    //sign 
    changedShort = Sell;Cover = Buy;
    <FONT 
    face=Arial color=#0000ff size=2><SPAN 
    class=001364104-02092003> 
    <SPAN 
    class=001364104-02092003>but as I say, I don't think that's why the foreign 
    one doesn't work like I expect. it *is* why performance wasn't what I 
    expected in most cases though (:-).
    <FONT 
    face="Courier New"><FONT face=Arial 
    color=#0000ff size=2><SPAN 
    class=001364104-02092003> 
    <SPAN 
    class=001364104-02092003>dave
    <BLOCKQUOTE 
    >
      <SPAN 
      class=125110404-02092003>you change the OHLCV back tot the underlying 
      stock at the bottom of your code. try simply....
      <SPAN 
      class=125110404-02092003> 
      period = Optimize("period", 2, 
      1, 100, 1);threshold = Optimize("threshold", 25, 0, 100, 25);O 
      = Foreign("!VIX", "O");H = Foreign("!VIX", "H");L = 
      Foreign("!VIX", "L");C = Foreign("!VIX", "C");V = Foreign("!VIX", 
      "V");cc = CCI(period);Buy = Cross(cc, threshold);Sell = 
      Cross(-threshold, cc);Short = Sell;Cover = 
      Buy;----------------
      Regards, 
      Jayson 
      <FONT face=Tahoma 
      size=2>-----Original Message-----From: Dave Merrill 
      [mailto:dmerrill@xxxxxxx]Sent: Monday, September 01, 2003 11:26 
      PMTo: AmiBrokerSubject: [amibroker] optimizing 
      trades based on a foreign CCI not working as 
      expectedcan anyone tell me why these two tests 
      give the same results for every indexI tried?both versions go 
      long and short based on a CCI, optimizing for best returns.version 1 
      uses the CCI of the issue under test, and version 2 uses the CCIof 
      another index, I thought.but I get the same results no matter what 
      foreign index I use, includingcontrarian ones like the VIX you see 
      below.what am I 
      missing?thanks,dave----------------VERSION 
      1----------------period = Optimize("period", 2, 1, 100, 
      1);threshold = Optimize("threshold", 25, 0, 100, 25);cc = 
      CCI(period);Buy = Cross(cc, threshold);Sell = 
      Cross(-threshold, cc);Short = Sell;Cover = 
      Buy;----------------VERSION 
      2----------------period = Optimize("period", 2, 1, 100, 
      1);threshold = Optimize("threshold", 25, 0, 100, 25);saveO = 
      O;saveH = H;saveL = L;saveC = C;saveV = V;O = 
      Foreign("!VIX", "O");H = Foreign("!VIX", "H");L = Foreign("!VIX", 
      "L");C = Foreign("!VIX", "C");V = Foreign("!VIX", "V");cc = 
      CCI(period);O = saveO;H = saveH;L = saveL;C = saveC;V 
      = saveV;Buy = Cross(cc, threshold);Sell = Cross(-threshold, 
      cc);Short = Sell;Cover = Buy;----------------Dave 
      MerrillSend 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. 
      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. 
      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. 
    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.