Category Oscilators  Published on 01/10/2022

VWAP Mean indicator

Description

This indicator follow the price pressure sentiment. As a trigger is used the limits between High and Low pressure.

Bullish sentiment is definated when Mean component is above the triggers limits.

Bearish sentiment is definated when Mean component is below the triggers limits.

Mean -black component
Bullish sentiment level - red component
Bearish sentiment level - green component



//idea: mfejza (https://ctrader.com/users/profile/58775)
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
 
namespace cAlgo
{
    [Levels(0)]
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class mVWAPmean : Indicator
    {
        [Parameter("Periods (10)", DefaultValue = 10)]
        public int inpPeriods { get; set; }
 
        [Output("VWAP Bulls", LineColor = "Green", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outVWAPbulls { get; set; }
        [Output("VWAP Bears", LineColor = "Red", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outVWAPbears { get; set; }
        [Output("VWAP Mean", LineColor = "Black", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outVWAPmean { get; set; }
 
        private IndicatorDataSeries _vwaphigh, _vwaplow, _mean;
 
        protected override void Initialize()
        {
            _vwaphigh = CreateDataSeries();
            _vwaplow = CreateDataSeries();
            _mean = CreateDataSeries();
        }
 
        public override void Calculate(int i)
        {
            _vwaphigh[i] = ((Bars.HighPrices.Sum(inpPeriods) * Bars.TickVolumes.Sum(inpPeriods)) / Bars.TickVolumes.Sum(inpPeriods)) / inpPeriods;
            _vwaplow[i] = ((Bars.LowPrices.Sum(inpPeriods) * Bars.TickVolumes.Sum(inpPeriods)) / Bars.TickVolumes.Sum(inpPeriods)) / inpPeriods;
            _mean[i] = (_vwaphigh[i] + _vwaplow[i]) / 2;
            
            outVWAPbulls[i] = _vwaplow[i] - _mean[i];
            outVWAPbears[i] = _vwaphigh[i] - _mean[i];
            outVWAPmean[i] = Bars.ClosePrices[i] - _mean[i];
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mVWAPmean.algo
  • Rating: 5
  • Installs: 853
Comments
Log in to add a comment.
No comments found.