After Hours Volume Label


Category:
0
0

hey I have a PM volume label that shows up in my volume bar. I edited the times in the PM code to AH times and it will show when AH starts but still shows PM volume from earlier that day instead of AH volume. I will paste the code of the PM volume. I changed the premarket words to afterhours but still didnt work. Obviously the AH code I edited isnt correct. Can you help?

Premarket volume code that works:

# PreMarketForecast Volume
# TOS
def LabelTime = if SecondsFromTime(0400) > 0 and
SecondsTillTime(2000) >= 0
then 1
else 0;
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;
def PreMarketVol = if IsNaN(vol) then PreMarketVol[1] else vol;
AddLabel(LabelTime, “PreMarket Volume = ” + PreMarketVol, Color.WHITE);

 

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on July 12, 2020 1:25 am
726 views
0
Here is AH code I edited which was unsuccessful: # Afterhours Forecast Volume # TOS def LabelTime = if SecondsFromTime(1600) > 0 and SecondsTillTime(2000) >= 0 then 1 else 0; def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1]; def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD()); def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN; def afterhoursVol = if IsNaN(vol) then afterhoursVol[1] else vol; AddLabel(LabelTime, "AH Volume = " + afterhoursVol, Color.WHITE);
( at July 12, 2020 1:26 am)
0
Private answer

I had to read through this several times before I understand that AH stands for After Hours and PM stands for Premarket. Please spell that out in the future. I have not found anyone using those abbreviations.

The code in the following post was for premarket volume. However the way I constructed the code allows the user to input whatever start and end times they need. This was for a watchlist column but it's the same exact code to use for adding a label to a chart.

Here is link to the post. Be sure to read the full explanation and follow the additional links included in my solution so you can get the full context of what this code does and how to apply it.

https://www.hahn-tech.com/ans/watchlist-columns-for-pre-market-volume/

 

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on July 12, 2020 11:23 am