VWMA (Volume Weighted Moving Average)

by Zaknafein Zakynthos in category Trend at 05/05/2018
Description

Often used for breakout trading to avoid fake breakouts.  I couldn't find a VWMA for Ctrader so programmed one and am sharing it with the community.  There is lots of information about this indicator on-line.  

I'll try to respond to any comments.  Also please share any good strategies you have using this indicator.

Donations welcome to:
BTC: 33gjtYhKVqFxmcbcko63WnwiVJvew3PauQ
ETH: 0xb54dF35117D94a43Ca25A3A348Ac20DF7F667F7b
LTC: M8YRuyH5USv2MvJyyF55U5ik1yMfm6TtMH

Cheers,

Zaknafein Z

Download
683 downloads
How to install
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.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
// -------------------------------------------------------------------------------------------------
//
//    VWAP (Volume Weighted Moving Average) by Zaknafein Z
//
//    Donations welcome to:
//    
//    BTC: 33gjtYhKVqFxmcbcko63WnwiVJvew3PauQ
//    ETH: 0xb54dF35117D94a43Ca25A3A348Ac20DF7F667F7b
//    LTC: M8YRuyH5USv2MvJyyF55U5ik1yMfm6TtMH
//
//    v1.0 Inital version 04/05/18
// -------------------------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
    public class VWMA : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter(DefaultValue = 14)]
        public int Periods { get; set; }

        [Output("Main", Color = Colors.Aqua)]
        public IndicatorDataSeries Result { get; set; }

        public override void Calculate(int index)
        {
            double sum = 0.0;
            double totvol = 0.0;

            for (int i = index - Periods + 1; i <= index; i++)
            {
                sum += (Source[i] * MarketSeries.TickVolume[i]);
                totvol += MarketSeries.TickVolume[i];
            }
            Result[index] = sum / totvol;
        }
    }
}

Comments
5