OPEN-SOURCE SCRIPT
Volumetric Compressed MA

VCMA uses the compressor and weighted stdev functions originally translated to pine by @gorx1. Compressor is usually used in audio to avoid clipping of certain frequencies. The original idea is actually pretty simple:
Pine Script®
We get the ratio of the compressed volume calculation and plot it with the base MA. Base MA's length is determined by window size input compared to ML length that is used for compressed version.
This provides us another possible confirmation indicator that can be used to take advantage of volume ranges. Autmated crossover alerts are also added. A reminder is that this kind of indicators should not be used on it's own for trading but rather should be used as a confirmation along with your trend detection and main entry indicators to provide additional confluence.
ma(simple string smt, float src, simple int len) =>
switch smt
'RMA' => ta.rma(src, len)
'SMA' => ta.sma(src, len)
'EMA' => ta.ema(src, len)
'WMA' => ta.wma(src, len)
'HMA' => ta.hma(src, len)
'LSMA' => ta.linreg(src, len, 0)
=> na
compressor(float in_1, simple int len, simple int thresh_dn_m, simple int thresh_up_m) =>
data = math.log(math.abs(in_1))
loc = ta.wma(data, len)
dev = wstdev(data, len)
thresh_dn = loc + dev * thresh_dn_m
thresh_up = loc + dev * thresh_up_m
math.exp(math.min(math.max(data, thresh_up), thresh_dn)) - math.exp(thresh_up)
compressed_out = compressor(volume, len_window, up_thresh, down_thresh)
comp_ma = ma(ma_type, close * compressed_out, len_ml) / ma(ma_type, compressed_out, len_ml)
vwma = ma(ma_type, close, len_window)
We get the ratio of the compressed volume calculation and plot it with the base MA. Base MA's length is determined by window size input compared to ML length that is used for compressed version.
This provides us another possible confirmation indicator that can be used to take advantage of volume ranges. Autmated crossover alerts are also added. A reminder is that this kind of indicators should not be used on it's own for trading but rather should be used as a confirmation along with your trend detection and main entry indicators to provide additional confluence.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
One does not simply win every trade.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
One does not simply win every trade.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.