I'm attempting to acquire the high and low of the day and use those data points as a variable to take action from. I came across a post with a sample and this is working fine for the high, but is way off for the low. The low of the day right now is 3808 and it is showing 3657 so it's got to be going all the way back to Sunday open for that. The instrument I'm using is /MES.
//return high and low of RTH session if (regularTradingHours) { if (Bars.IsFirstBarOfSession) { Print("Calculating trading day for " + Time[0]); // use the current bar time to calculate the next session sessionIterator.GetNextSession(Time[0], true); // store the desired session information beginTime = sessionIterator.ActualSessionBegin; } var startBarsAgo = Bars.GetBar(beginTime); Print("startBarsAgo = " + startBarsAgo); double highestHigh = MAX(High, CurrentBar - startBarsAgo + 1)[0]; // Now that we have the start and end bars ago values for the specified time range we can calculate the lowest low for this range var lowestLow = MIN(Low, CurrentBar - startBarsAgo + 1)[0]; // Set the plot values HighestHigh[0] = highestHigh; LowestLow[0] = lowestLow; Draw.TextFixed(this, "highLowText", HighestHigh[0] + " High | " + LowestLow[0] + " Low", TextPosition.TopLeft); HighestHigh[0] = HighestHigh[1]; LowestLow[0] = LowestLow[1]; }
Hoping for some guidance or a working example as I'm having a difficult time figuring this one out.
Thanks!
Comment