Topics
05 Jan 2021, 19:50
 829
 2
05 Jan 2021, 19:34
 1245
 3
Replies

vitconlonton468
05 Jan 2021, 19:53

RE:

vitconlonton468 said:

im using williams vix fix indicator on tradingview, and now i want to built it on my ctrader, pls help me for this error (Error CS1503: Argument 1: cannot convert from 'double' to 'cAlgo.API.DataSeries')

my script here:

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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class VIXFIX : Indicator
    {
        [Parameter("LookBack Period Standard Deviation High", DefaultValue = 22)]
        public int pd { get; set; }

        [Parameter("Bolinger Band Length", DefaultValue = 20)]
        public int bbl { get; set; }

        [Parameter("Bollinger Band Standard Devaition Up", DefaultValue = 2.0)]
        public double mult { get; set; }

        [Parameter("Look Back Period Percentile High", DefaultValue = 50)]
        public int lb { get; set; }

        [Parameter("Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%", DefaultValue = 0.85)]
        public double ph { get; set; }

        [Parameter("Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%", DefaultValue = 1.01)]
        public double pl { get; set; }

        [Parameter("Show High Range - Based on Percentile and LookBack Period?", DefaultValue = true)]
        public bool hp { get; set; }

        [Parameter("Show Standard Deviation Line?", DefaultValue = true)]
        public bool sd { get; set; }

        [Output("Range High Percentile", Color = Colors.DarkOrange, PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries rangehigh { get; set; }

        [Output("Upper Band", Color = Colors.Aqua, PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries upperband { get; set; }

        [Output("Williams Vix Fix", Color = Colors.Lime, PlotType = PlotType.Histogram, Thickness = 4)]
        public IndicatorDataSeries main { get; set; }

        private BollingerBands BB;

        double wvf;


        protected override void Initialize()
        {
            // Initialize and create nested indicators
            BB = Indicators.BollingerBands(wvf, bbl, mult, MovingAverageType.Simple);
        }

        public override void Calculate(int index)
        {
            wvf = Math.Round(((MarketSeries.Close.Maximum(pd) - MarketSeries.Low[MarketSeries.Low.Count - 1]) / (MarketSeries.Close.Maximum(pd))) * 100, 5);
            main[index] = wvf;
        }
    }
}

 

 

Thank for yours help!!!

Sorry, i post wrong group.


@vitconlonton468