Turi
Turi

Reputation: 77

How to solve background color increasing Timeframe?

Thanks to the new function of version 5, we can select the timeframe for the indicators in literally a line of code. However when I try to change the timeframe setting the color of some indicators doesn't seem to work very well. Here is an example: Graph at 1H and indicator set at 4H. It appears to be plotting the color to the new single 4H candle. You can check the same thing with ichimoku, if you set the timeframe

enter image description here

Anyone have an idea how to solve this "problem"?

Upvotes: 0

Views: 212

Answers (1)

beeholder
beeholder

Reputation: 1699

The only way is to use request.security() in your script instead of the timeframe parameter. While timeframe calculates everything at a different timeframe, including plot and bgcolor data, request.security() will allow you to do calculations on a separate timeframe, but still color the chart on every bar because the main body of the script is still calculated on the chart's timeframe.

Upvotes: 1

Related Questions