• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Adding Standard Deviation & Color to watchlist, coding help please!


New member
Question, I was wondering if someone would be able to code a custom column for me, that when a stock is 2 standard deviations or more away from the mean, that column would turn "Green" and if it was within 2 standard deviations the column would remain "Black".

Been scouring the internet to find something like this and I have had no luck, would really, really appreciate any help with this.

Ps- been developing a plan for swing trading with this, and if it works, I would love to come back and share it.

Thank you!


What would be the original source for the standard deviations? For example, VWAP has its own 2 standard dev. Same goes for Bollinger Bands.


New member
Just using the StandardDevChannel study within ToS, 21 length, while on a (30 day, 30 minute) chart. Within the study it has a upper, middle and lower line, I was hoping someone would be able to to figure it out if you could coincide the colors if it was 2 SD or more away.


New member
Hi everyone,

I am trying to create a custom column in a watchlist that will tell me the price to reach the standard deviation line between 1 & -1

For context:

I trade off momentum using standard deviation, when the price action is above 3 standard deviations I short the price back to 1 standard deviation line

When the price action is below -3 standard deviations I go long back to -1 standard deviation line

on my watch lists I use the following scanner to tell me the price action for the 1 minute 1 day chart: https://tos.mx/uvvvxnO this scan will show me tickers whose price action is outside the 1 & -1 standard deviation so I can play off the price action back into the trend intra day.


Using this scan as a watchlist I would like to create a custom column that will tell me the price back to the trend (either the standard deviation 1 or standard deviation -1)

what would be the best approach to accomplish this?

thank you for the help!


Well-known member
@Vincenzo You've pretty much explained the logic so now you just need to turn the logic into actionable code which can be partly accomplished using the Stock Hacker Scanner's Condition Wizard and then tweak further with manual code... Let the Condition Wizard do most of the work and then proceed from there... Live in the Thinkscript Learning Center the whole time and things should fall into place... That's the easiest way to learn... When I come up with a new idea I use the same methods because it reduces prototyping time and insures that simple mistakes aren't missed...

Similar threads