OPEN-SOURCE SCRIPT
Updated

Volume-Weighted Trend Oscillator

The purpose of the Volume-Weighted Trend Oscillator (VWTO) indicator is to analyze both price movement and trading volume, along with the rate of change in price, to create a composite signal for tracking market trends. Below is a detailed breakdown of how it functions

VWTO Calc:
If the current close is higher, the volume is added.
If the current close is lower, the volume is subtracted.
This volume difference is summed over the orderFlowPeriod and normalized by dividing the result by 1000, resulting in the orderFlow value.
Rate of Change (ROC):

The rate of change in price (roc) is calculated over a user-defined period (lenr). This ROC measures the momentum of price movement.
Combined Oscillator Calculation:

The Volume-Weighted Trend Oscillator is computed by averaging the ROC and the volume-based trend flow: (roc + orderFlow) / 2.
An optional exponential moving average (ematrend) of this combined oscillator can be plotted if the user enables it.


The indicator changes color dynamically based on the direction of the trend:


If trendflow (the combined oscillator) is positive and increasing, it is colored green.
If it is negative and decreasing, it is colored red.
The colors allow users to quickly visualize whether the trend is strengthening or weakening.
Plotting:

The script generates several plots:


The trendflow value is plotted as a column-style chart with dynamic color changes that reflect the direction and strength of the trend.

The orderFlow (volume-based trend) is also plotted, colored green for positive values and red for negative values.
An optional exponential moving average of the trendflow can be plotted in white if the user chooses to display it.
The chart's candles are colored green or red depending on whether the order flow is positive or negative.

Also includes a robust tester to see if it's a good fit for your system, "BANGER" = good, "MEH" = not optimal.


Trend Signal Output:

The indicator produces a final signal (final) based on the direction of the orderFlow:
A value of 1 signifies a positive trend (bullish).
A value of -1 indicates a negative trend (bearish).
Release Notes
Quick fix

Disclaimer