oskartinksw88
New member
Hello,
I borrowed some of this code:
https://usethinkscript.com/threads/intraday-hod-lod-for-thinkorswim.6365/#post-61699
for a study I am working on, in which I am trying to return the values for the HOD and LOD from a specific period (1800 to 0900). That is over two days (start of the Asian session and 30 minutes prior to the start of the NY session.
So basically, I am trying to trap time for the entire day. For example, if you were log into your account on Thursday at 11 a.m. and ran the study it would return the same value as if you log into your account 9 a.m. on Thursday. The value would not change until Friday.
Please find an attachment, where the study was added to the chart.
The study returns a value of "15,721.125"({HOD + LOD}/2) which is wrong based on what I desire. It uses the high, "15,895.75) from the 11:55 a.m. candle which is outside my range (the accurate high should be "15,750" established on the 8:30 a.m. candle).
The low, "15,546.50" was established at 12:15 a.m. candle, within the range I desire.
So the correct figure would be "15,648.25" (15,750 + 15,546.5)/2.
I would like the figure to be the static regardless of what timeframe you're trading on. Is that possible?
I'm new to learning ThinkScript.
Please find below what I have so far.
Thanks in advance for any assistance you can provide. Much appreciated.
declare hide_on_daily;
input OpenTime = 1800;
input EntTime = 0900;
input DurationMinutes = 15;
input showLabels = yes;
def durationSec = DurationMinutes * 15 * 60;
def secondsPassed = SecondsFromTime(OpenTime);
def HOD = HighestAll(if IsNaN(close[-1])
then high(period = "Day")
else Double.NaN);
def LOD = LowestAll(if IsNaN(close[-1])
then low (period = "Day")
else Double.NaN);
input length = 5;
def mid = (hod + lod)/2;
AddLabel(yes, "MP " + mid, Color.YELLOW);
plot MP = if secondsPassed >= 0 and secondsPassed <= durationSec then mid else double.NaN;
mp.SetDefaultColor(Color.YEllOW);
mp.HideBubble();
I borrowed some of this code:
https://usethinkscript.com/threads/intraday-hod-lod-for-thinkorswim.6365/#post-61699
for a study I am working on, in which I am trying to return the values for the HOD and LOD from a specific period (1800 to 0900). That is over two days (start of the Asian session and 30 minutes prior to the start of the NY session.
So basically, I am trying to trap time for the entire day. For example, if you were log into your account on Thursday at 11 a.m. and ran the study it would return the same value as if you log into your account 9 a.m. on Thursday. The value would not change until Friday.
Please find an attachment, where the study was added to the chart.
The study returns a value of "15,721.125"({HOD + LOD}/2) which is wrong based on what I desire. It uses the high, "15,895.75) from the 11:55 a.m. candle which is outside my range (the accurate high should be "15,750" established on the 8:30 a.m. candle).
The low, "15,546.50" was established at 12:15 a.m. candle, within the range I desire.
So the correct figure would be "15,648.25" (15,750 + 15,546.5)/2.
I would like the figure to be the static regardless of what timeframe you're trading on. Is that possible?
I'm new to learning ThinkScript.
Please find below what I have so far.
Thanks in advance for any assistance you can provide. Much appreciated.
declare hide_on_daily;
input OpenTime = 1800;
input EntTime = 0900;
input DurationMinutes = 15;
input showLabels = yes;
def durationSec = DurationMinutes * 15 * 60;
def secondsPassed = SecondsFromTime(OpenTime);
def HOD = HighestAll(if IsNaN(close[-1])
then high(period = "Day")
else Double.NaN);
def LOD = LowestAll(if IsNaN(close[-1])
then low (period = "Day")
else Double.NaN);
input length = 5;
def mid = (hod + lod)/2;
AddLabel(yes, "MP " + mid, Color.YELLOW);
plot MP = if secondsPassed >= 0 and secondsPassed <= durationSec then mid else double.NaN;
mp.SetDefaultColor(Color.YEllOW);
mp.HideBubble();
Last edited by a moderator: