Display Only A Specific time 4 Hr Candle On the Chart


Category:
0
0

Hi Pete,

Can you write a code for the subject mentioned above? I am looking for to see only specific time 4 hr candle on the 4 hr chart ? Like there is an input for the 4 hr start time and I can see particular that 4 hr candles on the chart and other candles either don’t show up or other all candles can be assigned a color of choice,

Thank you,

Shaishav

RESOLVED
Marked as spam
Posted by (Questions: 49, Answers: 62)
Asked on November 9, 2019 2:50 pm
40 views
0
Private answer

You can use this code included in the question asked by.... oh. Looks like it was posted by you:

https://www.hahn-tech.com/ans/specific-time-colored-candle/

I just tested that code just as you supplied it. Changed the time from 1400 to 900 and it changed the 9 o'clock bars to yellow. There is no way to hide candles on the chart. So this is the best we can do.

But if you want to set the other candles to match the background color you can modify the last statement in your original code:

AssignPriceColor(if candleblue then color.yelloW else color.BLACK);

That works if the background color of your chart is black. Of course you need to include the rest of the code from that post I linked.

Did you search for this solution before posting your request? If so, did you see this post but pass it up because you didn't think it would work?

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on November 10, 2019 8:57 am
0
I knew about the earlier of my code but I was trying to find if its possible to hide the candles which is not. Now I will use the solution you mentioned. Thank you.
( at November 10, 2019 2:06 pm)
0
Hi Pete, As per below, I am getting all pit open 9 am candles as yellow. Can you take it one step up further and modify it to show the yellow candles as the original candle color - Green or red,? input OpenTime = 900; input Durationmin = 30; def secondsPassed = secondsFromTime(OpenTime); def durationSec = Durationmin * 30; def CandleBlue = secondsPassed >= 0 and secondsPassed
( at November 10, 2019 2:25 pm)
0
In the very last line. Change "color.yelloW" to "Color.CURRENT"
( at November 10, 2019 5:29 pm)