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

RE: [amibroker] Long and Inverse Fund



PureBytes Links

Trading Reference Links

Chuck:

Nice to hear from you.  

I have tried everything and just had a clue:

I put in the following code which Bert Steele suggested many messages
ago:

=================================================
// test name2. afl

SetForeign("BRSIX");
Cond1 = C >= EMA(C, 21) ;
RestorePriceArrays();
//Buy = Sell = Short = Cover = 0;
Buy = (Cond1 == True AND Name() == "BRSIX") OR (Cond1 == False AND
Name() == "POSSX");
Sell = (Cond1 == False AND Name() == "BRSIX") OR (Cond1 == True AND
Name() == "POSSX");
Short = 0; //Not shorting anything
Cover = 0;
Filter = Buy OR Sell;
AddColumn(C,"Close", 1.2);
AddColumn (Cond1, "Cond1",1.0);
AddColumn (Buy, "POSSX to BRSIX", 1, colorDefault, IIf(Buy, colorGreen,
colorDefault));
AddColumn (Sell, "BRSIX to POSSX", 1, colorDefault, IIf(Sell,colorRed,
colorDefault));
===============================================

This worked with BRSIX and POSSX alternating in the trade list.

I then substituted my "long" and "inverse" funds, which are really FNU
files produced within the FastTrack context (really just txt files with
dates and closing prices).

In the exact same code as above, I only see my "long" fund (FNU file)
displayed in the Trade list.  I even changed the SetForeign statement to
name my "long" FNU file.

Since I use these "long" and "inverse" FNU files for all sorts of other
stuff, and they work ok there, I am truly puzzled why they seem to cause
the above code to operate incorrectly.

The above code seems to work ok whether Long only or Long and Short is
set in the Settings box.

Any ideas?

Ken


-----Original Message-----
From: Chuck Rademacher [mailto:chuck_rademacher@xxxxxxxxxx] 
Sent: Sunday, October 03, 2004 3:10 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Long and Inverse Fund

G'day Ken,

I don't think that you will be able to do this with a "ranking
system".   If
you only have the two funds (one long and one short), why are you using
a
ranking system?  Why not do what you are doing now and then:

BUY = ticker == "ABC" and positionscore > x;
BUY = ticker == "XYZ" and positionscore < y;

Sorry, I haven't bothered with the syntax.  But you should get the
drift.

Cheerio

Chuck
  -----Original Message-----
  From: Ken Close [mailto:closeks@xxxxxxxx]
  Sent: Sunday, October 03, 2004 12:57 PM
  To: amibroker@xxxxxxxxxxxxxxx
  Subject: RE: [amibroker] Long and Inverse Fund


  Dingo:



  Yes, I tried this (as this was reply from Tomasz a year ago on same
  question) but I must have something wrong because the trade list only
  shows the longfund being bought.



  -----Original Message-----
  From: dingo [mailto:dingo@xxxxxxxxxxx]
  Sent: Sunday, October 03, 2004 1:24 PM
  To: amibroker@xxxxxxxxxxxxxxx
  Subject: RE: [amibroker] Long and Inverse Fund



  I guess you've tried:

  If ( Name() == "InverseFund" )
  {
      tmp = Buy; // must use temporary variable
      Buy = Sell;
      Sell = tmp;
  }

  ?

  d

  > -----Original Message-----
  > From: Ken Close [mailto:closeks@xxxxxxxx]
  > Sent: Sunday, October 03, 2004 12:49 PM
  > To: AmiBroker List
  > Subject: [amibroker] Long and Inverse Fund
  >
  >
  > Can someone help with the basic coding to buy a long fund on
  > a market buy signal, and sell it and buy an inverse fund on a
  > market sell signal.
  >
  > I put two funds in a watchlist, LongFund and InverseFund.
  >
  > I have a Market Timing Signal: either MarketBuy or MarketSell.
  >
  > How do I write the Buy and Sell signals and any PositionScore
  > statements (if any) to make the system  BUY the LongFund and
  > SELL the InverseFund on MarketBuy signal, and the reverse,
  > SELL the LongFund and BUY the InverseFund on MarketSell signal?
  >
  > I have tried various combinations of PositionScore and IIf
  > statements to no avail.  The trade report buys the LongFund
  > on every MarketBuy signal and sells it on every MarketSell
  > signal but never "buys" the InverseFund.
  >
  > Totally frustrated.
  >
  > Any help?
  >
  > Thanks,
  >
  > Ken
  >
  > ---
  > Outgoing mail is certified Virus Free.
  > Checked by AVG anti-virus system (HYPERLINK
  "http://www.grisoft.com)."http://www.grisoft.com).
  > Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004
  >
  >
  >
  >
  > ------------------------ Yahoo! Groups Sponsor
  > --------------------~--> Make a clean sweep of pop-up ads.
  > Yahoo! Companion Toolbar.
  > Now with Pop-Up Blocker. Get it for free!
  > HYPERLINK
 
"http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM"http://us.clic
  k.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
  > --------------------------------------------------------------
  > ------~->
  >
  > Check AmiBroker web page at:
  > HYPERLINK "http://www.amibroker.com/"http://www.amibroker.com/
  >
  > Check group FAQ at:
  > HYPERLINK
 
"http://groups.yahoo.com/group/amibroker/files/groupfaq.html"http://grou
  ps.yahoo.com/group/amibroker/files/groupfaq.html
  > Yahoo! Groups Links
  >
  >
  >
  >
  >
  >
  >



  Check AmiBroker web page at:
  HYPERLINK "http://www.amibroker.com/"http://www.amibroker.com/

  Check group FAQ at: HYPERLINK
 
"http://groups.yahoo.com/group/amibroker/files/groupfaq.html"http://grou
  ps.yahoo.com/group/amibroker/files/groupfaq.html






  Yahoo! Groups Sponsor



  ADVERTISEMENT
  HYPERLINK
 
"http://us.ard.yahoo.com/SIG=129nkc1bi/M=294855.5468653.6549235.3001176/
 
D=groups/S=1705632198:HM/EXP=1096910941/A=2376776/R=0/SIG=11ldm1jvc/*htt
  p:/promotions.yahoo.com/ydomains2004/index.html" \nclick here


  HYPERLINK
 
"http://us.adserver.yahoo.com/l?M=294855.5468653.6549235.3001176/D=group
  s/S=:HM/A=2376776/rand=122109337"



     _____

  Yahoo! Groups Links

  *      To visit your group on the web, go to:
  HYPERLINK
 
"http://groups.yahoo.com/group/amibroker/"http://groups.yahoo.com/group/
  amibroker/

  *      To unsubscribe from this group, send an email to:
  HYPERLINK
 
"mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe"amibro
  ker-unsubscribe@xxxxxxxxxxxxxxx

  *      Your use of Yahoo! Groups is subject to the HYPERLINK
  "http://docs.yahoo.com/info/terms/"Yahoo! Terms of Service.


  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004



  [Non-text portions of this message have been removed]



  Check AmiBroker web page at:
  http://www.amibroker.com/

  Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html


        Yahoo! Groups Sponsor
              ADVERTISEMENT





------------------------------------------------------------------------
----
--
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.



[Non-text portions of this message have been removed]



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 



Yahoo! Groups Sponsor


Top of Form

Select Your State: Alabama Alaska Arkansas Arizona California Colorado
Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa
Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan
Minnesota Missippi Missouri Montana Nebraska Nevada New Hampshire New
Mexico New Jersey New York North Carolina North Dakota Oklahoma Ohio
Oregon Pennsylvania Rhode Island South Carolina South Dakota Tennessee
Texas Utah Vermont Virginia Washington Washington D.C. West Virginia
Wisconsin Wyoming

Purchase Refinance 


Bottom of Form





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. 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004
 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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:
    http://docs.yahoo.com/info/terms/