private void PriceChanel_work_ParametrsChangeByUser() { Fractail.ParametersDigit[0].Value = Fractaillenth.ValueInt; Fractail.Save(); Fractail.Reload(); LengthAtr.ValueInt = LengthPC.ValueInt; LengthUp.ValueInt = LengthPC.ValueInt; LengthDown.ValueInt = LengthPC.ValueInt; }
private void PriceChanel_work_ParametrsChangeByUser() { Fractail.ParametersDigit[0].Value = Fractaillenth.ValueInt; Fractail.Save(); Fractail.Reload(); _trendLine.ParametersDigit[0].Value = Fractaillenth.ValueInt; _trendLine.Save(); _trendLine.Reload(); }
public PriceChanel_work(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _pc = new PriceChannel(name + "PriceChannel", false) { LenghtUpLine = 3, LenghtDownLine = 3, ColorUp = Color.DodgerBlue, ColorDown = Color.DarkRed }; _atr = new Atr(name + "ATR", false) { Lenght = 14, ColorBase = Color.DodgerBlue, }; _pc.Save(); _atr.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; _tab.PositionOpeningSuccesEvent += Strateg_PositionOpen; _tab.PositionOpeningFailEvent += Strateg_PositionOpeningFailEvent; _tab.PositionClosingSuccesEvent += Strateg_PositionClosingSuccesEvent; this.ParametrsChangeByUser += PriceChanel_work_ParametrsChangeByUser; _tab.BestBidAskChangeEvent += _tab_BestBidAskChangeEvent; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyClosePosition", "OnlyShort", "OnlyLong" }); leverage = CreateParameter("Маржинальное плечо", 1m, 1m, 10, 0.1m); DepoCurrency = CreateParameter("DepoCurrency", "Currency2", new[] { "Currency1", "Currency2" }); isContract = CreateParameter("Торгуем контрактами", false); MaxStop = CreateParameter("MaxStop", 1, 1, 10, 0.1m); Fractaillenth = CreateParameter("Длина фрактала", 51, 5, 200, 1); Slipage = CreateParameter("Slipage", 0m, 0m, 20, 0.1m); LengthAtr = CreateParameter("LengthAtr", 14, 14, 200, 1); LengthUp = CreateParameter("LengthUp", 14, 14, 200, 1); LengthDown = CreateParameter("LengthDown", 14, 14, 200, 1); LengthPC = CreateParameter("Длина скользящей для PriceChannel", 14, 14, 200, 1); LengthAtr.ValueInt = LengthPC.ValueInt; LengthUp.ValueInt = LengthPC.ValueInt; LengthDown.ValueInt = LengthPC.ValueInt; //Slipage = 10; //VolumeFix1 = 1; //VolumeFix2 = 1; //LengthAtr = 14; KofAtr = 0.5m; //LengthUp = 3; //LengthDown = 3; DeleteEvent += Strategy_DeleteEvent; FastMA = new MovingAverage(name + "FastMA", false) { ColorBase = System.Drawing.Color.Yellow, Lenght = 15, TypePointsToSearch = PriceTypePoints.Close, TypeCalculationAverage = MovingAverageTypeCalculation.Simple }; FastMA = (MovingAverage)_tab.CreateCandleIndicator(FastMA, "Prime"); FastMA.Lenght = 15; FastMA.Save(); SlowMA = new MovingAverage(name + "SlowMA", false) { ColorBase = System.Drawing.Color.Blue, Lenght = 30, TypePointsToSearch = PriceTypePoints.Close, TypeCalculationAverage = MovingAverageTypeCalculation.Simple }; SlowMA = (MovingAverage)_tab.CreateCandleIndicator(SlowMA, "Prime"); SlowMA.Lenght = 30; SlowMA.Save(); Fractail = IndicatorsFactory.CreateIndicatorByName("Fractail_lenth", name + "Fractail", false); Fractail = (Aindicator)_tab.CreateCandleIndicator(Fractail, "Prime"); Fractail.ParametersDigit[0].Value = Fractaillenth.ValueInt; Fractail.Save(); Thread closerThread = new Thread(CloseFailPosition); closerThread.IsBackground = true; closerThread.Start(); }