♥ 0 |
Would it be possible to script an indicator to start at a specified time? For instance, the bollinger bands carry the effect of prior expansion, and lag to show a full squeeze as it forms. But is it possible to add options to the code to force it to start at an arbitrary point, such as the open of the market, without carrying the prior day’s activity. This would be like the market profile that starts at the open, not reflecting the prior days influence. Thanks!
input price = close; def sDev = stdev(data = price[-displace], length = length); plot MidLine = MovingAverage(averageType, data = price[-displace], length = length); LowerBand.SetDefaultColor(GetColor(0));
Marked as spam
|
Private answer
What you are asking for would actually make the indicator nearly useless. Notice the default length is 20. When using the default length and simple moving average it would take 20 bars AFTER that arbitrary point in time before the moving average can be computed. When the chart is set to a 15 minute time frame and the start point is the market open the indicator would only be able to plot on the last 6 candles of the trading session. If you move down to the 5 min time frame while using the same start point the indicator would not plot for the first 25% of the trading session. For an indicator of this type, any time frame less than 5 min is totally useless. Nothing but noise down there and very little signal. FYI, you can do this without modifications on the TradeStation platform. Set the chart to display only the current trading session and add the indicator to the chart. TradeStation does not use "prefetch" so each plot (using your example) must wait until 20 candles have been added to the current trading session before the indicator would begin to plot. The reason this does not work on Thinkorswim is because this platform uses "prefetch". Don't have a clue what "prefetch" means? Check the following article form our Kitchen Sink: https://www.hahn-tech.com/moving-averages-exponential-problems/
Marked as spam
|
Please log in to post questions.