Thinkscript Custom Standard Deviation Labels


New member
Would like to have the bars on the chart that shows the average SD per day, like in this picture.


Any help would be greatly appreciated.


New member
I would like to get the standard deviation I have on my spreadsheet on to TOS to help in trading options. Personally, I try to stay 1-2 standard deviations away from the current price. If anyone has any interest in coding this, it would be much appreciated. I thank you in advance!

I was hoping to display +/-1 and +/-2 standard deviations on the charts. It would be similar to this post below, however, I use a different method to calculate standard deviation which I find more reliable.

I use the equation below for 1 standard deviation. For 2 standard deviations, I just multiply by 2.

Current Stock Price * [(implied volatility + historical volatility)/2] * square root of the "number of days" / square root of 365

I imagine the variables that would need to be inputed in the settings would be "number of days" which would range from 1-30.

The labels I'd ideally want are below. This is an example using a stock with a price of 781, with implied volatility + historical volatility/2 = .45, which was set for "number of days" = 5

1SD: 41 // 2SD: 82 // -2SD: 699 // -1SD: 740 // +1SD: 822 // +2SD: 863


Well-known member
@thinkscriptnewb Have you done any research here to see whether any code already exists that does what you expect, or can be modified to do so...??? Due diligence and learning to do for yourself is an expectation here... I understand that you are new and may not be fully up to speed here but we normally don't just bang out code upon request... We're willing to help those who are willing to help themselves... There are plenty of sites out there where you can pay for pre-made indicators but we don't feel that people should have to pay for what is freely available... Most of the code you find here was written to serve someone's own needs and then shared freely... But it isn't just written upon request... Thinkscript isn't all that hard compared to some other languages and we've had members who have never coded previously learn rapidly... Be a self-starter rather than relying on others to write code that controls the future of your money...

Similar threads