Prison Mike
Member
I have been learning a lot about auction theory, volume profile, value areas and use POC plots when I am trading on my phone. In my "studies" SKEW has come up as a way to give context to an average. My strategy has been plotting weekly and previous day's POC, HVA and LVA and monitoring how price reacts.
I thought I would add some context to POC by coding a simple SKEW lower study that could be seen on my phone so I went about chopping up the Volume Profile indicator and adding the SKEW formula at the end...and something isn't right....
One skew formula states:
Skew = ((3*(mean - median)) / Standard Deviation);
First, does the math look right? I'm now thinking the skew should be related to value areas rather than point of control?
Second, when only "skew" is plotted the scale is way off. Maybe bc of the volume profile code messing it up but skew values should be from 0-2, much like a put/call ratio
On another note maybe other applications of skew could be trend strength, or a weighted moving average.
I thought I would add some context to POC by coding a simple SKEW lower study that could be seen on my phone so I went about chopping up the Volume Profile indicator and adding the SKEW formula at the end...and something isn't right....
One skew formula states:
Skew = ((3*(mean - median)) / Standard Deviation);
Code:
input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default month, MINUTE, HOUR, DAY, WEEK, chart, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = no;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = no;
input valueAreaPercent = 70;
def period;
def yyyymmdd = GetYYYYMMDD();
def seconds = SecondsFromTime(0);
def month = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def dom = GetDayOfMonth(yyyymmdd);
def dow = GetDayOfWeek(yyyymmdd - dom + 1);
def expthismonth = (if dow > 5 then 27 else 20) - dow;
def exp_opt = month + (dom > expthismonth);
switch (timePerProfile) {
case CHART:
period = 0;
case MINUTE:
period = Floor(seconds / 60 + day_number * 24 * 60);
case HOUR:
period = Floor(seconds / 3600 + day_number * 24);
case DAY:
period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
period = Floor(day_number / 7);
case MONTH:
period = Floor(month - First(month));
case "OPT EXP":
period = exp_opt - First(exp_opt);
case BAR:
period = BarNumber() - 1;
}
def count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % multiplier else count[1], 0);
def cond = count < count[1] + period - period[1];
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
height = PricePerRow.AUTOMATIC;
case TICKSIZE:
height = PricePerRow.TICKSIZE;
case CUSTOM:
height = customRowHeight;
}
profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent);
def con = CompoundValue(1, onExpansion, no);
def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
def hVA = if IsNaN(vol.GetHighestValueArea()) and con then hVA[1] else vol.GetHighestValueArea();
def lVA = if IsNaN(vol.GetLowestValueArea()) and con then lVA[1] else vol.GetLowestValueArea();
def hProfile = if IsNaN(vol.GetHighest()) and con then hProfile[1] else vol.GetHighest();
def lProfile = if IsNaN(vol.GetLowest()) and con then lProfile[1] else vol.GetLowest();
def plotsDomain = IsNaN(close) == onExpansion;
def POC = if plotsDomain then pc else Double.NaN;
def VAHigh = if plotsDomain then hVA else Double.NaN;
def VALow = if plotsDomain then lVA else Double.NaN;
#skew
declare lower;
declare zerobase;
input skewlength = 5;
plot mean = Average (POC, skewlength);
plot med = median(POC, skewlength);
plot SD = StDev(POC, skewlength);
plot skew = ((3*(mean - med)) / SD);
First, does the math look right? I'm now thinking the skew should be related to value areas rather than point of control?
Second, when only "skew" is plotted the scale is way off. Maybe bc of the volume profile code messing it up but skew values should be from 0-2, much like a put/call ratio
On another note maybe other applications of skew could be trend strength, or a weighted moving average.