There you go:
ONCE StartTime = 080000
ONCE EndTime = 100000
ONCE BullCount = 0
ONCE BearCount = 0
Bullish = close > open
Bearish = close < open
IF Time = StartTime THEN
BullCount = 0
BearCount = 0
ENDIF
IF time >= StartTime AND time <= EndTime THEN
IF Bullish THEN
BullCount = BullCount + (close - open)
ENDIF
IF Bearish THEN
BearCount = BearCount + (open - close)
ENDIF
ENDIF
after EndTime both bullish and bearish candlesticks will have been tallied.
Next day the counting will be restarded at StartTime.
Link to above code added to here
Snippet Link Library
There you go:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
ONCE StartTime = 080000
ONCE EndTime = 100000
ONCE BullCount = 0
ONCE BearCount = 0
Bullish = close > open
Bearish = close < open
IF Time = StartTime THEN
BullCount= 0
BearCount= 0
ENDIF
IF time >= StartTime AND time <= EndTime THEN
IF Bullish THEN
BullCount= BullCount + (close – open)
ENDIF
IF Bearish THEN
BearCount= BearCount + (open – close)
ENDIF
ENDIF
|
after EndTime both bullish and bearish candlesticks will have been tallied.
Next day the counting will be restarded at StartTime.
Hi Roberto
This is close to what I need but it adds the cumulative bullish/bearish points to the previous session. I was hoping just to capture the number of bullish/bearish points for each individual session.
Does that make sense? I’ve tried to show this in the attached image.
Thanks again
Rob
Please do not quote posts unless necessary.
Everyday, at StartTime, it restarts.
The candle must CLOSE at StartTime, if you want to use a custom TF, say 7 or 36 minute TF you must either:
1 – change the StartTime and EndTime
2 – replace = with < at line 7.
You also need to remove = from line 11 if you want the time interval to be only > than StartTime and < EndTime.
Thanks Roberto but it’s still the total for the period rather than each candle that I’m after.
Thanks though.
Rob
I read you could do that individually but wanted their sum,
A single candle count is easy;
IF time >= 080000 AND time <= 100000 THEN
Count = abs(close - open)
ENDIF
RETURN
Of course you’ll have to add your conditions, other than bullish or bearish, if any, at lines 12 and 15.
My code is generic and counts all of them.
Hi Roberto thanks for the code listed above would it be possible to adapt it so it does a rolling count of bear and bullish candles that updates every hour ? I’ve been looking for something to help remove some losses with a long position on a 1 minute time frame and wondered if this could be adapted ? Happy to open a new thread if needed ?
Thanks in advance.
There you go:
ONCE BullCount = 0
ONCE BearCount = 0
Bullish = close > open
Bearish = close < open
IF OpenHour <> OpenHour[1] THEN
BullCount = 0
BearCount = 0
ENDIF
IF Bullish THEN
BullCount = BullCount + (close - open)
ENDIF
IF Bearish THEN
BearCount = BearCount + (open - close)
ENDIF
Return BullCount as “Bullish”, BearCount as “Bearish”
Perfect thanks Roberto.:)