lp_tp
    lp_tp's avatar

    Info

    Username:lp_tp
    Name:lp_tp
    Member since: 11 Feb 2019

    About

    None

    Signature

    None

    Last comments

    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.
    VWAP
      0
      0
      603
    by lp_tp
    free  09 Feb 2020
    // ------------------------------------------------------------------------------------------------- // //    VWAP (Volume Weighted Average Price) = Cumulative(Typical Price x Volume) / Cumulative(Volume) //    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.EasternStandardTime, AutoRescale = false, AccessRights = AccessRights.None)]     public class VWAP : Indicator     {         [Parameter(DefaultValue = 0)]         public int Periods { get; set; }           [Parameter("One day only?", DefaultValue = false)]         public bool Odo { get; set; }           [Output("Main", Color = Colors.DarkOrchid)]         public IndicatorDataSeries Result { get; set; }           public override void Calculate(int index)         {             int ii = index;             double CumTypPrice = 0;             double CumVol = 0;               if (Periods == 0)             {                 while (MarketSeries.OpenTime[ii] >= (Odo == false ? MarketSeries.OpenTime[ii].Date : DateTime.Now.Date) && ii != 0)                 {                     CumTypPrice += MarketSeries.Typical[ii] * MarketSeries.TickVolume[ii];                     CumVol += MarketSeries.TickVolume[ii];                     ii--;                     if (MarketSeries.OpenTime[ii].Hour == 0 && MarketSeries.OpenTime[ii].Minute == 0)                         break;                 }             }             else             {                 for (; ii >= MarketSeries.OpenTime.Count - Periods; ii--)                 {                     CumTypPrice += MarketSeries.Typical[ii] * MarketSeries.TickVolume[ii];                     CumVol += MarketSeries.TickVolume[ii];                 }             }               Result[index] = CumTypPrice / CumVol;           }           protected override void Initialize()         {             Print("VWAP indicator started...");         }     } }
    Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

    No uploaded.