Re: MT4 Indicator requests and ideas

11703
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
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.
Guide to the "All Averages" Filters (ADXvma, Laguerre etc.) 🆕
Use Fibonacci numbers for indicator settings + How to draw Fibonacci Extensions
An easy trick for drawing Support & Resistance

Re: MT4 Indicator requests and ideas

11704
OK, 2nd try. file with tradingview code attached:
(would be great to include option to use either ticks for volume OR real volume such as exists for CFDs in MT4)

Hi Mr Tools, would it be possible to code an MT4 version of Volume+ (RVOL by Time) Indicator ?

It is a tradingview indicator and the source code is attached. (in tradingview indicator language)

THANKS!!!!

description:

This script is an enhanced volume indicator.

It calculates relative volume (RVOL) based on the average volume by time of day (rather than a simple moving average).

For example, using this indicator you can see today’s volume during the first 5-minute candle of the market open compared to the previous day’s volume at the market open.

Or you can see today’s volume at the market close during the last 15-minute candle compared to the average of the past 20 days of volume at the market close.

Due to the different quantity of candlesticks in a session between Stocks and Forex/Crypto, I separated those markets into separate settings, making this an all-in-one RVOL indicator that works on all markets.

Settings

Market:
Choose from Stocks, Futures, Forex and Crypto. Stocks [<5m] is for traders wanting to use this indicator on Stocks below the 5-minute timeframe (ie. 1-minute and 3-minute charts).

Lookback Period:
How many sessions to calculate for. For example, a 20 period lookback on the 5-minute chart will show you the average volume for the past 20 days of price action for each 5-minute candle.

A 1 period lookback will show you yesterday’s volume relative to today’s.

Alert At RVOL %:
If you leave this at zero it has no effect. If you change it, then whenever a volume bar exceeds this % of the average, you will get an alert. You have to set up the alerts first through the TradingView interface before this will trigger.

If you leave this at zero and set a TradingView alert, then an alert will be triggered whenever volume exceeds the average. Changing the color scheme to Trigger will show you which volume bars trigger alerts.

Color Scheme:
There are four different color settings:

Heatmap – Changes color to be brighter based on higher RVOL
Price – Changes color based on price action
Traffic – Changes color based on RVOL percentages (for fast visual cues)
Trigger – Changes color only when the specified alert conditions are met

Heatmap:
Turns very bright green at 2.0 RVOL
Turns light green at 1.0 RVOL
Turns normal green at 0.75 RVOL
Turns medium green at 0.5 RVOL
Turns very dark green at 0.25 RVOL
Is gray otherwise.

Price:
Turns red if the price action candle closed bearish.
Turns green if the price action candle closed bullish.

Traffic:
Turns red if RVOL is between 1.0 and 1.5.
Turns orange if RVOL is between 1.5 and 2.0.
Turns dark green if RVOL is between 2.0 and 3.0.
Turns bright green if RVOL is above 3.0.
Is gray otherwise.

Trigger:
Turns teal if any of the given alert conditions in the user settings are met.

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}}")




Who is online

Users browsing this forum: Amazon [Bot], ChatGPT [Bot], chris006, DVanAssen, kvak, mrtools, rudiarius, segwarak, t2g, TransparentTrader, Yandex [Bot] and 34 guests