Re: MT4 Indicator requests and ideas
Posted: Sat Dec 12, 2020 5:58 am
indis and tpl
As per rules links aren't permitted here. Please make the effort to upload all files and photos directly to your post. If you're unsure on how to do this, please see here: How to attach images and indicators.MarketMage wrote: Sat Dec 12, 2020 1:12 pm Hi Mr Tools, would it be possible to code an MT4 version of Volume+ (RVOL by Time) Indicator as displayed here:
It is a tradingview indicator and the source code is available for free right there on that page (in tradingview indicator language)
THANKS!!!!
Mod edit: Link removed
Code: Select all
//@version=4
// Created by Matthew J. Slabosz
// www.zenandtheartoftrading.com
study(title="Volume (RVOL By Time of Day)", shorttitle="Volume+")
// Get user input
type = input(title="Market", defval='Stocks', type=input.string, options=['Forex', 'Crypto', 'Futures', 'Stocks', 'TSX Stocks'])
lookback = input(title="Lookback Period", type=input.integer, defval=15)
alertPercent = input(title="Alert At RVOL %", type=input.float, defval=0.0)
barColorOption = input(title="Color Scheme", defval='Price', type=input.string, options=['Heatmap', 'Traffic', 'Trigger', 'Price'])
// Get order/tick volume data
totalVolume = volume - volume
for i = 1 to lookback by 1
if type == "Forex"
totalVolume := totalVolume + (timeframe.period == "1" ? 0 :
timeframe.period == "3" ? 0 : timeframe.period == "5" ? volume[i * 288] :
timeframe.period == "10" ? volume[i * 144] :
timeframe.period == "15" ? volume[i * 96] :
timeframe.period == "30" ? volume[i * 48] :
timeframe.period == "45" ? volume[i * 32] :
timeframe.period == "60" ? volume[i * 24] :
timeframe.period == "120" ? volume[i * 12] :
timeframe.period == "180" ? volume[i * 8] :
timeframe.period == "240" ? volume[i * 6] :
timeframe.period == "D" ? volume[i * 5] :
timeframe.period == "W" ? volume[i * 4] : 0)
if type == "Crypto"
totalVolume := totalVolume + (timeframe.period == "1" ? 0 :
timeframe.period == "3" ? 0 : timeframe.period == "5" ? volume[i * 288] :
timeframe.period == "10" ? volume[i * 144] :
timeframe.period == "15" ? volume[i * 96] :
timeframe.period == "30" ? volume[i * 48] :
timeframe.period == "45" ? volume[i * 32] :
timeframe.period == "60" ? volume[i * 24] :
timeframe.period == "120" ? volume[i * 12] :
timeframe.period == "180" ? volume[i * 8] :
timeframe.period == "240" ? volume[i * 6] :
timeframe.period == "D" ? volume[i * 7] :
timeframe.period == "W" ? volume[i * 4] : 0)
if type == "Stocks"
totalVolume := totalVolume + (timeframe.period == "1" ? 0 :
timeframe.period == "3" ? 0 : timeframe.period == "5" ? volume[i * 78] :
timeframe.period == "10" ? volume[i * 39] :
timeframe.period == "15" ? volume[i * 26] :
timeframe.period == "30" ? volume[i * 13] :
timeframe.period == "45" ? volume[i * 9] :
timeframe.period == "60" ? volume[i * 7] :
timeframe.period == "120" ? volume[i * 4] :
timeframe.period == "180" ? volume[i * 3] :
timeframe.period == "240" ? volume[i * 2] :
timeframe.period == "D" ? volume[i * 5] :
timeframe.period == "W" ? volume[i * 4] : 0)
if type == "TSX Stocks"
totalVolume := totalVolume + (timeframe.period == "1" ? 0 :
timeframe.period == "3" ? 0 : timeframe.period == "5" ? volume[i * 79] :
timeframe.period == "10" ? volume[i * 40] :
timeframe.period == "15" ? volume[i * 27] :
timeframe.period == "30" ? volume[i * 14] :
timeframe.period == "45" ? volume[i * 9] :
timeframe.period == "60" ? volume[i * 7] :
timeframe.period == "120" ? volume[i * 4] :
timeframe.period == "180" ? volume[i * 3] :
timeframe.period == "240" ? volume[i * 2] :
timeframe.period == "D" ? volume[i * 5] :
timeframe.period == "W" ? volume[i * 4] : 0)
if type == "Futures"
totalVolume := totalVolume + (timeframe.period == "1" ? 0 :
timeframe.period == "3" ? 0 : timeframe.period == "5" ? volume[i * 273] :
timeframe.period == "15" ? volume[i * 138] :
timeframe.period == "15" ? volume[i * 92] :
timeframe.period == "30" ? volume[i * 46] :
timeframe.period == "45" ? volume[i * 31] :
timeframe.period == "60" ? volume[i * 23] :
timeframe.period == "120" ? volume[i * 12] :
timeframe.period == "180" ? volume[i * 8] :
timeframe.period == "240" ? volume[i * 6] :
timeframe.period == "D" ? volume[i * 4] :
timeframe.period == "W" ? volume[i * 4] : 0)
// Calculate average volume for this bar
avgVolume = totalVolume / lookback
// Calculate relative volume percentage for this bar
volumePercent = volume / avgVolume
// Determine if this candle exceeds the average
alert = alertPercent == 0.0 and volume > avgVolume and timeframe.period != "1" and
timeframe.period != "3" or alertPercent != 0.0 and volumePercent >= alertPercent
// Determine volume bar color
barColor = color.gray
// Heatmap Color Scheme
if barColorOption == "Heatmap" and volumePercent >= 0.25
barColor := #005000
if barColorOption == "Heatmap" and volumePercent >= 0.50
barColor := #007000
if barColorOption == "Heatmap" and volumePercent >= 0.75
barColor := #009900
if barColorOption == "Heatmap" and volumePercent >= 1
barColor := #00dd00
if barColorOption == "Heatmap" and volumePercent >= 2
barColor := #00ff00
// Traffic Light Color Scheme
if barColorOption == "Traffic" and volumePercent >= 1.00
barColor := #ff1d00
if barColorOption == "Traffic" and volumePercent >= 1.50
barColor := color.orange
if barColorOption == "Traffic" and volumePercent >= 2.0
barColor := color.green
if barColorOption == "Traffic" and volumePercent >= 3.0
barColor := #00ff00
// Trigger Color Scheme
if barColorOption == "Trigger"
barColor := alert ? color.teal : color.gray
// Colored Scheme
if barColorOption == "Price" and close >= open
barColor := #5cbcb3
if barColorOption == "Price" and close < open
barColor := #f37e7c
if alertPercent != 0.0 and volumePercent >= alertPercent
barColor := color.teal
// Draw average volume column
plot(avgVolume, style=plot.style_columns, color=color.gray, title="Average Bars", transp=66)
// Draw current volume column
plot(volume, style=plot.style_columns, color=barColor, title="Volume Bars", transp=0)
// Draw data
plot(avgVolume, style=plot.style_line, color=color.purple, title="Average Line", transp=0)
plot(volumePercent, style=plot.style_line, color=color.blue, title="Percentage", transp=100)
// Send out an alert if this candle meets our conditions
alertcondition(alert, title="Volume Alert!", message="Volume signal for {{ticker}}")
Thank you for posting all the info
Hi MrTools, please advise if this repaints tdi_rsx_based_-_adaptive_smoothed__alerts__lines__divergence.mq4mrtools wrote: Sun Feb 19, 2017 7:01 am There has been a lot of upgrades in a lot of things related to this indicator, think will be able to use a lot of them in this indicator.Will work on it.
Doesn't look like it repaints, except the divergence.DVanAssen wrote: Mon Dec 14, 2020 5:53 am
Hi MrTools, please advise if this repaints tdi_rsx_based_-_adaptive_smoothed__alerts__lines__divergence.mq4
viewtopic.php?p=1294861017#p1294861017