hi to all,
i am new here and start to learn programming to make my own indicators.
I hope someone can help me with my actual problem.
- i search the highest high and the lowest low on the 15 minutes chart between 8 and 9 o’clock
- the problem is that i get all the highs and lows from every candle in this timerange
thanks for the help in advance
kind regards
defparam calculateonlastbars = 100
if time > 080000 and time < 090000 then
HighestH = high //max(high,high)
LowestL = low //min(low,low)
//UpperRange = HighestH < HighestH[1] and HighestH > HighestH[2]
//BottomRange = LowestL > LowestL[1] and LowestL < LowestL[2]
endif
//if currentdayofweek = 1 or 2 or 3 or 4 or 5 then
drawray(barindex-1,HighestH,HighestH,HighestH) coloured(0,200,0) STYLE(line,2)
drawray(barindex-1,LowestL,LowestL,LowestL) coloured(200,0,0) STYLE(line,2)
//endif
return
At line 3 you should use >= and <=.
Lines 4-5 must be replaced by:
HighestH = max(high,HighestH)
LowestL = min(low,LowestL)
but you also need to reset them each day, at the beginning of the code, at line 2:
If IntraDayBarIndex = 0 then
HighestH = 0
LowestL = 999999
endif
defparam calculateonlastbars = 100
If IntraDayBarIndex = 0 then
HighestH = 0
LowestL = 99999
endif
if time >= 080000 and time <= 090000 then
HighestH = max(high,HighestH)
LowestL = min(low,LowestL)
endif
drawray(barindex-1,HighestH,HighestH,HighestH) coloured(0,200,0) STYLE(line,2)
drawray(barindex-1,LowestL,LowestL,LowestL) coloured(200,0,0) STYLE(line,2)
return
hi thanks for your help, i changed the code but its not working. attached is pictures of the result (chart) there should be only to lines
one upper and one bottom line. kind regards
You need to use as first or second line:
Defparam DrawOnLastBarOnly = true
try replacing max with highest and min with lowest and see how it goes
thanks it works, now i can go on with it