PureBytes Links
Trading Reference Links
|
Bert:
Just for your additional learning and insight, you **CAN** use
rotational trading.
You keep two funds in your watchlist, your POSSX and BRSIX and then you
"force" the position score for BRSIX to be highest when you want to buy
BRSIX and you force the score for POSSX to be highest when you want to
buy POSSX and you only hold one fund. I believe it will do the same
thing.
Ken
-----Original Message-----
From: Bert Steele [mailto:bistrader@xxxxxxxxx]
Sent: Saturday, August 28, 2004 4:26 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] BUY STATEMENT HELP
Thanks to all of you for the help. Here is what I came up with. I have
some cleaning up to do related to State Form and Impulse Form, but this
is easy enough.
// 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 = 1;
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));
Terry <MagicTH@xxxxxxxxxxx> wrote:
Bert,
There's confusion on the terms here. I see that POSSX is a Short Small
cap
fund and BRSIX is a Long Small Cap fund. It appears you want to go long
and
short (which in Amibroker would be Buy and Short). However, since you
will
actually BUY POSSX when you get a short signal, you must BUY it in
Amibroker, otherwise it will think you Shorted a Short fund and only
give
you gains when the fund goes DOWN.
That's why I had both conditions on the BUY line. You BUY BRSIX when
your
Buy Cond1 is true and you Buy POSSX when your Short (Sell) condition is
true.
You might also check out rotational trading as suggested by another.
Terry
--
> Terry,
>
> I get a Syntax error with the following. This is totally a long (and
not
> short) system. It is to sell POSSX and buy BRSIX (both mutual funds)
when Buy
> is True. It is to sell BRSIX and buy POSSX when Sell is True. [When
Buy is
> True, Sell is False.] Your continued help is appreciated.
>
> Bert
>
>
> // test name. afl
> SetForeign("BRSIX");
> Cond1 = C >= EMA(C, 21) ;
> BuyState = Cond1 ;
> Cond2 = C < EMA( C, 21);
> SellState = Cond2;
> Buy = Sell = Short = Cover = 0;
> Buy = IIf(BuyState AND Name() = "BRSIX") ,True,False);
> Sell = IIf(SellState AND Name() = "POSSX") ,True,False);
> Short = False; //Not shorting anything
> Cover = False;
> RestorePriceArrays();
> Filter = 1;
> AddColumn(C,"Close", 1.2);
> AddColumn (BuyState, "BuyState",1.0);
> AddColumn (SellState, "SellState",1.0);
> AddColumn (Cond1, "Cond1",1.0);
> AddColumn (Buy, "POSSX to BRSIX", 1, colorDefault, IIf(Buy,
colorGreen,
> colorDefault));
> AddColumn (Cond2, "Cond2",1.0);
> AddColumn (Sell, "BRSIX to POSSX", 1, colorDefault,
IIf(Sell,colorRed,
> colorDefault));
>
>
> Terry <MagicTH@xxxxxxxxxxx> wrote:
> Bert,
>
> Since theyıre funds, youıre BUYING both funds. Also, you would never
SELL
> anything, you would SHORT it. SELL just closes your BUY position. So,
you
> need to do something like this assuming you want to always be in the
market
> and your just switching funds (code untested):
>
> Buy = IIf(Cond1 and Name() = "NTHEX") or (Cond2 and Name() =
> "FDRXX"),true,false);
> Sell = "I'm not sure how to get you out of each position. Possibly if
you
> have MaxPositions = 1 it will get handled automatically."
> Short = false; //Not shorting anything
> Cover = false;
>
>> Hello,
>>
>> I would appreciate it if someone can help with the following "PROBLEM
>> AREA" in my code. (See "PROBLEM AREA" below.)
>>
>> Thanks,
>>
>> Bert
>>
>> // -------------------------------------
>>
>> JB_Price = Foreign("NTHEX", "C");
>>
>> Cond1 = JB_Price >= EMA( JB_Price, 20) ;
>>
>> BuyState = Cond1 ;
>>
>> Cond2 = JB_Price < EMA( JB_Price, 20 );
>>
>> SellState = Cond2;
>>
>> // PROBLEM AREA STARTS HERE.
>> //
>> // I HAVE THE 2 FUNDS IN A WATCHLIST AND I USE
>> // FILTER TO SELECT THIS WATCH LIST.
>> // HOW DO I TELL THE AA TO BUY NTHEX AND SELL
>> // FDRXX WHEN SIGNAL IS ON A BUY, AND
>> // TO SELL NTHYX AND BUY FDRXX WHEN SIGNAL
>> // IS ON A SELL.
>> // I KNOW THE FOLLOWING IS WRONG, BUT THE CONCEPT IS
>> // OK.
>>
>> Buy = IIf(Name() == "NTHEX", BuyState, SellState);
>> Sell = IIf(Name() == "FDRXX", SellState, BuyState);
>>
>>
>>
>> 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
>>
<http://us.ard.yahoo.com/SIG=129bafh11/M=298184.5285298.6392945.3001176/
D=gro>>
u
>>
ps/S=1705632198:HM/EXP=1093788454/A=2319501/R=0/SIG=11tq0u909/*http://ww
w.net>>
f
>> lix.com/Default?mqso=60185353&partid=5285298>
>>
>>
>> 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
>> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>> *
>> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
>> <http://docs.yahoo.com/info/terms/> .
>>
>
--
Terry
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
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.
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
[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 Links
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 8/19/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 8/19/2004
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/
|