thetahunter
New member
I am trying to write some thinkscript code that returns the lowest open of three bars. where it gets tricky (for me at least) is I want it to return the lowest open price of the last 3 bars, and all 3 bars should be the same type, meaning the last 3 up bars or down bars. I only want it to take into consideration if the bars are going in the same direction.
So in total I want to disregard the current actively trading bar. Then count back the last 3 up bars (close > open), and then return the lowest open of those 3 bars. The lowest open could come from any of the 3 bars I just want to know what it is. Obviously the code should be dynamic and adjust as like colored bars are added the lowest open is moved or stays the same.
If it is no sweat to reverse the situation. Using the last 3 down bars (close < open) and returning the highest open in that situation.
This seems simple I just cant seem to pull it off. I will include some screenshots to help illustrate my ask.
Thanks in advance. Longtime lurker. first question. Sorry if it has been brought up in past I searched and could not find it.
15827[/ATTACH]']
15829[/ATTACH]']
15831[/ATTACH]']
So in total I want to disregard the current actively trading bar. Then count back the last 3 up bars (close > open), and then return the lowest open of those 3 bars. The lowest open could come from any of the 3 bars I just want to know what it is. Obviously the code should be dynamic and adjust as like colored bars are added the lowest open is moved or stays the same.
If it is no sweat to reverse the situation. Using the last 3 down bars (close < open) and returning the highest open in that situation.
This seems simple I just cant seem to pull it off. I will include some screenshots to help illustrate my ask.
Thanks in advance. Longtime lurker. first question. Sorry if it has been brought up in past I searched and could not find it.
15827[/ATTACH]']
Attachments
Last edited by a moderator: