public HandyEngine(string name, StartProgram startProgram) : base(name, startProgram) { //создание вкладки TabCreate(BotTabType.Handy); _tab = TabsHandy[0]; //Показывать скорость на графике if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Tester.marker")) { BotTabHandy.ChartForTester = true; } //Создание области для нижнего графика имя жестко должно быть "HandyArea" _emptyIndicator = IndicatorsFactory.CreateIndicatorByName("HandyEmpty", name + "HandyEmpty", true); _emptyIndicator = (Aindicator)_tab.CreateCandleIndicator(_emptyIndicator, "HandyArea"); _emptyIndicator.Save(); //Добавление групп индикаторов и индикаторов _tab._indicatorOnTheFlyClaster.AddIndicator("Кластер1", "КластерHL2"); _tab._indicatorOnTheFlyClaster.AddIndicator("Кластер2", "КластерHL3"); _tab._indicatorOnTheFlyClaster.AddIndicator("пусто", "пусто"); _tab._indicatorOnTheFlyClaster.SetDefaultSelected("пусто"); _tab._indicatorOnTheFlyPrime.AddIndicator("Line & channel", "HL2"); _tab._indicatorOnTheFlyPrime.AddIndicator("Line", "HL3"); _tab._indicatorOnTheFlyPrime.SetDefaultSelected("Line & channel"); _tab._indicatorOnTheFlySecondary.AddIndicator("Group1", "deltaHL"); //Secondary - в группе может быть только один индикитор line,hist,scatter _tab._indicatorOnTheFlySecondary.AddIndicator("Group1", "пусто"); _tab._indicatorOnTheFlySecondary.SetDefaultSelected("Group1"); //Подписка на нужные события _tab.CandleFinishedEvent += _tab_CandleFinishedEvent; _tab.ChangeChartSelection += _tab_ChangeChartSelection; }
public PairRsiTrade(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab1 = TabsSimple[0]; _tab1.CandleFinishedEvent += _tab1_CandleFinishedEvent; TabCreate(BotTabType.Simple); _tab2 = TabsSimple[1]; _tab2.CandleFinishedEvent += _tab2_CandleFinishedEvent; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On" }); Volume1 = CreateParameter("Volume 1", 1, 1.0m, 50, 1); Volume2 = CreateParameter("Volume 2", 1, 1.0m, 50, 1); RsiSpread = CreateParameter("Spread to Rsi", 10, 5.0m, 50, 2, "Indicators"); RsiOnePeriod = CreateParameter("Rsi One period", 14, 5, 50, 2, "Indicators"); RsiTwoPeriod = CreateParameter("Rsi Two period", 14, 5, 50, 2, "Indicators"); _rsi1 = IndicatorsFactory.CreateIndicatorByName("RSI", name + "RSI1", false); _rsi1.ParametersDigit[0].Value = RsiOnePeriod.ValueInt; _rsi1 = (Aindicator)_tab1.CreateCandleIndicator(_rsi1, "Rsi1_Area"); _rsi1.Save(); _rsi2 = IndicatorsFactory.CreateIndicatorByName("RSI", name + "RSI2", false); _rsi2.ParametersDigit[0].Value = RsiTwoPeriod.ValueInt; _rsi2 = (Aindicator)_tab2.CreateCandleIndicator(_rsi2, "Rsi2_Area"); _rsi2.Save(); ParametrsChangeByUser += Event_ParametrsChangeByUser; ParamGuiSettings.Height = 300; ParamGuiSettings.Width = 500; ParamGuiSettings.Title = "Pair Rsi Bot Settings"; }
public AlligatorTrend(string name, StartProgram startProgram) : base(name, startProgram) { _startProgram = startProgram; // создаем вкладку робота TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; // создаем настроечные параметры робота Regime = CreateParameter("Режим работы бота", "Off", new[] { "On", "Off", "OnlyClosePosition", "OnlyShort", "OnlyLong" }); AlligatorFastLenght = CreateParameter("Длина быстрого алигатора", 100, 50, 200, 10); AlligatorMiddleLenght = CreateParameter("Длина среднего алигатора", 100, 50, 200, 10); AlligatorSlowLenght = CreateParameter("Длина медленного алигатора", 100, 50, 200, 10); Volume = CreateParameter("Объем входа в позицию", 1.0m, 1.0m, 100.0m, 1.0m); MaxPositionCount = CreateParameter("Максимальное количество позиций", 2, 1, 10, 1); Slippage = CreateParameter("Проскальзывание (в шагах цены)", 350, 1, 500, 50); // создаем индикаторы на вкладке робота и задаем для них параметры _alligator = IndicatorsFactory.CreateIndicatorByName("Alligator", name + "Alligator", false); _alligator = (Aindicator)_tab.CreateCandleIndicator(_alligator, "Prime"); _alligator.ParametersDigit[0].Value = AlligatorSlowLenght.ValueInt; _alligator.ParametersDigit[1].Value = AlligatorFastLenght.ValueInt; _alligator.ParametersDigit[2].Value = AlligatorMiddleLenght.ValueInt; _alligator.Save(); // подписываемся на события _tab.CandleFinishedEvent += _tab_CandleFinishedEvent; ParametrsChangeByUser += AlligatorTrend_ParametrsChangeByUser; }
public SmaTrendSample(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On" }); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); Slippage = CreateParameter("Slippage", 0, 0, 20, 1); SmaLength = CreateParameter("Sma length", 30, 0, 20, 1); BaseStopPercent = CreateParameter("Base Stop Percent", 0.3m, 1.0m, 50, 4); _sma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "sma", false); _sma = (Aindicator)_tab.CreateCandleIndicator(_sma, "Prime"); _sma.ParametersDigit[0].Value = SmaLength.ValueInt; _sma.Save(); EnvelopLength = CreateParameter("Envelop length", 30, 0, 20, 1); EnvelopDeviation = CreateParameter("Envelop Deviation", 1, 1.0m, 50, 4); _envelop = IndicatorsFactory.CreateIndicatorByName("Envelops", name + "env", false); _envelop = (Aindicator)_tab.CreateCandleIndicator(_envelop, "Prime"); _envelop.ParametersDigit[0].Value = EnvelopLength.ValueInt; _envelop.ParametersDigit[1].Value = EnvelopDeviation.ValueDecimal; _envelop.Save(); ParametrsChangeByUser += SmaTrendSample_ParametrsChangeByUser; _tab.CandleFinishedEvent += _tab_CandleFinishedEvent; }
public PriceChannelVolatility(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); Slippage = CreateParameter("Slippage", 0, 0, 20, 1); VolumeFix1 = CreateParameter("Volume 1", 3, 1.0m, 50, 4); VolumeFix2 = CreateParameter("Volume 2", 3, 1.0m, 50, 4); LengthAtr = CreateParameter("Length Atr", 14, 5, 80, 3); KofAtr = CreateParameter("Atr mult", 0.5m, 0.1m, 5, 0.1m); LengthChannelUp = CreateParameter("Length Channel Up", 12, 5, 80, 2); LengthChannelDown = CreateParameter("Length Channel Down", 12, 5, 80, 2); _pc = IndicatorsFactory.CreateIndicatorByName("PriceChannel", name + "PriceChannel", false); _pc.ParametersDigit[0].Value = LengthChannelUp.ValueInt; _pc.ParametersDigit[1].Value = LengthChannelDown.ValueInt; _pc = (Aindicator)_tab.CreateCandleIndicator(_pc, "Prime"); _pc.Save(); _atr = IndicatorsFactory.CreateIndicatorByName("ATR", name + "ATR", false); _atr.ParametersDigit[0].Value = LengthAtr.ValueInt; _atr = (Aindicator)_tab.CreateCandleIndicator(_atr, "Second"); _atr.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; ParametrsChangeByUser += Event_ParametrsChangeByUser; }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _lengthJaw = CreateParameterInt("Jaw length", 13); _lengthLips = CreateParameterInt("Lips length", 8); _lengthTeeth = CreateParameterInt("Teeth length", 5); _shiftJaw = CreateParameterInt("Jaw offset", 8); _shiftLips = CreateParameterInt("Lips offset", 3); _shiftTeeth = CreateParameterInt("Teeth offset", 5); _seriesJaw = CreateSeries("Jaw", Color.DodgerBlue, IndicatorChartPaintType.Line, true); _seriesTeeth = CreateSeries("Teeth", Color.DarkRed, IndicatorChartPaintType.Line, true); _seriesLips = CreateSeries("Lips", Color.LawnGreen, IndicatorChartPaintType.Line, true); _smaJaw = IndicatorsFactory.CreateIndicatorByName("Ssma", Name + "SsmaJaw", false); ((IndicatorParameterInt)_smaJaw.Parameters[0]).Bind(_lengthJaw); ProcessIndicator("Jaw SSMA", _smaJaw); _smaLips = IndicatorsFactory.CreateIndicatorByName("Ssma", Name + "SsmaLips", false); ((IndicatorParameterInt)_smaLips.Parameters[0]).Bind(_lengthLips); ProcessIndicator("Lips SSMA", _smaLips); _smaTeeth = IndicatorsFactory.CreateIndicatorByName("Ssma", Name + "SsmaTeeth", false); ((IndicatorParameterInt)_smaTeeth.Parameters[0]).Bind(_lengthTeeth); ProcessIndicator("Teeth SSMA", _smaTeeth); } }
public BbPowerTrade(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; 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); Step = CreateParameter("Step", 100, 50m, 500, 20); BullsPowerPeriod = CreateParameter("Bulls Period", 13, 10, 50, 2); BearsPowerPeriod = CreateParameter("Bears Period", 13, 10, 50, 2); _bearsP = IndicatorsFactory.CreateIndicatorByName("BearsPower", name + "BearsPower", false); _bearsP = (Aindicator)_tab.CreateCandleIndicator(_bearsP, "BearsArea"); _bearsP.ParametersDigit[0].Value = BearsPowerPeriod.ValueInt; _bearsP.Save(); _bullsP = IndicatorsFactory.CreateIndicatorByName("BullsPower", name + "BullsPower", false); _bullsP = (Aindicator)_tab.CreateCandleIndicator(_bullsP, "BullsArea"); _bullsP.ParametersDigit[0].Value = BullsPowerPeriod.ValueInt; _bullsP.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; ParametrsChangeByUser += Event_ParametrsChangeByUser; }
public CustomParamsUseBotSample(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new string[] { "Off", "On" }, "Base"); //делаем простотую надпись, которая будет разделять параметры в таблице CreateParameterLabel("labelSample", "Base", "Params", 30, 15, System.Drawing.Color.White, "Base"); AtrCountToInter = CreateParameter("Atr count", 4m, 1, 10, 1, "Base"); Volume = CreateParameter("Volume", 1, 1, 100000, 1m, "Base"); FastSmaLen = CreateParameter("Fast sma len", 15, 5, 50, 1, "Indicators"); SlowSmaLen = CreateParameter("Slow sma len", 50, 5, 50, 1, "Indicators"); AtrLen = CreateParameter("Atr len", 50, 5, 50, 1, "Indicators"); StopLenPercent = CreateParameter("Stop percent", 0.5m, 1, 10, 1, "Exit settings"); ProfitLenPercent = CreateParameter("Profit percent", 0.5m, 1, 10, 1, "Exit settings"); _fastSma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "Sma", false); _fastSma = (Aindicator)_tab.CreateCandleIndicator(_fastSma, "Prime"); _fastSma.ParametersDigit[0].Value = FastSmaLen.ValueInt; _fastSma.Save(); _slowSma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "SmaSlow", false); _slowSma = (Aindicator)_tab.CreateCandleIndicator(_slowSma, "Prime"); _slowSma.ParametersDigit[0].Value = SlowSmaLen.ValueInt; _slowSma.Save(); _atr = IndicatorsFactory.CreateIndicatorByName("ATR", name + "art", false); _atr = (Aindicator)_tab.CreateCandleIndicator(_atr, "AtrArea"); _atr.ParametersDigit[0].Value = AtrLen.ValueInt; _atr.Save(); ParametrsChangeByUser += CustomParamsUseBotSample_ParametrsChangeByUser; _tab.CandleFinishedEvent += _tab_CandleFinishedEvent; // customization param ui this.ParamGuiSettings.Title = "Custom param gui sample"; this.ParamGuiSettings.Height = 800; this.ParamGuiSettings.Width = 600; // 1 tab creation CustomTabToParametersUi customTab = ParamGuiSettings.CreateCustomTab("Indicators values"); // 2 add on custom tab children control // customTab.GridToPaint - it`s a control for your children controls CreateTable(); customTab.AddChildren(_host); }
public StochasticTrade(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _stoch = IndicatorsFactory.CreateIndicatorByName("Stochastic", name + "Stochastic", false); _stoch = (Aindicator)_tab.CreateCandleIndicator(_stoch, "StochasticArea"); Upline = new LineHorisontal("upline", "StochasticArea", false) { Color = Color.Green, Value = 0, }; _tab.SetChartElement(Upline); Downline = new LineHorisontal("downline", "StochasticArea", false) { Color = Color.Yellow, Value = 0 }; _tab.SetChartElement(Downline); Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); Slippage = CreateParameter("Slippage", 0, 0, 20, 1); UpLineValue = CreateParameter("Up Line Value", 80, 60.0m, 90, 0.5m); DownLineValue = CreateParameter("Down Line Value", 20, 10.0m, 40, 0.5m); StochPeriod1 = CreateParameter("Stoch Period 1", 5, 3, 40, 1); StochPeriod2 = CreateParameter("Stoch Period 2", 3, 2, 40, 1); StochPeriod3 = CreateParameter("Stoch Period 3", 3, 2, 40, 1); Upline.Value = UpLineValue.ValueDecimal; Downline.Value = DownLineValue.ValueDecimal; _stoch.ParametersDigit[0].Value = StochPeriod1.ValueInt; _stoch.ParametersDigit[1].Value = StochPeriod2.ValueInt; _stoch.ParametersDigit[2].Value = StochPeriod3.ValueInt; _stoch.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; Upline.TimeEnd = DateTime.Now; Downline.TimeEnd = DateTime.Now; ParametrsChangeByUser += RviTrade_ParametrsChangeByUser; }
public FractalTest(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("TrixHi period", 9, 3, 50, 1); paramTrixLowPeriod = CreateParameter("TrixLow 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 = IndicatorsFactory.CreateIndicatorByName("Trix", name + "Trix", false); _TrixHi = (Aindicator)_tab.CreateCandleIndicator(_TrixHi, "TrixArea"); _TrixHi.ParametersDigit[0].Value = paramTrixHiPeriod.ValueInt; _TrixHi.Save(); _TrixLow = IndicatorsFactory.CreateIndicatorByName("Trix", name + "TrixLow", false); _TrixLow = (Aindicator)_tab.CreateCandleIndicator(_TrixLow, "TrixArea"); _TrixLow.ParametersDigit[0].Value = paramTrixLowPeriod.ValueInt; _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; }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _length = CreateParameterInt("Period", 13); _series = CreateSeries("Values", Color.LimeGreen, IndicatorChartPaintType.Column, true); _sma = IndicatorsFactory.CreateIndicatorByName("Sma", Name + "Sma", false); ((IndicatorParameterInt)_sma.Parameters[0]).Bind(_length); ProcessIndicator("Sma", _sma); } }
public TrendLine(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _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); DeleteEvent += Strategy_DeleteEvent; _trendLine = IndicatorsFactory.CreateIndicatorByName("TrendLine", name + "TrendLine", false); _trendLine = (Aindicator)_tab.CreateCandleIndicator(_trendLine, "Prime"); _trendLine.ParametersDigit[0].Value = Fractaillenth.ValueInt; _trendLine.Save(); _Ssma = IndicatorsFactory.CreateIndicatorByName("Ssma", name + "_Ssma", false); _Ssma = (Aindicator)_tab.CreateCandleIndicator(_Ssma, "Prime"); _Ssma.ParametersDigit[0].Value = Fractaillenth.ValueInt; _Ssma.Save(); _FastMa = IndicatorsFactory.CreateIndicatorByName("Ssma", name + "_FastMa", false); _FastMa = (Aindicator)_tab.CreateCandleIndicator(_FastMa, "Prime"); _FastMa.ParametersDigit[0].Value = 15; _FastMa.Save(); _SlowMa = IndicatorsFactory.CreateIndicatorByName("Ssma", name + "_SlowMa", false); _SlowMa = (Aindicator)_tab.CreateCandleIndicator(_SlowMa, "Prime"); _SlowMa.ParametersDigit[0].Value = 30; _SlowMa.Save(); Fractail = _trendLine.IncludeIndicators.FindLast(x => x.Name == name + "TrendLineFractail"); Thread closerThread = new Thread(CloseFailPosition); closerThread.IsBackground = true; closerThread.Start(); }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _lenght = CreateParameterInt("Length", 5); _seriesUp = CreateSeries("SeriesUp", Color.DarkRed, IndicatorChartPaintType.Point, true); _seriesDown = CreateSeries("SeriesDown", Color.DarkGreen, IndicatorChartPaintType.Point, true); _fractial = IndicatorsFactory.CreateIndicatorByName("Fractail_lenth", Name + "Fractail", false); ((IndicatorParameterInt)_fractial.Parameters[0]).Bind(_lenght); ProcessIndicator("Fractail", _fractial); } }
public ArbitrageIndex(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Index); _tabIndex = TabsIndex[0]; _tabIndex.SpreadChangeEvent += _tabIndex_SpreadChangeEvent; _tabIndex.UserFormula = "A0/A1"; _envelop = new Envelops(name + "Envelop", false); _envelop = (Envelops)_tabIndex.CreateCandleIndicator(_envelop, "Prime"); _envelop.Save(); TabCreate(BotTabType.Simple); _tab1 = TabsSimple[0]; TabCreate(BotTabType.Simple); _tab2 = TabsSimple[1]; _tab1.PositionOpeningSuccesEvent += _PositionOpeningSuccesEvent; _tab2.PositionOpeningSuccesEvent += _PositionOpeningSuccesEvent; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); DepoCurrency = CreateParameter("DepoCurrency", "Currency2", new[] { "Currency1", "Currency2" }); minSpread = CreateParameter("minSpread", 0.4m, 0.1m, 3, 0.05m); minProfit = CreateParameter("minProfit", 0.3m, 0.1m, 3, 0.05m); Slippage = CreateParameter("Slipage", 0, 0, 20, 1); ParametrsChangeByUser += ArbitrageIndex_ParametrsChangeByUser; EnvelopDeviation = CreateParameter("Envelop Deviation", 0.3m, 5m, 10, 0.3m); EnvelopMovingLength = CreateParameter("Envelop Moving Length", 10, 5, 200, 5); _envelop.Deviation = EnvelopDeviation.ValueDecimal; _envelop.MovingAverage.Lenght = EnvelopMovingLength.ValueInt; VolumeDecimals1 = CreateParameter("Volume1 Decimals", 0, 0, 20, 1); VolumeDecimals2 = CreateParameter("Volume2 Decimals", 0, 0, 20, 1); MaDay1 = IndicatorsFactory.CreateIndicatorByName("Sma", name + "MaDay1", false); MaDay1 = (Aindicator)_tab1.CreateCandleIndicator(MaDay1, "Prime"); MaDay1.ParametersDigit[0].Value = 24; MaDay1.Save(); MaDay2 = IndicatorsFactory.CreateIndicatorByName("Sma", name + "MaDay2", false); MaDay2 = (Aindicator)_tab2.CreateCandleIndicator(MaDay2, "Prime"); MaDay2.ParametersDigit[0].Value = 24; MaDay2.Save(); }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _lenght = CreateParameterInt("Length", 21); _deviation = CreateParameterDecimal("Deviation", 2); _seriesUp = CreateSeries("Up line", Color.Green, IndicatorChartPaintType.Line, true); _seriesCenter = CreateSeries("Centre line", Color.Green, IndicatorChartPaintType.Line, false); _seriesDown = CreateSeries("Down line", Color.Green, IndicatorChartPaintType.Line, true); _sma = IndicatorsFactory.CreateIndicatorByName("Sma", Name + "Sma", false); ((IndicatorParameterInt)_sma.Parameters[0]).Bind(_lenght); ProcessIndicator("Central SMA", _sma); } }
public MacdRevers(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _macd = IndicatorsFactory.CreateIndicatorByName("MACD", name + "MacdArea", false); _macd = (Aindicator)_tab.CreateCandleIndicator(_macd, "MacdArea"); _macd.Save(); 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); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; }
public RsiTrade(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _rsi = IndicatorsFactory.CreateIndicatorByName("RSI", name + "RSI", false); _rsi = (Aindicator)_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); 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); RsiLength = CreateParameter("Rsi Length", 20, 10, 40, 2); UpLineValue = CreateParameter("Up Line Value", 65, 60.0m, 90, 0.5m); DownLineValue = CreateParameter("Down Line Value", 35, 10.0m, 40, 0.5m); _rsi.ParametersDigit[0].Value = RsiLength.ValueInt; _rsi.Save(); Upline.Value = UpLineValue.ValueDecimal; Downline.Value = DownLineValue.ValueDecimal; Upline.TimeEnd = DateTime.Now; Downline.TimeEnd = DateTime.Now; _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; DeleteEvent += Strategy_DeleteEvent; ParametrsChangeByUser += Event_ParametrsChangeByUser; }
public OneLegArbitrage(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Index); _tab1 = TabsIndex[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); Slippage = CreateParameter("Slipage", 0, 0, 20, 1); _ma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "MovingAverage", false); _ma = (Aindicator)_tab1.CreateCandleIndicator(_ma, "Prime"); _ma.Save(); TabCreate(BotTabType.Simple); _tab2 = TabsSimple[0]; _tab2.CandleFinishedEvent += Strateg_CandleFinishedEvent; }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _shortPeriod = CreateParameterInt("Short Period", 3); _longPeriod = CreateParameterInt("Long Period", 10); _seriesLine = CreateSeries("Chaikin Oscillator", Color.Gold, IndicatorChartPaintType.Line, true); _seriesLine.CanReBuildHistoricalValues = false; _seriesShort = IndicatorsFactory.CreateIndicatorByName("Sma", Name + "Short", false); ((IndicatorParameterInt)_seriesShort.Parameters[0]).Bind(_shortPeriod); ProcessIndicator("Short Period", _seriesShort); _seriesLong = IndicatorsFactory.CreateIndicatorByName("Sma", Name + "Long", false); ((IndicatorParameterInt)_seriesLong.Parameters[0]).Bind(_longPeriod); ProcessIndicator("Short Period", _seriesLong); } }
public RviTrade(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); Slippage = CreateParameter("Slipage", 0, 0, 20, 1); RviLenght = CreateParameter("RviLength", 10, 10, 80, 3); _rvi = IndicatorsFactory.CreateIndicatorByName("RVI", name + "RviArea", false); _rvi = (Aindicator)_tab.CreateCandleIndicator(_rvi, "MacdArea"); _rvi.ParametersDigit[0].Value = RviLenght.ValueInt; _rvi.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; ParametrsChangeByUser += RviTrade_ParametrsChangeByUser; }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _lenghtFastLine = CreateParameterInt("Fast line length", 12); _lenghtSlowLine = CreateParameterInt("Slow line length", 26); _lenghtSignalLine = CreateParameterInt("Signal line length", 9); _seriesMacd = CreateSeries("MACD", Color.DarkGreen, IndicatorChartPaintType.Line, true); _seriesSignalLine = CreateSeries("Signal line", Color.DarkRed, IndicatorChartPaintType.Line, true); _seriesMacdHistogramm = CreateSeries("MACD Histogramm", Color.DodgerBlue, IndicatorChartPaintType.Column, false); _emaFast = IndicatorsFactory.CreateIndicatorByName("Ema", Name + "Ema fast", false); ((IndicatorParameterInt)_emaFast.Parameters[0]).Bind(_lenghtFastLine); ProcessIndicator("Ema fast", _emaFast); _emaSlow = IndicatorsFactory.CreateIndicatorByName("Ema", Name + "Ema slow", false); ((IndicatorParameterInt)_emaSlow.Parameters[0]).Bind(_lenghtSlowLine); ProcessIndicator("Ema slow", _emaSlow); } }
public override void OnStateChange(IndicatorState state) { if (state == IndicatorState.Configure) { _lenghtFastLine = CreateParameterInt("Fast line length", 5); _lenghtSlowLine = CreateParameterInt("Slow line length", 32); _candlePoint = CreateParameterStringCollection("Candle point", "Typical", Entity.CandlePointsArray); _series = CreateSeries("AO", Color.DarkGreen, IndicatorChartPaintType.Column, true); _emaFast = IndicatorsFactory.CreateIndicatorByName("Ema", Name + "Ema fast", false); ((IndicatorParameterInt)_emaFast.Parameters[0]).Bind(_lenghtFastLine); ((IndicatorParameterString)_emaFast.Parameters[1]).Bind(_candlePoint); ProcessIndicator("Ema fast", _emaFast); _emaSlow = IndicatorsFactory.CreateIndicatorByName("Ema", Name + "Ema slow", false); ((IndicatorParameterInt)_emaSlow.Parameters[0]).Bind(_lenghtSlowLine); ((IndicatorParameterString)_emaSlow.Parameters[1]).Bind(_candlePoint); ProcessIndicator("Ema slow", _emaSlow); } }
public MyMacdTrail(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); paramRSIper = CreateParameter("RSI period", 14, 14, 100, 1); paramRSIstoch = CreateParameter("RSI stochastic period", 14, 14, 100, 1); paramRSIK = CreateParameter("RSI K", 5, 1, 100, 1); paramRSID = CreateParameter("RSI D", 3, 1, 100, 1); _macd = IndicatorsFactory.CreateIndicatorByName("MacdLine", name + "MACD", false); _macd = (Aindicator)_tab.CreateCandleIndicator(_macd, "MacdArea"); _macd.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 += RviTrade_ParametrsChangeByUser; }
/// <summary> /// Конструктор /// </summary> /// <param name="name">Имя робота</param> /// <param name="startProgram">Программа, в которой запущен робот</param> public BollingerTrend(string name, StartProgram startProgram) : base(name, startProgram) { _startProgram = startProgram; // создаем вкладку робота Simple TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; // создаем настроечные параметры робота Regime = CreateParameter("Режим работы бота", "Off", new[] { "On", "Off", "OnlyClosePosition", "OnlyShort", "OnlyLong" }); OnDebug = CreateParameter("Включить отладку", false); OnDepositFixed = CreateParameter("Включить режим фикс. депозита", false); DepositFixedSize = CreateParameter("Размер фикс. депозита", 100, 100.0m, 100, 100); DepositNameCode = CreateParameter("Код инструмента, в котором депозит", "USDT", new[] { "USDT", "" }); VolumePercent = CreateParameter("Объем входа в позицию (%)", 50, 40, 300, 10); BollingerPeriod = CreateParameter("Длина болинжера", 100, 50, 200, 10); BollingerDeviation = CreateParameter("Отклонение болинжера", 1.5m, 1.0m, 3.0m, 0.2m); MethodOutOfPosition = CreateParameter("Метод выхода из позиции", "ChannelBoundary", new[] { "ChannelBoundary", "ChannelCenter" }); OnStopForBreakeven = CreateParameter("Вкл. стоп для перевода в безубытк", true); MinProfitOnStopBreakeven = CreateParameter("Мин. профит для перевода в безубытк (%)", 7, 5, 20, 1); Slippage = CreateParameter("Проскальзывание (в шагах цены)", 350, 1, 500, 50); VolumeDecimals = CreateParameter("Кол. знаков после запятой для объема", 4, 4, 10, 1); ShiftTimeExchange = CreateParameter("Разница времени с биржей", 5, -10, 10, 1); // создаем индикаторы на вкладке робота и задаем для них параметры _bollinger = IndicatorsFactory.CreateIndicatorByName("Bollinger", name + "Bollinger", false); _bollinger = (Aindicator)_tab.CreateCandleIndicator(_bollinger, "Prime"); _bollinger.ParametersDigit[0].Value = BollingerPeriod.ValueInt; _bollinger.ParametersDigit[1].Value = BollingerDeviation.ValueDecimal; _bollinger.Save(); // подписываемся на события _tab.CandleFinishedEvent += Tab_CandleFinishedEvent; _tab.PositionClosingFailEvent += Tab_PositionClosingFailEvent; _tab.PositionClosingSuccesEvent += Tab_PositionClosingSuccesEvent; _tab.PositionOpeningFailEvent += Tab_PositionOpeningFailEvent; _tab.MarketDepthUpdateEvent += Tab_MarketDepthUpdateEvent; ParametrsChangeByUser += BollingerTrend_ParametrsChangeByUser; }
public Fisher(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _sma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "Bollinger", false); _sma = (Aindicator)_tab.CreateCandleIndicator(_sma, "Prime"); Regime = CreateParameter("Regime", "Off", new[] { "Off", "On" }); TimeRebuildOrder = CreateParameter("Time Rebuild Order", 30, 0, 20, 5); Volume = CreateParameter("Volume", 0.1m, 0.1m, 50, 0.1m); PersentFromBorder = CreateParameter("Persent From Border ", 2m, 0.3m, 4, 0.3m); PriceDecimals = CreateParameter("Price Decimals", 0, 0, 20, 1); Thread worker = new Thread(Logic); worker.IsBackground = true; worker.Start(); DeleteEvent += Fisher_DeleteEvent; }
public StrategyLevermor(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); ChannelLength = CreateParameter("ChannelLength", 10, 10, 400, 10); SmaLength = CreateParameter("SmaLength", 10, 5, 150, 2); MaximumPosition = CreateParameter("MaxPosition", 5, 1, 20, 3); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); VolumeType = CreateParameter("Volume type", "Absolute", new[] { "Absolute", "Portfolio %", }); VolumeDecimals = CreateParameter("Volume decimals", 0, 0, 30, 1); Slippage = CreateParameter("Slipage", 0, 0, 20, 1); PersentDopBuy = CreateParameter("PersentDopBuy", 0.5m, 0.1m, 2, 0.1m); PersentDopSell = CreateParameter("PersentDopSell", 0.5m, 0.1m, 2, 0.1m); TralingStopLength = CreateParameter("TralingStopLength", 3, 3, 8, 0.5m); ExitType = CreateParameter("ExitType", "Traling", new[] { "Traling", "Sma" }); _sma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "MovingLong", false); _sma = (Aindicator)_tab.CreateCandleIndicator(_sma, "Prime"); _sma.ParametersDigit[0].Value = SmaLength.ValueInt; _sma.Save(); _channel = IndicatorsFactory.CreateIndicatorByName("PriceChannel", name + "Chanel", false); _channel = (Aindicator)_tab.CreateCandleIndicator(_channel, "Prime"); _channel.ParametersDigit[0].Value = ChannelLength.ValueInt; _channel.ParametersDigit[1].Value = ChannelLength.ValueInt; _channel.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; _tab.PositionOpeningSuccesEvent += PositionOpeningSuccesEvent; DeleteEvent += Strategy_DeleteEvent; ParametrsChangeByUser += StrategyLevermor_ParametrsChangeByUser; }
private void AcceptCreationScriptIndicator() { string areaName = _gridViewAreas.SelectedCells[0].Value.ToString(); if (areaName == "NewArea") { for (int i = 0; i < 30; i++) { if (_chartMaster.AreaIsCreate("NewArea" + i) == false) { areaName = "NewArea" + i; break; } } } string indicatorName = _gridNamesScript.SelectedCells[0].Value.ToString(); string name = ""; for (int i = 0; i < 30; i++) { if (_chartMaster.IndicatorIsCreate(_chartMaster.Name + indicatorName + i) == false) { name = indicatorName + i; break; } } IndicatorCandle = IndicatorsFactory.CreateIndicatorByName(indicatorName, _chartMaster.Name + name, true); _chartMaster.CreateIndicator(IndicatorCandle, areaName); Close(); if (IndicatorCandle != null) { IndicatorCandle.ShowDialog(); } }
public CciTrade(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); Slippage = CreateParameter("Slippage", 0, 0, 20, 1); CciLength = CreateParameter("Cci Length", 20, 10, 40, 2); UpLineValue = CreateParameter("Up Line Value", 150, 50.0m, 300, 20m); DownLineValue = CreateParameter("Down Line Value", -150, -300.0m, -50, 20); _cci = IndicatorsFactory.CreateIndicatorByName("CCI", name + "Cci", false); _cci.ParametersDigit[0].Value = CciLength.ValueInt; _cci = (Aindicator)_tab.CreateCandleIndicator(_cci, "CciArea"); _cci.Save(); Upline = new LineHorisontal("upline", "CciArea", false) { Color = Color.Green, Value = 0, }; _tab.SetChartElement(Upline); Downline = new LineHorisontal("downline", "CciArea", false) { Color = Color.Yellow, Value = 0 }; _tab.SetChartElement(Downline); Upline.Value = UpLineValue.ValueDecimal; Downline.Value = DownLineValue.ValueDecimal; _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; ParametrsChangeByUser += Event_ParametrsChangeByUser; }
public FundBalanceDivergenceBot(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On" }); IndicatorLookBack = CreateParameter("Indicator Look Back", 10, 5, 25, 1); IndicatorLookForward = CreateParameter("Indicator Look Forward", 10, 5, 25, 1); IndicatorDivergence = CreateParameter("Divergence to inter", 5m, 1, 25, 1); DaysInPosition = CreateParameter("Days in position", 10, 3, 25, 1); DaysBeforeEndQuarterToInter = CreateParameter("Days Before End Quarter To Inter", 10, 3, 25, 1); FBD = IndicatorsFactory.CreateIndicatorByName("FBD", name + "FBD", false); FBD = (Aindicator)_tab.CreateCandleIndicator(FBD, "FBDArea"); FBD.ParametersDigit[0].Value = IndicatorLookBack.ValueInt; FBD.ParametersDigit[1].Value = IndicatorLookForward.ValueInt; FBD.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; ParametrsChangeByUser += Event_ParametrsChangeByUser; }
public BollingerTrailing(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; Regime = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" }); Volume = CreateParameter("Volume", 3, 1.0m, 50, 4); Slippage = CreateParameter("Slipage", 0, 0, 20, 1); IndLenght = CreateParameter("IndLength", 10, 10, 80, 3); BollingerDeviation = CreateParameter("Bollinger Deviation", 2, 0.5m, 4, 0.1m); _bollinger = IndicatorsFactory.CreateIndicatorByName("Bollinger", name + "Bollinger", false); _bollinger.ParametersDigit[0].Value = IndLenght.ValueInt; _bollinger.ParametersDigit[1].Value = BollingerDeviation.ValueDecimal; _bollinger = (Aindicator)_tab.CreateCandleIndicator(_bollinger, "Prime"); _bollinger.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; _tab.PositionOpeningSuccesEvent += ReloadTrailingPosition; ParametrsChangeByUser += Event_ParametrsChangeByUser; }