Hi
I am doing a algo that only will trade specific hours (that is, not "between" 00 - 06, but rather 00, 01, 05 and 06).
The problem is that my IIF function only gives back the first of my "OR" hours. The code is;
initial = 100000;
SetOption( "InitialEquity", initial );
lev1 = 1;
lev = 1 / lev1 ;
MarginDeposit = 100000 * lev;
SetOption( "PriceBoundChecking", False );
SetOption( "ActivateStopsImmediately", True );
SetPositionSize( initial , spsValue );
SetOption( "CommissionMode", 3 );
SetOption( "CommissionAmount", 3.7 );
spread_ic = 0.01;
Hour_ok = IIf( Hour() == (
00
OR 01
OR 02
OR 02
OR 03
OR 04
OR 05
OR 06), 1, 0 );
t1 = 10;
t2 = 3;
t3 = 200;
tp_m = 1;
sl_m = 0.5;
bb_t = Ref( BBandtop( c, t1, t2 ), -1 );
bb_b = Ref( BBandBot( c, t1, t2 ), -1 );
e_ma = Ref( eMA( C, t3 ) , -1 );
SetTradeDelays( 0, 0, 0, 0 );
Buy = h > bb_b AND
o < bb_b AND
bb_b > e_ma AND
Hour_ok == 1;
BuyPrice = bb_b + spread_ic ;
Sell = Null;
short = l < bb_t AND
O > bb_t AND
bb_t < e_ma AND
Hour_ok == 1;
ShortPrice = bb_t - spread_ic;
Cover = Null;
ApplyStop( stopTypeProfit, stopModePercent, tp_m, 1, 1, 1, 0 );
ApplyStop( stopTypeLoss, stopModePercent, SL_m , 1, 1, 1, 0 );
This code will only trade at Hour 01, and not at 02 - 06. I assume it is something wrong with the "OR" statement, but I can't figure out what.. Any ideas where to start to investigate?