Greetings all,
Borrowing from @FutureTony's
https://usethinkscript.com/threads/naked-poc-finder-for-thinkorswim.8215/
I am trying to find the POC, VAH, VAL of a volume profile that is based on an entire trading session (pre, regular, and post) for a current day using monkey bars. I have tried with the attached code but it seems it is changing with changing aggregation. Please help.
Thanks
.
Borrowing from @FutureTony's
https://usethinkscript.com/threads/naked-poc-finder-for-thinkorswim.8215/
I am trying to find the POC, VAH, VAL of a volume profile that is based on an entire trading session (pre, regular, and post) for a current day using monkey bars. I have tried with the attached code but it seems it is changing with changing aggregation. Please help.
Thanks
Code:
def yyyymmdd = GetYYYYMMDD();
def multiplier = 1;
def period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
def count = CompoundValue(1, if period != period[1] then (GetValue(count, 1) + period - period[1]) % multiplier else GetValue(count, 1), 0);
def timeInterval = period;
def aggMultiplier = 1;
def agg_count = CompoundValue(1, if timeInterval != timeInterval[1] then (GetValue(agg_count, 1) + timeInterval - timeInterval[1]) % aggMultiplier else GetValue(agg_count, 1), 0);
def agg_cond = CompoundValue(1, agg_count < agg_count[1] + timeInterval - timeInterval[1], yes);
def digit = CompoundValue(1, if count then 1 else agg_cond + GetValue(digit, 1), 1);
profile monkey = MonkeyBars(digit, "startNewProfile" = count, "onExpansion" = no);
def con = CompoundValue(1, no, no);
def cond = CompoundValue(1, count < count[1] + period - period[1], yes);
profile vol = VolumeProfile(startnewprofile = cond, onExpansion = no);
def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
plot poc = pc;
Last edited by a moderator: