Average of cumulative high and low for current day regular session hours


Category:
0
0

Hi Guys,

I am trying to make an on screen label that shows me the average “Net” movement of the overall intraday chart based off the 1M chart. I am new to thinkscripting and I want to figure out how to make this particular label start counting from 930 open market trading time; the issue I am having right now is that, in order for the numbers to be accurate, I have to change my timeframe to Today 1M instead of my ususal I have 1D 1M and also I have to turn premarket off; Other than that the calculation is completely different.

This is what I have right now, and please help me with starting this label at 930 starting open market without having to change my 1D 1M chart.

Script:

input time = open;

def candle = barNumber();
def highsum = totalsum(high);
def lowsum = totalsum(low);
def daychangeaverage = (highsum-lowsum)/candle;

addlabel(time, “NetAvg: ” + Daychangeaverage );

 

Attachments:
Marked as spam
Posted by (Questions: 3, Answers: 0)
Asked on April 12, 2020 1:17 pm
77 views
0
Private answer

The title of your question has been updated to reflect the context of your request. The title you originally entered was completely devoid of context. In the future, please be mindful of the rest of our viewing audience. The sole purpose of this Q&A forum is not for individuals. It only exists to serve the entire viewing audience. Any post that does not fit this goal will be subject to modification or deletion.

Here is the code:

input startTime = 930;
input endTime = 1559;
def regularSessionHours = SecondsFromTime(startTime) >= 0 and SecondsTillTime(endTime) >= 0;
def regularSessionStart = regularSessionHours and !regularSessionHours[1];
rec countRegularSessionBars = if regularSessionStart then 1 else if regularSessionHours then countRegularSessionBars[1] + 1 else countRegularSessionBars[1];
rec sumOfRegularSessionHighs = if regularSessionStart then high else if regularSessionHours then high + sumOfRegularSessionHighs[1] else sumOfRegularSessionHighs[1];
rec sumOfRegularSessionLows = if regularSessionStart then low else if regularSessionHours then low + sumOfRegularSessionLows[1] else sumOfRegularSessionLows[1];
def dayChangeAverage = (sumOfRegularSessionHighs - sumOfRegularSessionLows) / countRegularSessionBars;
AddLabel(yes, Concat("NetAvg: ", dayChangeAverage), Color.WHITE);

If anyone would like to apply this to a time frame other than 1 min, you will need to adjust the user input named endTime to be equal to the time stamp on the last bar of regular session hours.

Marked as spam
Posted by (Questions: 37, Answers: 4089)
Answered on April 12, 2020 6:59 pm