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);






------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/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:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to