Volume label for premarket aftermarket and regular session


Category:
0
0

Hello please can u help me with the script for thinkorswim that show addlabel premarket volume  and show only during premarket hours and in market hours addlabel day volume and when afterhours i want aaddlabel afterhours volume and hide day volume

Marked as spam
Posted by (Questions: 12, Answers: 5)
Asked on October 2, 2023 8:19 am
200 views
0
Private answer

For this solution we can use the code from this previous solution and make only one minor modification:

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

The modification we need to make is in the very last line of that code.

We simply change this:

AddLabel(yes, Concat("Target Period Volume: ", volumeTotal), Color.GRAY);

To this:

AddLabel(targetPeriod, Concat("Target Period Volume: ", volumeTotal), Color.GRAY);

Here is the full solution after applying that one minor modification:

input startTime = 400;
input endTime = 929;
def startCounter = SecondsFromTime(startTime);
def endCounter = SecondsTillTime(endTime);
def targetPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;
rec volumeTotal = if targetPeriod and !targetPeriod[1] then volume else
if targetPeriod then volumeTotal[1] + volume else volumeTotal[1];
AddLabel(targetPeriod, Concat("Target Period Volume: ", volumeTotal), Color.GRAY);

When you apply this script to a new chart study, you can add that chart study to the chart three times. Then adjust each of those three to different start times and end times.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 2, 2023 6:49 pm
0
Pete, question, I\’m trying to add the 4 different studies, but I\’m not sure what\’s the correct time syntax to do such, every time I add time syntax it restores to defaults, I\’m looking to add 4 different syntaxes for: 16:00 to 20:00 (only extended market after hours) 16:00 to 09:29 (extended marker after hours + next day pre market) 04:00 to 09:29 (this is the default provided within the code) 09:30 to 15:59 (regular market hours) what would be the settings for each of those time?,ive tried different settings with no luck), i entered the start and end time like 900 and 1559 and dont seem to work for the 09:30 to 15:59, etc
( at March 11, 2024 12:06 pm)
0
The intention was not to modify the code to adjust the start and end time. The intention is to create one custom indicator, add it to the chart 3 times. Then for each instance of the indicator, change the start and end time as required. In your case, you would add the custom study to the chart 4 times. And adjust the settings for each to whatever you want. You don't need to modify the code to do this.
( at March 11, 2024 12:31 pm)