Пример #1
0
        public TwoLegArbitrage(string name, StartProgram startProgram)
            : base(name, startProgram)
        {
            TabCreate(BotTabType.Index);
            _tabIndex = TabsIndex[0];

            TabCreate(BotTabType.Simple);
            _tab1 = TabsSimple[0];
            TabCreate(BotTabType.Simple);
            _tab2 = TabsSimple[1];

            _tab1.CandleFinishedEvent   += Tab1_CandleFinishedEvent;
            _tab2.CandleFinishedEvent   += Tab2_CandleFinishedEvent;
            _tabIndex.SpreadChangeEvent += TabIndex_CandleFinishedEvent;

            Regime    = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" });
            Upline    = CreateParameter("Upline", 10, 50, 80, 3);
            Downline  = CreateParameter("Downline", 10, 25, 50, 2);
            Volume    = CreateParameter("Volume", 3, 1, 50, 4);
            Slippage  = CreateParameter("Slipage", 0, 0, 20, 1);
            RsiLength = CreateParameter("RsiLength", 10, 5, 150, 2);

            _rsi = new Rsi(name + "RSI", false)
            {
                Lenght = 20, ColorBase = Color.Gold,
            };
            _rsi        = (Rsi)_tabIndex.CreateCandleIndicator(_rsi, "RsiArea");
            _rsi.Lenght = RsiLength.ValueInt;
            _rsi.Save();

            ParametrsChangeByUser += TwoLegArbitrage_ParametrsChangeByUser;
        }
Пример #2
0
        public RsiContrtrend(string name, StartProgram startProgram)
            : base(name, startProgram)
        {
            TabCreate(BotTabType.Simple);
            _tab = TabsSimple[0];

            _ma = new MovingAverage(name + "MA", false)
            {
                Lenght = 50, ColorBase = Color.CornflowerBlue,
            };
            _ma = (MovingAverage)_tab.CreateCandleIndicator(_ma, "Prime");

            _rsi = new Rsi(name + "RSI", false)
            {
                Lenght = 20, ColorBase = Color.Gold,
            };
            _rsi = (Rsi)_tab.CreateCandleIndicator(_rsi, "RsiArea");

            Upline = new LineHorisontal("upline", "RsiArea", false)
            {
                Color = Color.Green,
                Value = 0,
            };
            _tab.SetChartElement(Upline);

            Downline = new LineHorisontal("downline", "RsiArea", false)
            {
                Color = Color.Yellow,
                Value = 0
            };
            _tab.SetChartElement(Downline);

            _rsi.Save();
            _ma.Save();

            _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent;

            Slipage        = 0;
            VolumeFix      = 1;
            Upline.Value   = 65;
            Downline.Value = 35;


            Load();

            Upline.TimeEnd   = DateTime.Now;
            Downline.TimeEnd = DateTime.Now;

            DeleteEvent += Strategy_DeleteEvent;
        }
Пример #3
0
        public FastDelta(string name, StartProgram startProgram) : base(name, startProgram)
        {
            TabCreate(BotTabType.Simple);
            TabCreate(BotTabType.Simple);
            _tab      = TabsSimple[0];
            _tab_Slow = TabsSimple[1];

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

            _tab_Slow.CandleFinishedEvent += _tab_Slow_CandleFinishedEvent;

            this.ParametrsChangeByUser += FastDelta_ParametrsChangeByUser;
            Regime           = CreateParameter("Regime", "Off", new[] { "Off", "On" });
            Slippage         = CreateParameter("Slippage", 0, 0, 20, 1);
            TrailStop        = CreateParameter("Trail Stop", 0.1m, 0m, 5, 0.1m);
            MinProfitTraling = CreateParameter("Минимальный профит для трэйлинга", 0.2m, 0.2m, 2, 0.1m);
            leverage         = CreateParameter("Маржинальное плечо", 0.1m, 0.1m, 10, 0.1m);
            MaxStop          = CreateParameter("MaxStop", 1, 1, 10, 0.1m);
            isContract       = CreateParameter("Торгуем контрактами", false);
            DepoCurrency     = CreateParameter("DepoCurrency", "Currency2", new[] { "Currency1", "Currency2" });

            TimeFastLenth = CreateParameter("MA Time fast", 10, 5, 200, 5);
            TimeSlowLenth = CreateParameter("MA Time slow", 10, 5, 200, 5);

            VolFastLenth = CreateParameter("MA Vol fast", 10, 5, 200, 5);
            VolSlowLenth = CreateParameter("MA Vol slow", 10, 5, 200, 5);

            TralingMaLenth = CreateParameter("MA Traling", 10, 5, 200, 5);

            maLenth    = CreateParameter("Период скользящей по объему", 24, 24, 48, 1);
            DeltaSizeK = CreateParameter("Коэфт для размера дельты", 6, 1, 40, 1);

            TimeMaFast = new MovingAverage(name + "TimeMaFast", false)
            {
                ColorBase = System.Drawing.Color.Yellow, TypePointsToSearch = PriceTypePoints.Time
            };
            TimeMaFast.Lenght = TimeFastLenth.ValueInt;
            TimeMaFast        = (MovingAverage)_tab.CreateCandleIndicator(TimeMaFast, "New1");
            TimeMaFast.Save();

            TimeMaSlow = new MovingAverage(name + "TimeMaSlow", false)
            {
                ColorBase = System.Drawing.Color.Green, TypePointsToSearch = PriceTypePoints.Time
            };
            TimeMaSlow        = (MovingAverage)_tab.CreateCandleIndicator(TimeMaSlow, "New1");
            TimeMaSlow.Lenght = TimeSlowLenth.ValueInt;
            TimeMaSlow.Save();

            VolMaFast = new MovingAverage(name + "VolMaFast", false)
            {
                ColorBase = System.Drawing.Color.Yellow, Lenght = 10, TypePointsToSearch = PriceTypePoints.Volume, TypeCalculationAverage = MovingAverageTypeCalculation.Exponential
            };
            VolMaFast        = (MovingAverage)_tab.CreateCandleIndicator(VolMaFast, "New2");
            VolMaFast.Lenght = VolFastLenth.ValueInt;
            VolMaFast.Save();

            VolMaSlow = new MovingAverage(name + "VolMaSlow", false)
            {
                ColorBase = System.Drawing.Color.Green, TypePointsToSearch = PriceTypePoints.Volume, TypeCalculationAverage = MovingAverageTypeCalculation.Exponential
            };
            VolMaSlow        = (MovingAverage)_tab.CreateCandleIndicator(VolMaSlow, "New2");
            VolMaSlow.Lenght = VolSlowLenth.ValueInt;
            VolMaSlow.Save();

            TralingStopMa = new MovingAverage(name + "TralingStopMa", false)
            {
                ColorBase = System.Drawing.Color.Blue, TypePointsToSearch = PriceTypePoints.Close
            };
            TralingStopMa        = (MovingAverage)_tab.CreateCandleIndicator(TralingStopMa, "Prime");
            TralingStopMa.Lenght = TralingMaLenth.ValueInt;
            TralingStopMa.Save();

            maVolume        = new MovingAverage(name + "_maVolume", false);
            maVolume        = (MovingAverage)_tab_Slow.CreateCandleIndicator(maVolume, "New1");
            maVolume.Lenght = maLenth.ValueInt;
            maVolume.TypeCalculationAverage = MovingAverageTypeCalculation.Exponential;
            maVolume.TypePointsToSearch     = PriceTypePoints.Volume;
            maVolume.Save();

            delta = new Delta(name + "delta", false);
            delta = (Delta)_tab.CreateCandleIndicator(delta, "New3");
            delta.Save();

            rsi        = new Rsi(name + "Rsi", false);
            rsi        = (Rsi)_tab.CreateCandleIndicator(rsi, "New4");
            rsi.Lenght = 21;
            rsi.Save();


            /*
             * _envelop = new Envelops(name + "Envelop", false);
             * _envelop = (Envelops)_tab.CreateCandleIndicator(_envelop, "Prime");
             * _envelop.MovingAverage.Lenght = 21;
             * _envelop.Deviation = 0.3m;
             * _envelop.Save();
             */
            CanTrade = false;
        }