♥ 0 |
I wrote a simple code for my watchlist to let me know if the current hour candle is green(Up), red(Down), or white(Neither), for only market hours (no pre/post market data). I’ve hid the “Extended-Hours Trading Session” on my hourly charts so the candle will start at the bottom of the hour, i.e. 9:30am, instead of 9:00am (which happens when premarket data is shown).
Here’s my code: plot dir = if close > open then 1 else if open == close then 0 else -1; AddLabel(yes, if dir == 1 then “G” else if dir == 0 then “U” else “R”, if dir == 1 then Color.black else Color.white); AssignBackgroundColor(if dir == 1 then Color.green else if dir == 0 then Color.white else color.red);
I made sure that the “Include Extended-Hours Trading Session” checkbox was unchecked. Whenever I look at my watchlist, the color inconsistently matches the hourly bar. When I allow my hourly charts to show premarket data, the codes matches it perfectly, but that’s not what I want. I need this code to match the candles that are at the bottom f the hour, not the top.
Thank you in advance for your assistance.
Marked as spam
|
Please log in to post questions.
Thank you for your quick response. I really enjoy your site and I have learned a lot through your videos and reading numerous questions and answers here. You are a godsend for Thinkscript.