I updated the below, because I found the answer to my question about the difference between Futures and RTH for calculating the open.
https://usethinkscript.com/threads/pre-market-after-market-for-thinkorswim.75/#post-330
Hello,
I have found a ton of really great scripts on here for marking levels such as ONL, ONH, yesterdays close and today open. Unfortunately, since I trade futures I'm running into an issue because the Open and Close time differs from RTH and I would like to calculate yesterday's RTH close, High and low, but at 1600 yesterday not 1800 which is when Futures close. I also want to mark the open, but since Futures open isn't at 0930 I'm having issues. I will probably need to adjust a few different scripts, so I'd like have an idea how to present the argument. I have also been searching for some hours to find the answer, but haven't found any and even found people asking for it, but to no avail.
Here is an example of a prev. day close script that is calculating based on 1800 and not 1600
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
input deviation = 20;
plot PreviousDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) { PreviousDayClose = Double.NaN;}
else { PreviousDayClose = Highest(close(period = aggregationPeriod)[-displace], length);}
PreviousDayClose.SetLineWeight(3);
PreviousDayClose.SetDefaultColor(Color.GREEN);
https://usethinkscript.com/threads/pre-market-after-market-for-thinkorswim.75/#post-330
Hello,
I have found a ton of really great scripts on here for marking levels such as ONL, ONH, yesterdays close and today open. Unfortunately, since I trade futures I'm running into an issue because the Open and Close time differs from RTH and I would like to calculate yesterday's RTH close, High and low, but at 1600 yesterday not 1800 which is when Futures close. I also want to mark the open, but since Futures open isn't at 0930 I'm having issues. I will probably need to adjust a few different scripts, so I'd like have an idea how to present the argument. I have also been searching for some hours to find the answer, but haven't found any and even found people asking for it, but to no avail.
Here is an example of a prev. day close script that is calculating based on 1800 and not 1600
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
input deviation = 20;
plot PreviousDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) { PreviousDayClose = Double.NaN;}
else { PreviousDayClose = Highest(close(period = aggregationPeriod)[-displace], length);}
PreviousDayClose.SetLineWeight(3);
PreviousDayClose.SetDefaultColor(Color.GREEN);
Last edited: