"Automate" length for MTF standard deviation channel? (TOS)

JP782

New member
Platform
  1. Thinkorswim
I prefer using 5min data/indicators on 1 min charts, and one of those indicators I like using is a MTF standard deviation channel that goes out to ±4 deviations

In order to use it on a 1 minute chart I have to get the number of bars on a 5min chart where that number is entered as the length (bar count = length )for the MTF on the 1min chart

Every five minutes I have to manually update the length by increasing it by 1 to ensure the data is accurate(which they are until the next 5 min bar is formed where I have to update the number) After you input the length youre starting with, the indicator needs to increase that value +1 every X mins depending on whatever aggregation youre using

I do not know how to write the script to do this increase automatically. Can it be done?
 
I put your request in to chatGPT to see what happen. and I don't know if this would help, but a got an interesting study back

Code:
input length = 14;
input mult = 2.0;
def src = close;
def basis = Average(src, length);
def dev = mult * StDev(src, length);
def upper = basis + dev;
def lower = basis - dev;
plot basis = basis;
plot upperBand = upper;
plot lowerBand = lower;
 

JP782

New member
I put your request in to chatGPT to see what happen. and I don't know if this would help, but a got an interesting study back

Code:
input length = 14;
input mult = 2.0;
def src = close;
def basis = Average(src, length);
def dev = mult * StDev(src, length);
def upper = basis + dev;
def lower = basis - dev;
plot basis = basis;
plot upperBand = upper;
plot lowerBand = lower;
I already tried asking AI before posting here.... AI is not useful for complex TOS scripts, using language that are not functions of thinkscript
 
I've used ChatGPT several time to help with a scripts. when talking (writing) with chat I find sometimes easier to get it to cooperate, is simplify your request like ( I don't know how to do it and how do I add a label ). try to lead it to what you want a few requests.
 
Top