[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




<FONT face=Arial color=#0000ff 
size=2>Dave,
You 
are correct. If you have plans for the stock (not index) OHLC after your 
calculation then you need to change it back.  I am not sure why AB does not 
seem to see your reassignment of the close value. Never mind though as a simple 
work around is available. Try CCIa instead of CCI.....
<FONT face=Arial color=#0000ff 
size=2> 
 
period = <FONT 
face=Arial>Optimize<FONT 
size=2>("period", <FONT 
size=2>2, 1, 
100, <FONT 
size=2>1<FONT face=Arial 
color=#0000ff>);
threshold = <FONT 
face=Arial>Optimize<FONT 
size=2>("threshold", <FONT 
size=2>25, -<FONT 
size=2>100, <FONT 
size=2>100, 25<FONT 
color=#282828 size=2>);
cc = <FONT 
color=#0000ff>CCIa<FONT 
size=2>(Foreign(<FONT 
size=2>"!VIX", "C"<FONT 
size=2>),<FONT face=Arial 
color=#0000ff>period);
 
Buy<FONT 
color=#0000ff> = Cross(cc, 
-<FONT 
face=Arial color=#0000ff>threshold);
Sell<FONT 
color=#0000ff> = <FONT 
size=2>Cross<FONT face=Arial 
color=#0000ff>(threshold, cc);
Short<FONT 
color=#0000ff> = Sell<FONT 
color=#282828 size=2>;<FONT 
size=2>
Cover<FONT 
color=#0000ff> = Buy<FONT 
color=#282828 size=2>;
<FONT face=Arial 
color=#0000ff> 
<FONT face=Arial 
color=#0000ff size=2>I have not tested the values and it is late but I think 
this should get you where you want to go....
 
 
Regards, 
Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Dave Merrill 
[mailto:dmerrill@xxxxxxx]Sent: Tuesday, September 02, 2003 12:50 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
optimizing trades based on a foreign CCI not working as 
expected
<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 
>
  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. 







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.