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

Re: [amibroker] ROTATIONAL TRADING WILL NOT USE OPENING PRICE ! !



PureBytes Links

Trading Reference Links

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! Groups Sponsor --------------------~--> 
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> 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/