Guys,
Not sure if this is the right forum; Requesting a modification (if possible) to the indicator below. I am looking to add a time selection input of 30min, 1 hour, 4 hour, Day, so that the buy and sell percentage labels reflect the input selected time frame? Is this possible? If so, can somebody write the appropriate script additions for me?
Not sure if this is the right forum; Requesting a modification (if possible) to the indicator below. I am looking to add a time selection input of 30min, 1 hour, 4 hour, Day, so that the buy and sell percentage labels reflect the input selected time frame? Is this possible? If so, can somebody write the appropriate script additions for me?
Code:
plot Data = close;declare upper;
def today = GetDay() == GetLastDay();
def midPrice = (high + low) / 2;
# Only count volume during today's session
def buyVol = if close > midPrice and today then volume else 0;
def sellVol = if close < midPrice and today then volume else 0;
# Accumulate today's buy/sell volume
def buyVolSum = TotalSum(buyVol);
def sellVolSum = TotalSum(sellVol);
def totalVol = buyVolSum + sellVolSum;
# Calculate %
def buyPct = if totalVol > 0 then (buyVolSum / totalVol) * 100 else 0;
def sellPct = if totalVol > 0 then (sellVolSum / totalVol) * 100 else 0;
# Display labels
AddLabel(yes, "Buy %: " + Round(buyPct, 1) + "%", Color.darK_GREEN);
AddLabel(yes, "Sell %: " + Round(sellPct, 1) + "%", Color.RED);
Thanks Much!
G
Last edited by a moderator: