Ejemplo n.º 1
0
        public GridBot(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, 20, 1);
            Volume   = CreateParameter("Volume", 0.1m, 0.1m, 50, 0.1m);

            MaxStop = CreateParameter("Просадка за стоп", 1, 1, 10, 0.1m);

            PriceLevleLine         = new PriceLevleLine(name + "_PriceLevleLine", false);
            PriceLevleLine         = (PriceLevleLine)_tab.CreateCandleIndicator(PriceLevleLine, "Prime");
            PriceLevleLine.PaintOn = false;
            PriceLevleLine.Save();

            DepoCurrency = CreateParameter("DepoCurrency", "Currency2", new[] { "Currency1", "Currency2" });
            isContract   = CreateParameter("Торгуем контрактами", false);
        }
Ejemplo n.º 2
0
        public PriceLavelBot(string name, StartProgram startProgram)
            : base(name, startProgram)
        {
            this.ParametrsChangeByUser += PriceLavelBot_ParametrsChangeByUser;

            TabCreate(BotTabType.Simple);
            _tab = TabsSimple[0];

            SessionAsia = CreateParameter("Торговать Азию", false);
            SessionEU   = CreateParameter("Торговать Европу", false);
            SessionUSA  = CreateParameter("Торговать Америку", false);
            SessionRUS  = CreateParameter("Торговать Россию", false);
            SessionDay  = CreateParameter("Круглосуточно", false);


            _TradeSessions = new TradeSessions(name + "_TradeSessions", false, GetListSessionTypes());
            _TradeSessions = (TradeSessions)_tab.CreateCandleIndicator(_TradeSessions, "Prime");
            _TradeSessions.Save();

            PriceLevleLine         = new PriceLevleLine(name + "_PriceLevleLine", false);
            PriceLevleLine         = (PriceLevleLine)_tab.CreateCandleIndicator(PriceLevleLine, "Prime");
            PriceLevleLine.PaintOn = false;
            PriceLevleLine.Save();

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

            maVolumeSlow           = new MovingAverage(name + "maVolumeSlow", false);
            maVolumeSlow           = (MovingAverage)_tab.CreateCandleIndicator(maVolumeSlow, "New1");
            maVolumeSlow.ColorBase = System.Drawing.Color.Green;
            maVolumeSlow.Lenght    = 48;
            maVolumeSlow.TypeCalculationAverage = MovingAverageTypeCalculation.Simple;
            maVolumeSlow.TypePointsToSearch     = PriceTypePoints.Volume;
            maVolumeSlow.Save();

            mA = new MovingAverage(name + "mA", false)
            {
                Lenght = 9
            };
            mA = (MovingAverage)_tab.CreateCandleIndicator(mA, "Prime");
            mA.Save();

            Regime           = CreateParameter("Regime", "Off", new[] { "Off", "On" });
            UseSafe          = CreateParameter("Использовать сейф", true);
            _Volume          = CreateParameter("Volume", 1, 0.00m, 100, 1);
            MinProfitTraling = CreateParameter("Минимальный профит для трэйлинга", 0.2m, 0.2m, 2, 0.1m);

            MaxStop = CreateParameter("MaxStop", 1, 1, 10, 0.1m);

            _Slipage  = CreateParameter("_Slipage", 1, 1, 50, 1);
            leverage  = CreateParameter("Маржинальное плечо", 1, 1, 10, 1);
            StepCount = CreateParameter("Ордеров в лесенке", 1, 1, 10, 1);

            DepoCurrency = CreateParameter("DepoCurrency", "Currency2", new[] { "Currency1", "Currency2" });

            isContract = CreateParameter("Торгуем контрактами", false);

            PaintLevels = CreateParameter("Отрисовывать уровни", true);

            Breakeven     = CreateParameter("Использовать безубыток", true);
            NeedBreakeven = Breakeven.ValueBool;

            DeltaSizeK = CreateParameter("Делитель основного ТФ", 6, 1, 40, 1);

            _tab.CandleFinishedEvent        += _tab_CandleFinishedEvent;
            _tab.CandleUpdateEvent          += _tab_CandleUpdateEvent;
            _tab.PositionOpeningSuccesEvent += _tab_PositionOpeningSuccesEvent;
            _tab.NewTickEvent               += _tab_NewTickEvent;
            _tab.FirstTickToDayEvent        += _tab_FirstTickToDayEvent;
            _tab.PositionClosingSuccesEvent += _tab_PositionClosingSuccesEvent;


            //Младший тайм фрейм
            TabCreate(BotTabType.Simple);
            _tab_pattern = TabsSimple[1];

            _tab_pattern.CandleFinishedEvent += _tab_pattern_CandleFinishedEvent;

            delta_pattern = new Delta(name + "_delta", false);
            delta_pattern = (Delta)_tab_pattern.CreateCandleIndicator(delta_pattern, "New1");
            delta_pattern.Save();

            Volume_pattern = new Volume(name + "_Volume", false);
            Volume_pattern = (Volume)_tab_pattern.CreateCandleIndicator(Volume_pattern, "New2");
            Volume_pattern.Save();


            //график Дельты
            TabCreate(BotTabType.Simple);
            _tab_delta = TabsSimple[2];

            _tab_delta.CandleFinishedEvent += _tab_delta_CandleFinishedEvent;;

            delta_delta = new Delta(name + "delta_delta", false);
            delta_delta = (Delta)_tab_delta.CreateCandleIndicator(delta_delta, "New1");
            delta_delta.Save();

            Volume_delta = new Volume(name + "delta_Volume", false);
            Volume_delta = (Volume)_tab_delta.CreateCandleIndicator(Volume_delta, "New2");
            Volume_delta.Save();



            //    lines = new List<LineHorisontal>();

            Thread closerThread = new Thread(CloseFailPosition);

            closerThread.IsBackground = true;
            closerThread.Start();
        }