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];
}
}
}
MF
mfejza
Joined 25.01.2022
- Type: Free
- Language: C#
- Trading Platform: cTrader Automate
- Filename: mVWAPmean.algo
- Rating: 5
- Installs: 684
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Comments
Only logged in users can post a comment
Comments not found