Hello friends. I am stumped. I've gotten pretty far but can't designate my chart to start fresh at 0930 ET.
I'm doing a point comparison between two futures symbols.
Im trying to take the value of the first future at Market Open (0930) and subtracting it's current value whatever it might be at anytime throughout the day.
Doing the same for the second symbol. And then getting a final difference between the two.
symbol 1 ( Open - Current Value)
- (minus)
symbol 2 (Open - Current Value)
The issue I'm having is that the Open Value always reverts to 1800 ET when futures reopen. I'd like to plot the value of the 0930 market open instead.
Note: Both symbols need to be entered in the chart: /MNQ-/MES
Any help is Greatly appreciated. Code Attached.
Thank you.
declare lower;
plot zerobase = 0;
input start = 0930;
input ShowTodayOnly = {default "No", "Yes"};
input showOnlyLastPeriod = yes;
input aggregationPeriod = AggregationPeriod.DAY;
def time = SecondsTillTime(start);
def o1 = open(GetSymbolPart(1), aggregationPeriod);
def c1 = close(GetSymbolPart(1));
def o2 = open(GetSymbolPart(2), aggregationPeriod);
def c2 = close(GetSymbolPart(2));
def s1_open = if time and aggregationPeriod then o1 else s1_open[1];
def s2_open = if time and aggregationPeriod then o2 else s2_open[1];
def s1_value = if time and aggregationPeriod then (c1 - s1_open) else (c1 - s1_open) ;
def s2_value = if time and aggregationPeriod then (c2 - s2_open) else (c2 - s2_open) ;
plot s1value = (s1_value);
s1value.SetDefaultColor(CreateColor (200, 200, 200));
plot s2value = (s2_value);
s2value.SetDefaultColor(CreateColor (255, 0, 255));
AddVerticalLine(SecondsTillTime(1800) == 0, "Futures OPEN", Color.WHITE, Curve.SHORT_DASH);
AddVerticalLine(SecondsTillTime(0930) == 0, "Market OPEN", Color.WHITE, Curve.SHORT_DASH);
I'm doing a point comparison between two futures symbols.
Im trying to take the value of the first future at Market Open (0930) and subtracting it's current value whatever it might be at anytime throughout the day.
Doing the same for the second symbol. And then getting a final difference between the two.
symbol 1 ( Open - Current Value)
- (minus)
symbol 2 (Open - Current Value)
The issue I'm having is that the Open Value always reverts to 1800 ET when futures reopen. I'd like to plot the value of the 0930 market open instead.
Note: Both symbols need to be entered in the chart: /MNQ-/MES
Any help is Greatly appreciated. Code Attached.
Thank you.
declare lower;
plot zerobase = 0;
input start = 0930;
input ShowTodayOnly = {default "No", "Yes"};
input showOnlyLastPeriod = yes;
input aggregationPeriod = AggregationPeriod.DAY;
def time = SecondsTillTime(start);
def o1 = open(GetSymbolPart(1), aggregationPeriod);
def c1 = close(GetSymbolPart(1));
def o2 = open(GetSymbolPart(2), aggregationPeriod);
def c2 = close(GetSymbolPart(2));
def s1_open = if time and aggregationPeriod then o1 else s1_open[1];
def s2_open = if time and aggregationPeriod then o2 else s2_open[1];
def s1_value = if time and aggregationPeriod then (c1 - s1_open) else (c1 - s1_open) ;
def s2_value = if time and aggregationPeriod then (c2 - s2_open) else (c2 - s2_open) ;
plot s1value = (s1_value);
s1value.SetDefaultColor(CreateColor (200, 200, 200));
plot s2value = (s2_value);
s2value.SetDefaultColor(CreateColor (255, 0, 255));
AddVerticalLine(SecondsTillTime(1800) == 0, "Futures OPEN", Color.WHITE, Curve.SHORT_DASH);
AddVerticalLine(SecondsTillTime(0930) == 0, "Market OPEN", Color.WHITE, Curve.SHORT_DASH);
Last edited: