Exemple #1
0
    public MyLRCBot(string name, StartProgram startProgram)
        : base(name, startProgram)
    {
        TabCreate(BotTabType.Simple);
        _tab = TabsSimple[0];
        _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent;
        //_tab.CandleUpdateEvent += Strateg_CandleUpdateEvent;

        Regime    = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" });
        Volume    = CreateParameter("Volume", 1, 1.0m, 50, 4);
        Slippage  = CreateParameter("Slippage", 0, 0, 20, 1);
        TrailStop = CreateParameter("Trail Stop Percent", 0.7m, 0.3m, 3, 0.1m);

        paramTrixHiPeriod  = CreateParameter("Hi period", 9, 3, 50, 1);
        paramTrixLowPeriod = CreateParameter("Low period", 81, 3, 50, 1);
        paramTrixHi        = CreateParameter("Trix Hi", 0.1m, 0.01m, 100, 0.01m);
        paramTrixLow       = CreateParameter("Trix Low", 0.1m, 0.01m, 100, 0.01m);

        _TrixHi = new LinearRegressionCurve(name + "LRC1", false);
        _TrixHi = (LinearRegressionCurve)_tab.CreateCandleIndicator(_TrixHi, "Prime");
        //_TrixHi = IndicatorsFactory.CreateIndicatorByName("LinearRegressionCurve", name + "Trix", false);
        //_TrixHi = (Aindicator)_tab.CreateCandleIndicator(_TrixHi, "TrixArea");
        _TrixHi.Lenght    = paramTrixHiPeriod.ValueInt;
        _TrixHi.ColorBase = Color.Red;
        _TrixHi.Save();

        _TrixLow = new LinearRegressionCurve(name + "LRC2", false);
        _TrixLow = (LinearRegressionCurve)_tab.CreateCandleIndicator(_TrixLow, "Prime");
        //_TrixLow = IndicatorsFactory.CreateIndicatorByName("LinearRegressionCurve", name + "TrixLow", false);
        //_TrixLow = (Aindicator)_tab.CreateCandleIndicator(_TrixLow, "TrixArea");
        _TrixLow.Lenght    = paramTrixLowPeriod.ValueInt;
        _TrixLow.ColorBase = Color.LightBlue;
        _TrixLow.Save();

        //_frac = new Fractal(name + "Fractal", false);
        //_frac = (Fractal)_tab.CreateCandleIndicator(_frac, "Prime");
        //_frac.Save();



        //_rsi = new StochRsi(name + "StochRsi", false);
        //_rsi = (StochRsi)_tab.CreateCandleIndicator(_rsi, "RsiArea");
        //_rsi.K = paramRSIK.ValueInt;
        //_rsi.D = paramRSID.ValueInt;
        //_rsi.StochasticLength = paramRSIstoch.ValueInt;
        //_rsi.RsiLenght = paramRSIper.ValueInt;
        //_rsi.Save();

        //_sma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "Bollinger", false);
        //_sma = (Aindicator)_tab.CreateCandleIndicator(_sma, "Prime");
        //_sma.Save();

        //_stoc = new StochasticOscillator(name + "ST", false);
        //_stoc = (StochasticOscillator)_tab.CreateCandleIndicator(_stoc, "StocArea");
        //_stoc.Save();

        ParametrsChangeByUser += BotTest_ParametrsChangeByUser;
    }
Exemple #2
0
        public MyTest(string name, StartProgram startProgram) : base(name, startProgram)
        {
            TabCreate(BotTabType.Simple);
            _tab = TabsSimple[0];

            _tab.CandleFinishedEvent        += _tab_CandleFinishedEvent;
            _tab.PositionOpeningSuccesEvent += _tab_PositionOpeningSuccesEvent;

            Regime              = CreateParameter("Regime", "Off", new[] { "Off", "On" });
            Slippage            = CreateParameter("Slippage %", 0, 0, 100, 0.1m);
            Volume              = CreateParameter("Volume", 0.1m, 0.1m, 50, 0.1m);
            EnvelopDeviation    = CreateParameter("Envelop Deviation", 0.3m, 0.2m, 10, 0.1m);
            EnvelopMovingLength = CreateParameter("Envelop Moving Length", 40, 10, 200, 5);
            TrailStop           = CreateParameter("Trail Stop %", 1, 0.1m, 100, 0.1m);

            _sma        = new LinearRegressionCurve(name + "LRC1", false);
            _sma        = (LinearRegressionCurve)_tab.CreateCandleIndicator(_sma, "Prime");
            _sma.Lenght = 8;
            _sma.Save();

            _envelop1 = new Envelops(name + "Envelop1", false);
            _envelop1 = (Envelops)_tab.CreateCandleIndicator(_envelop1, "Prime");
            _envelop1.Save();

            _envelop2 = new Envelops(name + "Envelop2", false);
            _envelop2 = (Envelops)_tab.CreateCandleIndicator(_envelop2, "Prime");
            _envelop2.Save();

            _envelop3 = new Envelops(name + "Envelop3", false);
            _envelop3 = (Envelops)_tab.CreateCandleIndicator(_envelop3, "Prime");
            _envelop3.Save();

            _envelop1.Deviation            = EnvelopDeviation.ValueDecimal;
            _envelop1.MovingAverage.Lenght = EnvelopMovingLength.ValueInt;
            //_envelop1.ColorUp = Color.Red;

            _envelop2.Deviation            = EnvelopDeviation.ValueDecimal * 2m;
            _envelop2.MovingAverage.Lenght = EnvelopMovingLength.ValueInt;

            _envelop3.Deviation            = EnvelopDeviation.ValueDecimal * 3m;
            _envelop3.MovingAverage.Lenght = EnvelopMovingLength.ValueInt;

            ParametrsChangeByUser += MyTest_ParametrsChangeByUser;
        }