Hello,
You can't do this that way.
In rotational mode you must use single price
(either open or close) for all symbols.
This is logical, as rotation should occur at the
same time of the session
(either close or open) for all
symbols.
It clearly says
Important: The rotational trading mode uses "buy price" and "buy delay"
from the Settings | Trade page as trade price and delay for both entries and
exits (long and short)
If you must use different prices in rotational mode
- then the only option is using
custom backtest procedure.
Best
regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Monday, October 10, 2005 9:49
PM
Subject: Re: [amibroker] ROTATIONAL
TRADING WILL NOT USE OPENING PRICE ! !
Please look at code again. I am using Close price in one situation
and Open price in second situation. That is, it is suppose to use Close
price when it rotates to ^rut and it is suppose to use Open price when it
rotates to ^ndx. Tomasz Janeczko <amibroker@xxxxxx> wrote:
Hello,
You
have this:
BuyPrice = SellPrice = ShortPrice = CoverPrice = Close;
in your formula. Either remove it and set trading prices from the
settings screen or use:
BuyPrice = SellPrice = ShortPrice =
CoverPrice = OPEN;
Best regards, Tomasz
Janeczko amibroker.com ----- Original Message ----- From:
"bistrader" <bistrader@xxxxxxxxx> To:
<amibroker@xxxxxxxxxxxxxxx> Sent: Monday, October 10, 2005 6:08
PM Subject: [amibroker] ROTATIONAL TRADING WILL NOT USE OPENING PRICE !
!
> Cannot get Rotational Trading to use Opening price rather
than > Closing price. > > I need a little help with the
following afl code. > > I want AB to Buy ^NDX with a delay = 1
but NOT at the next day's > closing price > or at today's
closing price. Rather, I want AB to buy at the next > day's
opening > price. Per AB's help, the following should work. However, AB
does not > buy at the > next day's opening price. It buys at
the next day's closing price. > > To run a backtest, place
^RUT and ^NDX in a watchlist and run a > backtest on the >
watchlist. Again, the afl buys ^RUT at a delay = 0 close and this >
works just > fine. The afl is suppose to buy ^NDX at a delay = 1 open.
It > certainly buys via > a delay = 1, but at the close and not
the open as desired. > > > //
Example_RotationalTrading_01.afl > > // Example Rotational
Trading afl used to see if can get help > // on why afl will not buy
^NDX at tomorrow's opening price > > //
------------------------------------------------------------------- >
--------- > // Set Rotational Trading and all trading options
> //
------------------------------------------------------------------- >
--------- > > EnableRotationalTrading(); >
SetFormulaName("Example_RotationalTrading_01"); > > BuyPrice =
SellPrice = ShortPrice = CoverPrice = Close; > SetTradeDelays(1, 1,
1, 1); > > SetOption( "InitialEquity", 1000 ); >
SetOption( "AllowSameBarExit", True ); > SetOption(
"ActivateStopsImmediately", False ); > SetOption(
"AllowPositionShrinking", True ); > SetOption( "FuturesMode", False
); > SetOption( "InterestRate", 0 ); > SetOption(
"MaxOpenPositions", 1 ); > SetOption( "WorstRankHeld", 1 ); >
SetOption( "MinShares", .0001 ); > SetOption( "PriceBoundChecking",
True ); > SetOption( "CommissionMode", 2 ); > SetOption(
"CommissionAmount", 0 ); > SetOption( "MarginRequirement", 100 );
> SetOption( "ReverseSignalForcesExit", True ); > SetOption(
"UsePrevBarEquityForPosSizing", False ); > > RoundLotSize = 0;
> > //
------------------------------------------------------------------- >
--------- > // Set RUT_Buy / Sell and NDX_Buy / Sell Logic so do not
overlap > //
------------------------------------------------------------------- >
--------- > LongBarsHold = 2; > > NDX_Buy = Month() !=
Ref(Month(), 1); > NDX_Sell = Ref(NDX_Buy, -LongBarsHold); >
> RUT_Buy = Month() != Ref(Month(), 1); > RUT_Buy =
Ref(NDX_Buy, -8); > RUT_Sell = Ref(RUT_Buy, -LongBarsHold); >
> //
------------------------------------------------------------------- >
--------- > // The watchlist is assumed to contain 2 tickers -
> //
------------------------------------------------------------------- >
--------- > // ^RUT -- R2K from Yahoo > // ^NDX -- NDX100 from
Yahoo > > //
------------------------------------------------------------------- >
--------- > // Rotational Trading > //
------------------------------------------------------------------- >
--------- > > if ( Name() == "^RUT" ) > { >
PositionSize = -200; > PositionScore = RUT_Buy; >
SetTradeDelays( 0, 0, 0, 0 ); > BuyPrice = SellPrice = ShortPrice =
CoverPrice = Close;// Buy today > at close > } >
> if ( Name() == "^NDX" ) > { > PositionSize = -100;
> PositionScore = NDX_Buy; > SetTradeDelays( 1, 1, 1, 1 );
> BuyPrice = SellPrice = ShortPrice = CoverPrice = Open;// Buy next
day > at open, BUT DOES NOT WORK????? > } > > //
------------------------------------------------------------------- >
--------- > // Exploration > //
------------------------------------------------------------------- >
--------- > Filter = 1; > AddColumn(RUT_Buy, "RUT_Buy", 1.0,
colorDefault, IIf(RUT_Buy, > colorBrightGreen, colorDefault));
> AddColumn(RUT_Sell,"RUT_Sell", 1.0, colorDefault, IIf(RUT_Sell,
> colorRed, colorDefault)); > AddColumn(NDX_Buy, "NDX_Buy",
1.0, colorDefault, IIf(NDX_Buy, > colorBrightGreen, colorDefault));
> AddColumn(NDX_Sell,"NDX_Sell", 1.0, colorDefault, IIf(NDX_Sell,
> colorRed, colorDefault)); > AddColumn(RSI(14),"RSI(14)",
5.0); > AddColumn(PositionScore,"PositionScore", 5.0); >
AddColumn(PositionSize,"PositionSize", 5.0); >
AddColumn(BuyPrice,"BuyPrice", 1.2); >
AddColumn(SellPrice,"SellPrice", 1.2); > AddColumn(Open,"Open", 1.2);
> AddColumn(Close,"Close", 1.2); > > > The end
> > > > > > > >
Please note that this group is for discussion between users only. >
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com > > For other support
material please check also: > http://www.amibroker.com/support.html >
> > Yahoo! Groups Links > > > >
> > > > >
Yahoo!
Music Unlimited - Access over 1 million songs. Try it free.
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|