Accessing Seconds from 1min Chart

Welkin

Welkin

Active member
VIP
Hi Welkin - Can this be copied straight to TOS script candle chart and work or need to modify some. Great job
sorry, I don't really understand your question, but I'm gonna take a stab at it anyway. The script needs to be ran on a chart with aggregation set to tick, otherwise it won't work correctly. You will need to adjust the number of ticks depending on volatility. late night globex i keep it at 1 to 5, but during rth you'll probably have to adjust 25+, depending on how active the stock you're observing is.
 
Welkin

Welkin

Active member
VIP
I have been reading this thread with great interest and i think the volumeprojection study by welkin is a great tool to spot big volume surge early before price change too much. And as i`ve been following the discussion here, i also had my own idea of how i would have liked the lower tick chart study to also analyze the buy/sell strenght of each cloud "moment". Basically, i would like to visually see how much of the volume in each 1min bar is buy volume vs sell volume. I know @Welkin already have this info as a label in his Advanced Volume indicator but i think it could be much more useful to have this shown visually in a lower study like the one here and to show this, one way could be to color the cloud dark red when sell volume exceeds 50% of the total 1min bar volume and vice versa, color dark green when buy volume exceeds 50%. And if buy/sell volume exceeds 70%, could also color the cloud in clear green/red. This would allow me to see in a early stage when there is big sudden spike in volume and if buyers are "in control" or if sellers meet the sudden high demand with more selling as they hit the bids which could be an indication for a stall/stuff move and then reversal back down again. For me personally, this would be extremely useful to have as i trade lots of small caps which often have these sudden volume spikes during the day.

Any chance you could try build something like this @Welkin ?

Thanks everyone contributing here in this thread, very interesting stuff :cool:
Yea, I was already playing around with that, it still needs to be smoothed out a little. I'll post something here soon for you to try. stay tuned :geek:
 
StockT8er

StockT8er

Member
VIP
This may be a million dollar question, but what indicator best predicts direction, with highest accuracy would this work
def MTvolumeBuying = V * (C - L) / (H - L);
def MTvolumeSelling = V * (H - C) / (H - L);
def MarketVolumeUp = if Average(MTvolumeBuying[5] > MTvolumeSelling[5]+Dev5) then 1 else 0;
def MarketVolumeDn = if Average(MTvolumeSelling[5]+Dev5 > MTvolumeBuying[5]) then 1 else 0;
 
Last edited:
M

ManniJ

New member
sorry, I don't really understand your question, but I'm gonna take a stab at it anyway. The script needs to be ran on a chart with aggregation set to tick, otherwise it won't work correctly. You will need to adjust the number of ticks depending on volatility. late night globex i keep it at 1 to 5, but during rth you'll probably have to adjust 25+, depending on how active the stock you're observing is.
sorry if I was not very clear in my previous inquiry. Since I have never played with the ticks and use conventional time frames only and buy - sell stocks only as day and swing trading, NO options or forex. I am making sure if your script will eventually reflect and show the volume flow on candle charts for executing stocks buy / sell? Thanks again.
 
Welkin

Welkin

Active member
VIP
sorry if I was not very clear in my previous inquiry. Since I have never played with the ticks and use conventional time frames only and buy - sell stocks only as day and swing trading, NO options or forex. I am making sure if your script will eventually reflect and show the volume flow on candle charts for executing stocks buy / sell? Thanks again.
From what I've seen the cumulative volume at the end of each cycle, for whatever aggregation you set it to, almost exactly matches with the volume given on a regular candlestick chart's bar at the close. I think its pretty accurate.
Just try it and see if it works for you.
 
MattATM

MattATM

Active member
VIP
With highest accuracy would this work??
def MTvolumeBuying = V * (C - L) / (H - L);
def MTvolumeSelling = V * (H - C) / (H - L);
def MarketVolumeUp = if Average(MTvolumeBuying[5] > MTvolumeSelling[5]+Dev5) then 1 else 0;
def MarketVolumeDn = if Average(MTvolumeSelling[5]+Dev5 > MTvolumeBuying[5]) then 1 else 0;
Kinda sorta Mr. Stockt8er, guys use that to compare what the volume was doing when the prices were going up or going down... The problem with that is say price is going up or down and then volume picks up??? Well we don't really know of the volume who was Buying on the Bid or Selling on the Ask ? Where they fighting the trend or friends with the trend? @StockT8er I think you might really like something like this

@Welkin I only had a couple minutes to look but it looks like Ben10 & friends already worked with some of the commands I was going to look at. I haven't done anything yet https://usethinkscript.com/threads/tick-buy-and-sell-volume-indicator-for-thinkorswim.534/
 
Welkin

Welkin

Active member
VIP
Kinda sorta Mr. Stockt8er, guys use that to compare what the volume was doing when the prices were going up or going down... The problem with that is say price is going up or down and then volume picks up??? Well we don't really know of the volume who was Buying on the Bid or Selling on the Ask ? Where they fighting the trend or friends with the trend? @StockT8er I think you might really like something like this

@Welkin I only had a couple minutes to look but it looks like Ben10 & friends already worked with some of the commands I was going to look at. I haven't done anything yet https://usethinkscript.com/threads/tick-buy-and-sell-volume-indicator-for-thinkorswim.534/
yea, that'll work on the regular charts but not tick charts... on a tick chart if tick_count() is assigned an aggregation it won't plot, if assigned bid/ask pricetypes it also won't plot. I think PriceType.MARK did plot? but thats not what we want to look at...:unsure:
 
T

Tony Stark

New member
yea, that'll work on the regular charts but not tick charts... on a tick chart if tick_count() is assigned an aggregation it won't plot, if assigned bid/ask pricetypes it also won't plot. I think PriceType.MARK did plot? but thats not what we want to look at...:unsure:
in other words they are purposely blocking it
 
rad14733

rad14733

Active member
VIP
in other words they are purposely blocking it
No, it isn't that "they" are blocking it, it has to do with time vs ticks... Ticks don't aggregate the same way time does and most studies aggregate based on time, not ticks... Ticks are arbitrary whereas time is a constant...
 
MattATM

MattATM

Active member
VIP
yea, that'll work on the regular charts but not tick charts... on a tick chart if tick_count() is assigned an aggregation it won't plot, if assigned bid/ask pricetypes it also won't plot. I think PriceType.MARK did plot? but thats not what we want to look at...:unsure:
Yes sir... I thought he wanted another lower for BuyvsSell
 
Welkin

Welkin

Active member
VIP
Sorry guys, haven't been scripting much the past 2 days, been dealing with some family stuff.

Yes sir... I thought he wanted another lower for BuyvsSell
yea, another lower indicator utilizing the time calculations from the projection script and using candle strength to try and determine buy/sell volume on a tick chart for 1 min candles.
edit: sorry... I was thinking this was in response to zeek's post... been a long few days... I need some sleep.
I have been reading this thread with great interest and i think the volumeprojection study by welkin is a great tool to spot big volume surge early before price change too much. And as i`ve been following the discussion here, i also had my own idea of how i would have liked the lower tick chart study to also analyze the buy/sell strenght of each cloud "moment". Basically, i would like to visually see how much of the volume in each 1min bar is buy volume vs sell volume. I know @Welkin already have this info as a label in his Advanced Volume indicator but i think it could be much more useful to have this shown visually in a lower study like the one here and to show this, one way could be to color the cloud dark red when sell volume exceeds 50% of the total 1min bar volume and vice versa, color dark green when buy volume exceeds 50%. And if buy/sell volume exceeds 70%, could also color the cloud in clear green/red. This would allow me to see in a early stage when there is big sudden spike in volume and if buyers are "in control" or if sellers meet the sudden high demand with more selling as they hit the bids which could be an indication for a stall/stuff move and then reversal back down again. For me personally, this would be extremely useful to have as i trade lots of small caps which often have these sudden volume spikes during the day.

Any chance you could try build something like this @Welkin ?

Thanks everyone contributing here in this thread, very interesting stuff :cool:
Here is what I've done so far, I stripped the main indicator down to just the cumulative volume and added two selections for 'buy/sell strength'. The first one, 'CandleStrength' is based off the calculations you made reference to from the Advanced Volume Indicator, which depends on where the close is positioned relative to the candle's range where a percentage is taken and multiplied by volume to get buy and sell volume ( though it is not true buy and sell volume of course...). The other works off of On Balance Volume and adds volume cumulatively depending on if the current bar's close is higher than the prior bar's close. If true then volume gets added cumulatively as buy volume, if not true then it is added cumulatively as selling volume...
Haven't been able to test it much because markets are closed, but looking at chart history it looks promising.
Didn't introduce the color scheme you referenced, but thats just cosmetics and can come in later... currently its just a red/green cloud depending on if the cumulative buy vol is greater than the cumulative sell vol.

Anyways, you guys play around with both and let me know your thoughts. ✍
I'll probably end up combining this with the main indicator some time later today, but until then here it is:

Code:
#[email protected]
#Attempt at Cumulative Buy/Sell Strength for Tick Charts
#v9.6.2020
declare lower;

def NA = Double.NaN;
input buyselltype = {CandleStrength, default OnBalanceVol};
input aggregationInSeconds = 60;
def aggtomin = aggregationInSeconds/60;

def start = 0000;
def end = 1600;
def o = open;
def h = high;
def l = low;
def c = close;
def v = volume;
def t = tick_count;
def bull = c > c[1];
def min = Floor(SecondsFromTime(start) / aggregationInSeconds);
def till = SecondsTillTime(end) / aggregationInSeconds;
def test = min != min[1];
def vc = if test and !test[1] then v else if !test then vc[1] + v else vc[1];

def b = ((c-l)/(h-l))*v;
def s = ((h-c)/(h-l))*v;
def cb;
def cs;
switch(buyselltype){
case CandleStrength:
cb = if test and !test[1] then b else if !test then cb[1] + b else cb[1];
cs = if test and !test[1] then s else if !test then cs[1] + s else cs[1];
case OnBalanceVol:
cb = if test and !test[1] and bull then v else if test and !test[1] and !bull then 0 else if !test and bull then cb[1]+v else cb[1];
cs = if test and !test[1] and !bull then v else if test and !test[1] and bull then 0 else if !test and !bull then cs[1]+v else cs[1];
}

def tickcount = if test and !test[1] then t else if !test then tickcount[1] + t else tickcount[1];
def prevtickcount = if test and !test[1] then tickcount[1] else prevtickcount[1];
def tickpercycle = prevtickcount/aggtomin;

def secondselapsed = (AbsValue(till - Ceil(till)) * aggregationInSeconds);
#def secondsleft = aggregationInSeconds - secondselapsed;
def percntelapsed = Round(((secondselapsed / aggregationInSeconds) * 100), 0);
def cl = if test then 1 else cl[1] + 1;
def ch = if test then cl[1] else ch[1];
def prevcumulativehigh = if test and !test[1] then vc[1] else prevcumulativehigh[1];
def prevcumulativebhigh = if test and !test[1] then cb[1] else prevcumulativebhigh[1];
def prevcumulativeshigh = if test and !test[1] then cs[1] else prevcumulativeshigh[1];
def cvolpassprev = vc >= prevcumulativehigh and vc[1] < prevcumulativehigh;
plot CVol = vc;
plot cvolpassprevsig = if cvolpassprev then vc else NA;
plot prevchigh = prevcumulativehigh;
plot cbuy = cb;
plot csell = cs;
def cbstest = cb>cs;

AddCloud(cbuy,csell, Color.GREEN, Color.RED);
AddLabel(1,"CVol: "+vc,Color.GRAY);
AddLabel(1,"BuyStr: "+Round(cb,0)+" / "+Round((cb/vc)*100,2)+"%", Color.GREEN);
AddLabel(1,"SellStr: "+Round(cs,0)+" / "+Round((cs/vc)*100,2)+"%", Color.RED);

AddVerticalLine(!IsNaN(cvolpassprevsig), "                 " + secondselapsed + "s / " + aggregationInSeconds + " | " + percntelapsed + "%", Color.CYAN);
AddVerticalLine(test, " Length " + cl[1] + "       CVol " + prevcumulativehigh, Color.GRAY, Curve.FIRM);

CVol.SetDefaultColor(Color.GRAY);
cbuy.SetDefaultColor(Color.GREEN);
csell.SetDefaultColor(Color.RED);
cvolpassprevsig.SetDefaultColor(Color.CYAN);
cvolpassprevsig.SetPaintingStrategy(PaintingStrategy.POINTS);
cvolpassprevsig.SetLineWeight(3);
prevchigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevchigh.SetDefaultColor(Color.YELLOW);

AddCloud(CVol, 0, Color.DARK_GRAY, Color.DARK_GRAY);
AddCloud(CVol, prevchigh, Color.YELLOW, Color.BLACK);
 
Last edited:
zeek

zeek

Active member
2019 Donor
I am playing around with this new Cumulative Buy/Sell Strenght study and i think it looks fantastic! Great job as always @Welkin (y)
Will do more testing tomorrow and give more feedback together with some questions but so far, really liking what i see here.
 
Welkin

Welkin

Active member
VIP
Ok as I said I combined the scripts, trimmed out some things that are now unnecessary, and made it a little more customizable.
Things are slowly being refined with everyone's input.
  • Projection can now be toggled on/off if you wish to only view the cumulative volume options.
  • Show cumulative buy/sell strength with two options, 'CandleStrength' which is the close relative to candle's range multiplied by volume, or 'OnBalanceVol' which keeps a cumulative buy/sell volume count based on whether the current bar closes higher than the prior.
  • Buy/Sell Strength can be shown ascending cumulatively similar to how the CVol is plotted (Gray Line) and/or it can be shown as a difference utilizing the previous cumulative high to act as the zeroline. So you can chose both ways/one/neither if you wish. I personally think the difference method is better.
  • Also added Strength labels, which shows estimated buy/sell volume and its percentage in relation to the total cumulative volume.


Code:
#[email protected]
#Attempt at Volume Projection on low TICK charts
#Thanks to YungTraderFromMontana and evanevans for the ideas
#v9.8.2020
declare lower;

def NA = Double.NaN;
input Sentiment = {default None, Inertia, HeikenAshiTrend, AboveBelowMovAvg, AboveBelowHighVolTriggeredVWAP};
input strengthType = {CandleStrength, default OnBalanceVol};
input showCumulativeStr = no;
input showCumulativeStrDiff = yes;
input aggregationInSeconds = 60;
def aggtomin = aggregationInSeconds / 60;
input toggleProjection = {enabled, default disabled};
input elapsedPercentSmoothValue = 5;
input elapsedProjectionDivisor = 2;
input showVerticalExceedPrevCvol = yes;
input showVerticalCycleEndCvol = yes;

def start = 0000;
def end = 1600;
def o = open;
def h = high;
def l = low;
def c = close;
def v = volume;
def t = tick_count;
def bull = c > c[1];
def bear = c < c[1];
def neutral = c == o;
def min = Floor(SecondsFromTime(start) / aggregationInSeconds);
def till = SecondsTillTime(end) / aggregationInSeconds;
def test = min != min[1];
def vc = if test and !test[1] then v else if !test then vc[1] + v else vc[1];

def b = ((c - l) / (h - l)) * v;
def s = ((h - c) / (h - l)) * v;
def cb;
def cs;
switch (strengthType){
case CandleStrength:
    cb = if test and !test[1] then b else if !test then cb[1] + b else cb[1];
    cs = if test and !test[1] then s else if !test then cs[1] + s else cs[1];
case OnBalanceVol:
    cb = if test and !test[1] and bull then v else if test and !test[1] and !bull then 0 else if !test and bull then cb[1] + v else cb[1];
    cs = if test and !test[1] and bear then v else if test and !test[1] and !bear then 0 else if !test and bear then cs[1] + v else cs[1];
}

#def tickcount = if test and !test[1] then t else if !test then tickcount[1] + t else tickcount[1];
#def prevtickcount = if test and !test[1] then tickcount[1] else prevtickcount[1];
#def tickperminute = prevtickcount/aggtomin;
#AddLabel(1, prevtickcount, COlor.Magenta);
#AddLabel(1,tickcount,Color.MAGENTA);
#AddLabel(1,tickperminute+" TPM",Color.MAGENTA);

def secondselapsed = (AbsValue(till - Ceil(till)) * aggregationInSeconds);
def secondsleft = aggregationInSeconds - secondselapsed;
def multipliertest = aggregationInSeconds / secondselapsed;
def multiplier  = if IsInfinite(multipliertest) then NA else multipliertest;
def percntelapsed = Round(((secondselapsed / aggregationInSeconds) * 100), 0);
def cl = if test then 1 else cl[1] + 1;
def ch = if test then cl[1] else ch[1];
def prevcumulativehigh = if test and !test[1] then vc[1] else prevcumulativehigh[1];
def cvolpassprev = vc >= prevcumulativehigh and vc[1] < prevcumulativehigh;
def highestprevchigh = HighestAll(prevcumulativehigh);
def projectioncalc = vc * multiplier;

######################
#Inertia
input inertiaLength = 20;
input inertiaPrice = close;
def inertia = Inertia(inertiaPrice, inertiaLength);

######################
#Heiken Ashi
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2, (o[1] + c[1]) / 2);
HAhigh = Max(Max(h, HAopen), HAclose[1]);
HAlow = Min(Min(l, HAopen), HAclose[1]);
HAclose = ohlc4;

######################
#Above Below Moving Average
input movAvgPrice = close;
input movAvgType = AverageType.EXPONENTIAL;
input movAvg1Length = 20;
input movAvg2Length = 30;
input movAvg3Length = 40;
input movAvg4Length = 50;
def MA1 = MovingAverage(movAvgType, movAvgPrice, movAvg1Length);
def MA2 = MovingAverage(movAvgType, movAvgPrice, movAvg2Length);
def MA3 = MovingAverage(movAvgType, movAvgPrice, movAvg3Length);
def MA4 = MovingAverage(movAvgType, movAvgPrice, movAvg4Length);
def MA12test = MA1 > MA2;
def MA23test = MA2 > MA3;
#def MA34test = MA3 > MA4;

######################
#Sigma Vol Filters
input avgVolLength = 20;
input volAverageType = AverageType.SIMPLE;
input Sigma2 = 2.0;
input Sigma3 = 3.0;
def VolAvg = MovingAverage(volAverageType, v, avgVolLength);
def sDev = StDev(data = v, length = avgVolLength);
def VolSigma2 = VolAvg + Sigma2 * sDev;
def VolSigma3 = VolAvg + Sigma3 * sDev;

######################
#VWAP
def vconf = if v > VolSigma3 then 1 else if v > VolSigma2 then 1 else 0;
def VolumeSum = if vconf then v else CompoundValue(1, VolumeSum[1] + v, v);
def VolumeVwapSum = if vconf then v * vwap else CompoundValue(1, VolumeVwapSum[1] + v * vwap, v * vwap);
def volumeVwap2Sum = if vconf then v * Sqr(vwap) else CompoundValue(1, volumeVwap2Sum[1] + v * Sqr(vwap), v * Sqr(vwap));
def VW = if !IsNaN(c) then VolumeVwapSum / VolumeSum else VW[1];

######################

plot cvolpassprevsig = if cvolpassprev then vc else NA;
plot CVol = vc;
plot prevchigh = prevcumulativehigh;
plot cycleavg = Round(TotalSum(if test and !test[1] then ch[1] else 0) / min, 1);
plot cyclehigh = ch;
plot cyclelength = cl;

plot projection;
switch (toggleProjection){
case enabled:
    projection = if (projectioncalc >= highestprevchigh) and (percntelapsed < elapsedPercentSmoothValue) then projectioncalc / elapsedProjectionDivisor else projectioncalc;
case disabled:
    projection = NA;
}
cycleavg.Hide();
cyclehigh.Hide();
cyclelength.Hide();

plot bsdiff = prevchigh + (cb - cs);
bsdiff.SetHiding(!showCumulativeStrDiff);
def bsdiffaboveztest = bsdiff > prevchigh;
bsdiff.AssignValueColor(if bsdiffaboveztest and bsdiff > bsdiff[1] then Color.GREEN else if bsdiffaboveztest and bsdiff <= bsdiff[1] then Color.DARK_GREEN else if !bsdiffaboveztest and bsdiff < bsdiff[1] then Color.RED else Color.DARK_RED);
plot cbuy = cb;
cbuy.SetHiding(!showCumulativeStr);
plot csell = cs;
csell.SetHiding(!showCumulativeStr);

def Pos;
def Neg;
switch (Sentiment){
case None:
    Pos = NA;
    Neg = NA;
case Inertia:
    Pos = inertia > inertia[1];
    Neg = !Pos;
case HeikenAshiTrend:
    Pos = HAclose > HAopen;
    Neg = !Pos;
case AboveBelowMovAvg:
    Pos = MA12test and MA23test;
    Neg = !Pos;
case AboveBelowHighVolTriggeredVWAP:
    Pos = close > VW;
    Neg = !Pos;
}


#Vertical Lines
AddVerticalLine(showVerticalExceedPrevCvol and !IsNaN(cvolpassprevsig), "                 " + secondselapsed + "s / " + aggregationInSeconds + " | " + percntelapsed + "%", Color.CYAN);
AddVerticalLine(showVerticalCycleEndCvol and test, "Lngth " + cyclelength[1] + "  CVol " + prevcumulativehigh + "  B/S " + Round((cb[1] / vc[1]) * 100, 0) + "/" + +Round((cs[1] / vc[1]) * 100, 0) + "%", Color.GRAY, Curve.FIRM);

#Labels

input showCycleLengthLabel = yes;
input showPrevCycleLengthLabel = yes;
input showCycleAvgLengthLabel = no;
input showTotalCyclesLabel = no;
input showSecsElapsedLabel = yes;
input showCumulativeVolLabel = yes;
input showBuyStrLabel = yes;
input showSellStrLabel = yes;
input showPrevCVolLabel = yes;
input showRelToPrevCVolLabel = yes;
input showProjectedVolLabel = yes;
input showProjMultiplierLabel = no;


AddLabel(showCycleLengthLabel, "Cycle Length: " + cyclelength[1], Color.GRAY);
AddLabel(showPrevCycleLengthLabel, "Prev Cycle Length: " + cyclehigh, Color.GRAY);
AddLabel(showCycleAvgLengthLabel, "Cycle Avg Length: " + cycleavg, Color.GRAY);
AddLabel(showTotalCyclesLabel, "Cycles Since Start: " + min, Color.GRAY);
AddLabel(showSecsElapsedLabel, "Secs " + secondselapsed + "/" + aggregationInSeconds + "   " + percntelapsed + "%", Color.YELLOW);
AddLabel(showCumulativeVolLabel, "CVol: " + vc, Color.WHITE);
AddLabel(1, "BuyStr: " + Round(cb, 0) + " / " + Round((cb / vc) * 100, 2) + "%", Color.GREEN);
AddLabel(1, "SellStr: " + Round(cs, 0) + " / " + Round((cs / vc) * 100, 2) + "%", Color.RED);
AddLabel(showPrevCVolLabel, "Prev CVol: " + prevcumulativehigh, Color.WHITE);
AddLabel(showRelToPrevCVolLabel, "x" + Round(vc / prevcumulativehigh, 2) + " Prev CVol", Color.WHITE);
AddLabel(showProjectedVolLabel and toggleProjection == toggleProjection.enabled, "Proj Vol: " + Round(projection, 0), Color.DARK_ORANGE);
AddLabel(showProjMultiplierLabel and toggleProjection == toggleProjection.enabled, "Proj Multiplier x" + Round(multiplier, 2), Color.DARK_ORANGE);

CVol.SetDefaultColor(Color.DARK_GRAY);
CVol.AssignValueColor(if toggleProjection == toggleProjection.disabled and Pos then Color.GREEN else if Neg then Color.RED else Color.GRAY);
CVol.SetLineWeight(2);
prevchigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevchigh.SetDefaultColor(Color.YELLOW);
projection.SetDefaultColor(Color.DARK_ORANGE);
projection.AssignValueColor(if Pos then Color.GREEN else if Neg then Color.RED else Color.GRAY);
projection.SetLineWeight(2);
cvolpassprevsig.SetPaintingStrategy(PaintingStrategy.POINTS);
cvolpassprevsig.SetLineWeight(3);

AddCloud(if showCumulativeStr then cbuy else NA, csell, Color.GREEN, Color.RED);
AddCloud(if showCumulativeStrDiff then bsdiff else NA, prevchigh, Color.GREEN, Color.RED);
AddCloud(projection, CVol, CreateColor(0, 100, 200), CreateColor(0, 100, 200));
AddCloud(CVol, 0, Color.DARK_GRAY, Color.DARK_GRAY);
AddCloud(CVol, prevchigh, Color.YELLOW, Color.BLACK);
 
Last edited:
MattATM

MattATM

Active member
VIP
Mr. Welkin how do you feel about Accumulation / Distribution?



One your 1 min chart I put a CMFV, to run it on the ticks chart it would need to accumulate over time so it does not have gaps...
but before I did that I wanted to see do you want to do a comparison between Acc/Dist and something else like OBV?
Depending on how you like to visualize it, movements are shown before trends
Code:
declare lower;
#############################################
# What would be good to compare to CMFV?????#
#############################################
#correlation is a simple script:
#Correlation = Covariance(CMFV???, data2 WHAT?????, length) / ( StDev(data1, length) * StDev(data2, length) )
#############################################
def o=open; def c=close; def h=high; def l=low; def V=Volume;
######Begin CMFV######
#def buying=(C-L);
#def selling=(H-C);
#def rangespan = (H - L);
#What about UNFILLED GAPS?! That Would ruin the volume calculation!
#Use a correction equivalent
def equivHi = if h < c[1] then c[1] else h;
def equivLo = if l > c[1] then c[1] else l;
def buying = (c - equivLo);
def selling = (equivHi - c);
def rangespan = (equivHi - equivLo);
def MinValue = 0;
def MaxValue = 1;
#Current Money Flow Volume as used by accumulationDistribution CMFV
plot CMFV = (V * ((buying - selling) / rangespan));
CMFV.assignValueColor(If CMFV>=CMFV[1] then color.Green else color.red);
CMFV.setPaintingStrategy(paintingStrategy.LINE);
CMFV.setlineWeight(3);
def PlotToNormalize = CMFV;

plot NormalizedCMFV = ((MaxValue - MinValue) * (PlotToNormalize - LowestAll(PlotToNormalize)) / (HighestAll(PlotToNormalize) - LowestAll(PlotToNormalize)) + MinValue) * 100;
NormalizedCMFV.assignValueColor(If CMFV>=CMFV[1] then color.white else color.pink);
NormalizedCMFV.setPaintingStrategy(paintingStrategy.LINE);
NormalizedCMFV.setlineWeight(2);
input ShowCurrentMoneyFlowVolume = yes;

AddLabel(ShowCurrentMoneyFlowVolume, "CMFV(Acc/Dist) %=" + NormalizedCMFV, (if NormalizedCMFV > NormalizedCMFV[1] then Color.LIGHT_GREEN else if NormalizedCMFV < NormalizedCMFV[1] then Color.PINK else Color.YELLOW));
http://tos.mx/35srWeD
 
MattATM

MattATM

Active member
VIP
@Welkin I should have looked at UseThinkscript.com before it was this late. This time I am tired lol.
I understand in the tick Volumes will be rough until we look for a 'saturation' or threshold number to be reached before a potential price move.
We can use the Covariance to compare one thing to another. For instance CMFV could spike before a good move or just from (buyers/sellers) holding support or resistance. For instance on my white support line here it looks like both the Acc/Dist and OBV moved consinderably to establish the 1st support and for the rest of that white line they didn't care much...



What would you like me to try Covariance on @Welkin ?

PS Hope family gets better and you have a good rest of holiday
 
MattATM

MattATM

Active member
VIP
@Welkin the reason I did just instant Normalized CMFV so I can see the relative vigor in the Volume of trades...
Because it is "Normalized" you I left it on a chart of 15 days... If the chart length was very short the lowest would be 0% and the greatest would be 100%. Doesn't have to stay that way...
ToLongDidn'tRead TLDR
Look at how the CMFV hauls off and SMACKS 🤜 at certain times like creating this white Support Line
 
R

rene6985

New member
VIP
Usually the volume explode during the overbought and oversold passing on the William percentage indicator, has anybody
make a study of this .
 
MattATM

MattATM

Active member
VIP
Usually the volume explode during the overbought and oversold passing on the William percentage indicator, has anybody
make a study of this .
No I have not I guess I will try to do the correlation with WilliamsR%
 
Welkin

Welkin

Active member
VIP
Mr. Welkin how do you feel about Accumulation / Distribution?

One your 1 min chart I put a CMFV, to run it on the ticks chart it would need to accumulate over time so it does not have gaps...
but before I did that I wanted to see do you want to do a comparison between Acc/Dist and something else like OBV?
Depending on how you like to visualize it, movements are shown before trends
Love A/D... I've played around with it for a while and use a modified aspect of the formula every day. You (and others) will probably find this useful:
http://tos.mx/vc5Mjo8
the ADL formula was modified a bit, volume isn't included in the calculation, and the highs and lows in the formula were replaced to use higher aggregation values with a small twist. Whichever value is the highest or lowest, the current bar's high/low or previous bar's high/low. It is then multiplied by 100. this sets a floor/ceiling of -100/+100, and a threshold of 90(default but adjustable) is set. When the close comes at or above the +/-90 threshold vertical lines begin plotting, signaling either a potential break higher or met with strong resistance causing a reversal. Can usually capture some nice moves with this, especially when paired with standard deviation bands for mean reversion strats.

As for AD on tick charts it is as you said, it would require an accumulation of data of a certain length of time or it would require higher tick charts to get rid of the gaps due to the small amount of bar data that can be sampled. On low tick charts the bars are very low spread and have a lack of bar structure. The formulas that rely on OHLCs don't do so well because of this and is why we gotta bump up the tick aggregation until we have better samples of data for the formula to operate on. The 'candlestrength' aspect and some of the earlier sentiment options on the vol projection script have/had this issue...


@Welkin I should have looked at UseThinkscript.com before it was this late. This time I am tired lol.
I understand in the tick Volumes will be rough until we look for a 'saturation' or threshold number to be reached before a potential price move.
We can use the Covariance to compare one thing to another. For instance CMFV could spike before a good move or just from (buyers/sellers) holding support or resistance. For instance on my white support line here it looks like both the Acc/Dist and OBV moved consinderably to establish the 1st support and for the rest of that white line they didn't care much...

What would you like me to try Covariance on @Welkin ?

PS Hope family gets better and you have a good rest of holiday
I'm not sure... I want to start introducing market internals to the mix. Things like $ADD/$VOLD/$TICK and the VIX...

Appreciate the well wishes, currently my brother is scheduled for surgery tomorrow for a cystoscopy... he has a blockage in his left kidney and they are going to try and find out whats going on. Hopefully its just some kidney stones...

@Welkin the reason I did just instant Normalized CMFV so I can see the relative vigor in the Volume of trades...
Because it is "Normalized" you I left it on a chart of 15 days... If the chart length was very short the lowest would be 0% and the greatest would be 100%. Doesn't have to stay that way...
ToLongDidn'tRead TLDR
Look at how the CMFV hauls off and SMACKS 🤜 at certain times like creating this white Support Line
I see that, should try putting some bollinger or std dev bands on it and see what kind of signals it gives.
 
Last edited:

Similar threads

Top