PureBytes Links
Trading Reference Links
|
Do this:
BUY = (MarketBuy AND Name() == "RYVYX") or (MarketSell AND Name() ==
"RYVNX");
Where RYVYX is a Long fund and RYVNX is a Short fund of your choosing.
You will have to either choose All Symbols (slow) or Use Filter and setup a
filter that contains your funds of interest (a watchlist, group, etc.)
I also keep track of whether I'm on my own buy or sell so I can have a SELL
signal appropriate to which BUY signal I'm in. Alternatively I'm thinking
MaxOpenPositions = 1; should also do the trick. Here's my Sell code:
Sell = (MarketSell AND Ref(onBuy,-1) OR (MarketBuy AND Ref(onSell,-1));
Where onBuy and onSell are variables that are TRUE every day that my
MarketBuy and MarketSell signals are in effect.
--
Terry
> From: "Ken Close" <closeks@xxxxxxxx>
> Reply-To: amibroker@xxxxxxxxxxxxxxx
> Date: Sun, 3 Oct 2004 12:48:44 -0400
> To: "AmiBroker List" <amibroker@xxxxxxxxxxxxxxx>
> 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 (http://www.grisoft.com).
> Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004
>
>
>
>
>
> 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
>
>
>
>
>
>
>
------------------------ 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/
|