Originally I had tried to implement this logic using the ATR indicator with a period of one and a 10 minute consolidator, giving me a true range, but from what I could gather, it was updating every minute, so I was not actually receiving a 10 minute range. Anyways, I have tried to just create the values myself by subtracting the high from the low of a trade bar, then performing a std deviation calculation on that list, but something is clearly wrong, and I have looked at it 1000 times and can't find the answer. 

In short, what I want to have is a list containing 39 values (390 minutes in session/10 minutes) representing the price difference of the high and low for a given security in that ten minute consolidated bar. For example, if stock x opens at 9:30 at 100$, then at 9:35 it reaches high 101$, then closes at 9:39:59 at 100.50, 101high -100low = 1$, then 38 more times. 

So ultimately, I can perform this calculation

2 * (np.std[1.00, 1.27, 0.54, 0.75, etc…………………….…..]) 

 

I have commented the lines of code which are important/where the problem is likely located. 

 

Thanks