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

Re: [amibroker] DayofWeek function help.



PureBytes Links

Trading Reference Links

Your Buy signal specifies dayofweek()==2 which is Tuesday, then you
have 1 bar delay in the settings, so entry would actually be on the
next bar whch would be Wednesday (if this is next market day)

-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


On 25/07/06, Keith Osborne <kosborn3@xxxxxxxxxxxxxx> wrote:
> Hi, need some help to get my head around DayofWeek() function.
>
> Using the following code I get buys on Wednesdays and not Mondays? Can
> someone see what I am doing wrong?
>
> TIA....Keith
>
> Filter = 1;                                     /* for scanning purposes */
>
> SetBarsRequired(100000,100000);              /* Load 100,000 bars */
> SetTradeDelays(1,1,0,0);                     /* I will get buy/sell
> signals after EOD and trade on the OPEN */
> Total_Equity = 200000;                         /*Param("Total Equity",
> 300000, 100000, 300000, 25000) */
> SetOption("InitialEquity", Total_Equity);
> Max_Pos = Param("Max Positions",  100,  10,  200,  1);
> SetOption("Maxopenpositions", Max_Pos);
> SetChartOptions(1,chartShowDates, chartShowArrows);
>
> /* RISK MANAGEMENT & POSITION SIZING*/
>
> Equity_per_Trade = 0.1; /* Maximum of 10% of Equity invested in any trade */
> Equity_at_Risk = 0.01;     /* Maximum of 1.00% of current equity risked
> in any trade */
> Risk_using_ATR = Param("Risk using ATR", 3, 1, 4, 0.05);
>
> Max_Equity_per_Trade = Equity_per_Trade * Total_Equity;
> Max_Risk_per_Trade = Equity_at_Risk * Total_Equity;
>
> PositionSize_using_ATR = Max_Risk_per_Trade / Nz(Risk_using_ATR * ATR(14));
> PositionSize = IIf(PositionSize_using_ATR >= Max_Equity_per_Trade,
> Max_Equity_per_Trade, PositionSize_using_ATR);
>
> // Buy CONDITIONS //
>
> Buy = C > Ref(C,-30) AND C < Ref(C,-9) AND DayOfWeek() == 2;
> BuyPrice = O;
>
> // MONEY MANAGEMENT //
>
> Sell = 0;
> SellPrice = C;
>
> // STOPS //
>
> Equity(1);
>
> /*
> 1 - regular exit
> 2 - Max. loss
> 3 - profit target
> 4 - trailing
> 5 - n-bar stop
> 6 - ruin stop
> */
>      ApplyStop(stopTypeNBar, stopModeBars, 1 , exitatstop = 0, volatile
> = False);
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
>