Percent change from previous day close to opening high or low


Tags:
Category:
0
0

I’m looking for a label to display the percentage difference from yesterday’s close to the high of the first bar of the day on all time frames. Any assistance would be greatly appreciated.

Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on July 27, 2024 2:31 pm
31 views
0
Private answer

I struggle to see how this will be helpful to the majority of our viewers so I was very close to deleting your question. This forum is intended to provide solutions which service the interest of the majority of our viewers. This is not the place to seek a solution for a custom on-off solution which serves the interest of a single individual. Please keep this in mind for any questions you post to this forum in the future.

I updated the title of your question to include the full context of your request. This will make it easier for the rest of our viewers to know what to expect when they see this in the list of topics and click on the link to view it. Your original title for this question was "Close to High" and that was far to vague to be useful to the rest of our audience.

Just keep those things in mind so that you can get the most from your participation in this forum.

Here is a solution which places labels on the chart for the percent difference from the previous day close the the high and low of the opening candle of the new session. You must exclude extended trading hours on your chart in order for this to work.

input decimalsToRound = 1;
def newDay = GetDay() <> GetDay()[1];
rec openingHigh = if newDay then high else openingHigh[1];
rec openingLow = if newDay then low else openingLow[1];
def priorDayClose = close(period = AggregationPeriod.DAY)[1];
def prctHigh = Round(100 * (openingHigh / priorDayClose - 1), decimalsToRound);
def prctLow = Round(100 * (openingLow / priorDayClose - 1), decimalsToRound);
AddLabel(yes, Concat("Prct High: ", prctHigh), Color.CYAN);
AddLabel(yes, Concat("Prct Low: ", prctLow), Color.MAGENTA);

Marked as spam
Posted by (Questions: 37, Answers: 4108)
Answered on July 27, 2024 2:45 pm