I am plotting 4 horizontal lines on the chart(for monthly, weekly, daily and hourly time frames) each at the close price of the last bar at the corresponding time frame
the problem is when I'm at the hourly timeframe all the four lines appear when I move to the weekly time frame for example, the lines of the lower time frames disappear (the hourly and the daily) if I moved to the monthly, only the monthly appears although everything is hard coded in the afl formula that I apply to the chart
any idea what might be causing this , help is truly appreciated ,thanks in advance.
The lines do not disappear. They just have prices of weekly, monthly interval then (if those latter ones are selected chart interval). Because with timeframe functions you can compress from shorter to longer interval not vice versa.
Please read docs:
Please note that you can only compress data from shorter interval to longer interval. So when working with 1-minute data you can compress to 2, 3, 4, 5, 6, ....N-minute data. But when working with 15 minute data you can not get 1-minute data bars. In a similar way if you have only EOD data you can not access intraday time frames.
If you want to view shorter interval line(s) on longer interval then store price(s) to static variable when shorter interval is selected.