Hello,
I’m not sure, but sometimes i have problems when trying to the day of the Week. I use OpenDayOfWeek but the output is always “7”. The demo code I’m using is below. Any ideas on why is this function failing to provide the day of the week as expecte?
PercentageChange=1
Performance=0
//Condition1=range>(High[1]-low[1])
BuyCondition=close>(open+(High[1]-low[1])*PercentageChange)
//DayCondition=OPENDAYOFWEEK
//Stoploss=(high[1]-low[1])*0.5
GRAPH DayCondition
IF NOT LongOnMarket and BuyCondition then //and DayCondition THEN
BUY AT market
SET STOP $loss 1500
ENDIF
// Conditions to exit long positions
SellCondition=positionperf>Performance
If LongOnMarket AND SellCondition THEN
SELL AT MARKET
ENDIF
I changed line 7 like that
GRAPH OpenDayOfWeek //DayCondition
and it works finely for TFs up to h1, then Daily (EurUsd, default trading times, no display of weekend data).
It shows problems with h2, because the last candle opening at 23:00 CET on thursday OpenDayOfWeek returns 4 correctly, while on friday it returns 0! The same problem occurs with h4 TF, on friday at 21:00 CET it returns 4, while on friday it returns 0!
You should try different settings, and possibly address PRT for a thorough description of the data OpenDayOfWeek should return.
Thanks a lot,
The problem was simpler than i thought. After reading your comments I checked the time frame and it was set to “Weekly”. Sorry, my (fool) mistake.