예제 #1
0
 protected override void Initialize()
 {
     MA1   = Indicators.MovingAverage(MarketSeries.High, Keltner_Period, MovingAverageType.Simple);
     MA2   = Indicators.MovingAverage(MarketSeries.Low, Keltner_Period, MovingAverageType.Simple);
     MA3   = Indicators.MovingAverage(MarketSeries.Typical, Keltner_Period, MovingAverageType.Simple);
     iBand = iBand = Indicators.BollingerBands(MarketSeries.Close, Boll_Period, Boll_Dev, MovingAverageType.Simple);
 }
예제 #2
0
        protected override void Initialize()
        {
            BB = Indicators.BollingerBands(Source, Periods, Std_Deviation, MA_Type);

            FireSoundAlarm = true;
            theCount       = MarketSeries.Close.Count;
        }
예제 #3
0
 protected override void Initialize()
 {
     _rsi            = Indicators.RelativeStrengthIndex(Source, RsiPeriod);
     _bollingerBands = Indicators.BollingerBands(_rsi.Result, Volatility, StDev, MovingAverageType.Simple);
     _price          = Indicators.MovingAverage(_rsi.Result, PricePeriod, PriceMaType);
     _signal         = Indicators.MovingAverage(_rsi.Result, SignalPeriod, SignalMaType);
 }
예제 #4
0
 protected override void OnStart()
 {
     bb   = Indicators.BollingerBands(MarketSeries.Close, bbperiod, bbotcl, MovingAverageType.Simple);
     rsi  = Indicators.RelativeStrengthIndex(MarketSeries.Close, rsiperiod);
     psar = Indicators.ParabolicSAR(SARstep, SARmax);
     frc  = Indicators.FractalChaosBands(5);
 }
예제 #5
0
 protected override void OnStart()
 {
     Print("START gyBolliBanBreak: {0}", Server.Time.ToLocalTime());
     bbnd1 = Indicators.BollingerBands(srcBB, prdBB, devBB1, matBB);
     bbnd2 = Indicators.BollingerBands(srcBB, prdBB, devBB2, matBB);
     sma1  = Indicators.SimpleMovingAverage(srcSMA, prdSMA);
 }
 protected override void OnStart()
 {
     i_Bollinger_Bands   = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);
     i_Bollinger_Bands_1 = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);
     i_Bollinger_Bands_2 = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);
     i_Bollinger_Bands_3 = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);
 }
        protected override void Initialize()
        {
            Result = CreateDataSeries();

            iMACD  = Indicators.MacdCrossOver(26, 12, 9);
            iBands = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);
        }
예제 #8
0
        protected override void OnStart()
        {
            BB              = Indicators.BollingerBands(BBSource, BBPeriods, BBStDev, BBMAType);
            ActiveGrids     = new List <Grid>();
            UnitTradingCost = RoundLotCost / Symbol.LotSize;

            KellyParameters = new Dictionary <string, double[]>
            {
                {
                    "WinningTrades",
                    new double[GridLevelCount]
                },
                {
                    "LosingTrades",
                    new double[GridLevelCount]
                },
                {
                    "Profit",
                    new double[GridLevelCount]
                },
                {
                    "Loss",
                    new double[GridLevelCount]
                }
            };

            firstIndex = Convert.ToInt32(EntryAfterConfirmation);

            Positions.Closed += OnPositionClosed;
        }
 /// <summary>
 /// CALLED WHEN THE ROBOT FIRST STARTS, IT IS ONLY CALLED ONCE.
 /// </summary>
 protected override void OnStart()
 {
     // TRADE MANAGER DECLERATION
     tm = new TradeManager(this);
     // INDICATOR DECLERATIONS
     IndIchi = Indicators.IchimokuKinkoHyo(TenkanSen, KijunSen, SenkouSpanB);
     IndBoll = Indicators.BollingerBands(BollDS, BollPeriod, BollSD, BollMAT);
 }
예제 #10
0
        protected override void OnStart()
        {
            Positions.Opened += OnPositionOpened;

            bollingerBands = Indicators.BollingerBands(Source, Periods, Deviation, MAType);
            //BandHeight = (bollingerBands.Top.LastValue - bollingerBands.Bottom.LastValue) / 3;
            //DeltaBollinger = BandHeight / 5;
        }
예제 #11
0
 //---
 protected override void OnStart()
 {
     //--- エントリーイベント
     Positions.Opened += OnPositionOpened;
     //--- BB
     bol     = Indicators.BollingerBands(MarketSeries.Close, Period1, SD1, MovingAverageType.Simple);
     slowBol = Indicators.BollingerBands(MarketSeries.Close, Period2, SD2, MovingAverageType.Simple);
 }
예제 #12
0
 protected override void OnStart()
 {
     fastMa   = Indicators.MovingAverage(SourceSeries, FastPeriods, MAType);
     mediumMa = Indicators.MovingAverage(SourceSeries, mediumPeriods, MAType);
     slowMa   = Indicators.MovingAverage(SourceSeries, SlowPeriods, MAType);
     atr      = Indicators.AverageTrueRange(atrPeriod, MAType);
     bBand    = Indicators.BollingerBands(SourceSeries, bBandPeriods, bBandDeviations, MAType);
 }
        protected override void OnStart()
        {
            bollingerBands  = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
            delayCounter    = ExecutionDelay;
            qtdPositionLoss = 0;
            lastStopLoss    = Server.Time;

            Positions.Closed += OnPositionClosed;
        }
예제 #14
0
        protected override void OnStart()
        {
            _botName       = ToString();
            _instanceLabel = string.Format("{0}-{1}-{2}-{3}", _botName, _botVersion, Symbol.Code, TimeFrame.ToString());

            Positions.Opened += OnPositionOpened;

            bb = Indicators.BollingerBands(Source, Periods, Deviation, MAType);
        }
예제 #15
0
 protected override void OnStart()
 {
     //fastMa = Indicators.MovingAverage(SourceSeries, FastPeriods, MAType);
     //mediumMa = Indicators.MovingAverage(SourceSeries, mediumPeriods, MAType);
     //slowMa = Indicators.MovingAverage(SourceSeries, SlowPeriods, MAType);
     atr   = Indicators.AverageTrueRange(atrPeriod, MAType);
     bBand = Indicators.BollingerBands(SourceSeries, bBandPeriods, bBandDeviations, MAType);
     _kama = Indicators.GetIndicator <KAMASignal>(Source, Fast, Slow, Period);
 }
 protected override void Initialize()
 {
     bb       = Indicators.BollingerBands(source, bandsPeriod, deviations, bandsMAType);
     pctB     = CreateDataSeries();
     bandsGap = CreateDataSeries();
     // zscore = Indicators.GetIndicator<ZScore>(bandsGap, lookBack);
     ma = Indicators.MovingAverage(bandsGap, lookBack, MovingAverageType.Simple);
     sd = Indicators.StandardDeviation(bandsGap, lookBack, MovingAverageType.Simple);
 }
예제 #17
0
 protected override void Initialize()
 {
     MacD = Indicators.MacdHistogram(LngCycle, ShrtCycle, SigPeriod);
     // Initialize keltner Channels
     _momentum = Indicators.MomentumOscillator(MarketSeries.Close, Periods);
     LR_Slope  = Indicators.LinearRegressionSlope(MarketSeries.Close, Periods);
     Klt       = Indicators.KeltnerChannels(Klt_Periods, MovingAverageType.Exponential, Klt_ATR_Periods, MovingAverageType.Simple, Klt_stdDev);
     bb        = Indicators.BollingerBands(bb_Source, bb_Periods, bb_stdDev, MovingAverageType.Simple);
 }
예제 #18
0
        protected override void OnStart()
        {
            rsi = Indicators.RelativeStrengthIndex(Source, Period0);
            bol = Indicators.BollingerBands(Source, Period1, stdev, MovingAverageType.Simple);

            //obtain high and low of initial start bar
            double max = MarketSeries.High.LastValue;
            double min = MarketSeries.Low.LastValue;
        }
예제 #19
0
 protected override void OnStart()
 {
     Positions.Closed += PositionsOnClosed;
     Print("START GyBolliBanRange: {0}", Server.Time.ToLocalTime());
     BolliBan1 = Indicators.BollingerBands(SourceBB, PeriodBB, DeviateBB1, MaTypeBB);
     BolliBan2 = Indicators.BollingerBands(SourceBB, PeriodBB, DeviateBB2, MaTypeBB);
     SignalMA  = Indicators.MovingAverage(SourceSignalMA, PeriodSignalMA, MaTypeSignal);
     FilterADX = Indicators.DirectionalMovementSystem(PeriodADX);
 }
예제 #20
0
 protected override void Initialize()
 {
     llrrss = Indicators.LinearRegressionSlope(source, linRegSlpPeriods).Result;
     //lrs = Indicators.LinearRegressionSlope(source, linRegSlpPeriods);
     bb       = Indicators.BollingerBands(llrrss, /*lrs.Result*/ bandsPeriod, deviations, bandsMAType);
     pctB     = CreateDataSeries();
     bandsGap = CreateDataSeries();
     ma       = Indicators.MovingAverage(bandsGap, lookBack, MovingAverageType.Simple);
     sd       = Indicators.StandardDeviation(bandsGap, lookBack, MovingAverageType.Simple);
 }
예제 #21
0
        protected override void OnStart()
        {
            if (Symbol.Code != "EURUSD" || TimeFrame != TimeFrame.Minute5)
            {
                Print("This robot can be run only on EURUSD Minute5");
                Stop();
                return;
            }

            _bb = Indicators.BollingerBands(MarketSeries.High, Period, StandardDeviation, MAType);
        }
예제 #22
0
 protected override void OnStart()
 {
     Print("START GyBolliBanBreak: {0}", Server.Time.ToLocalTime());
     BolliBan1  = Indicators.BollingerBands(SourceBB, PeriodBB, DeviateBB1, MaTypeBB);
     BolliBan2  = Indicators.BollingerBands(SourceBB, PeriodBB, DeviateBB2, MaTypeBB);
     SignalMA   = Indicators.SimpleMovingAverage(SourceSignalMA, PeriodSignalMA);
     FilterADX  = Indicators.DirectionalMovementSystem(PeriodADX);
     curstate   = States.Initial;
     longstate  = HasLong.Initial;
     shortstate = HasShort.Initial;
 }
예제 #23
0
        protected override void OnStart()
        {
            Positions.Closed += OnClosePosition;

            longAverage      = Indicators.ExponentialMovingAverage(MarketSeries.Close, LongPeriods);
            shortAverage     = Indicators.ExponentialMovingAverage(MarketSeries.Close, ShortPeriods);
            bollingerBands   = Indicators.BollingerBands(MarketSeries.Close, BollingerPeriods, 2, MovingAverageType.Exponential);
            tradeVolumeIndex = Indicators.TradeVolumeIndex(MarketSeries.Close);

            base.OnStart();
        }
예제 #24
0
        protected override void OnStart()
        {
            Print(Time + " Working");
            _botId             = generateBotId();
            _swordFishTimeInfo = new MarketTimeInfo();
            setTimeZone();
            _boli = Indicators.BollingerBands(DataSeriesSource, 2, 20, MovingAverageType.Exponential);

            Positions.Opened += PositionsOnOpened;
            Positions.Closed += PositionsOnClosed;
        }
예제 #25
0
        //public IndicatorDataSeries bb_main { get; set; }
        //[Output("4", Color = Colors.Red, PlotType = PlotType.Line, Thickness = 2)]
        //public IndicatorDataSeries bb_top { get; set; }

        //[Output("5", Color = Colors.Red, PlotType = PlotType.Line, Thickness = 2)]
        //public IndicatorDataSeries bb_bottom { get; set; }

        //public IndicatorDataSeries bb_bottom;

        //////////////////////////////////



        protected override void Initialize()
        {
            MacD_Series = MarketData.GetSeries(MacD_TF);
            // Initialize keltner Channels
            LR_Slope  = Indicators.LinearRegressionSlope(MarketSeries.Close, Periods);
            _momentum = Indicators.MomentumOscillator(MarketSeries.Close, Periods);
            MacD      = Indicators.MacdHistogram(MacD_Series.Close, LngCycle, ShrtCycle, SigPeriod);

            Klt = Indicators.KeltnerChannels(20, MovingAverageType.Exponential, 10, MovingAverageType.Simple, 1.5);
            bb  = Indicators.BollingerBands(bb_Source, 20, 2.0, MovingAverageType.Simple);
            //form1 = new System.Windows.Forms.Form();
        }
예제 #26
0
        //////////////////////////////////

        protected override void Initialize()
        {
            Squeeze   = theBullet[Draw_String];
            ECO       = CreateDataSeries();
            CO_Series = CreateDataSeries();
            HL_Series = CreateDataSeries();

            EMA_CO   = Indicators.ExponentialMovingAverage(CO_Series, Interval_1);
            EMA_CO_S = Indicators.ExponentialMovingAverage(EMA_CO.Result, Interval_2);

            EMA_HL   = Indicators.ExponentialMovingAverage(HL_Series, Interval_1);
            EMA_HL_S = Indicators.ExponentialMovingAverage(EMA_HL.Result, Interval_2);

            Klt = Indicators.KeltnerChannels(Klt_Periods, MovingAverageType.Exponential, Klt_ATR_Periods, MovingAverageType.Simple, Klt_stdDev);
            bb  = Indicators.BollingerBands(bb_Source, bb_Periods, bb_stdDev, MovingAverageType.Simple);
        }
예제 #27
0
        protected override void OnStart()
        {
            Print("Reading '{0}'", ExpandedConfigFilePath);
            c = JsonConvert.DeserializeObject <Configuration>(File.ReadAllText(ExpandedConfigFilePath));
            if (c.EntryParameters == null)
            {
                throw new Exception("Configuration is not loaded properly");
            }

            bb = Indicators.BollingerBands(Bars.ClosePrices, c.EntryParameters.BBDistance.Periods, c.EntryParameters.BBDistance.StandardDeviation, c.EntryParameters.BBDistance.MaType);

            if (RunInfo == null)
            {
                RunInfo = new RuntimeInformation(c, this);
                Print("Entry Mode is '{0}'", c.EntryParameters.EntryMode.ToString());

                PendingOrders.Filled += PendingOrders_Filled;
            }
        }
예제 #28
0
        protected override void OnStart()
        {
            CurrentCandlestick      = this.GetMarketSeries();
            LastClosedCandlestick   = this.GetMarketSeries(1);
            Last4ClosedCandlesticks = this.GetMarketSeries(new int[] { 2, 3, 4, 5, 6 });

            BotRecommendation = new BackToSquareOne.BotRecommendation(7, InverseRecommendation);

            /*
             * BotRecommendation = new BackToSquareOne.BotRecommendation(1, InverseRecommendation);
             */
            // Put your initialization logic here
            bb = Indicators.BollingerBands(MarketSeries.Close, 20, 2, MovingAverageType.Simple);

            /*
             * sma1 = Indicators.SimpleMovingAverage(MarketSeries.Close, 5);
             * sma2 = Indicators.SimpleMovingAverage(MarketSeries.Close, 14);
             */
            /*
             * sma1 = Indicators.SimpleMovingAverage(MarketSeries.Close, 14);
             * sma2 = Indicators.SimpleMovingAverage(MarketSeries.Close, 50);
             * sma3 = Indicators.SimpleMovingAverage(MarketSeries.Close, 75);
             * sma4 = Indicators.SimpleMovingAverage(MarketSeries.Close, 100);
             */
            ema1 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 8);
            ema2 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 13);
            ema3 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 21);


            atr = Indicators.AverageTrueRange(14, MovingAverageType.Simple);
            rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, 14);

            msH1   = MarketData.GetSeries(TimeFrame.Hour);
            ema1H1 = Indicators.ExponentialMovingAverage(msH1.Close, 8);
            ema2H1 = Indicators.ExponentialMovingAverage(msH1.Close, 21);

            SetRecommendation();
            DrawSomething();
        }
예제 #29
0
        protected override void OnStart()
        {
            Print("Take Longs: {0}", TakeLongsParameter);
            Print("Take Shorts: {0}", TakeShortsParameter);

            if (!TakeLongsParameter && !TakeShortsParameter)
            {
                throw new ArgumentException("You need to decide whether to go long/short or both");
            }

            Print("Lot sizing rule: {0}", LotSizingRule);

            var symbolLeverage = Symbol.DynamicLeverage[0].Leverage;

            Print("Symbol leverage: {0}", symbolLeverage);

            var realLeverage = Math.Min(symbolLeverage, Account.PreciseLeverage);

            Print("Account leverage: {0}", Account.PreciseLeverage);

            Init(TakeLongsParameter,
                 TakeShortsParameter,
                 InitialStopLossRuleValues.None,
                 0,
                 TrailingStopLossRuleValues.None,
                 0,
                 LotSizingRule,
                 TakeProfitRuleValues.None,
                 0,
                 0,
                 false,
                 false,
                 DynamicRiskPercentage,
                 6);

            _bollingerBands = Indicators.BollingerBands(SourceSeries, 20, 1, MovingAverageType.Simple);
            _slowMA         = Indicators.MovingAverage(SourceSeries, SlowPeriodParameter, MovingAverageType.Exponential);
            _fastMA         = Indicators.MovingAverage(SourceSeries, FastPeriodParameter, MovingAverageType.Exponential);
        }
예제 #30
0
        protected override void OnStart()
        {
            //挂单标签
            labelPerfix = "TMSBot";
            //市价单标签
            scalePerfix = "scale";

            //回测
            if (IsBacktesting)
            {
                int backtestNum = new Random().Next(1, 10000);
                labelPerfix += " BT " + backtestNum;
            }

            if (scaleIn)
            {
                //写注册表
                CreateSubKey();
                if (motherClose)
                {
                    Positions.Closed += OnPositionClose;
                }
            }
            //平均正确范围指标
            atr = Indicators.AverageTrueRange(atrPeriod, MovingAverageType.Simple);
            //相对强度指数指标
            _rsi = Indicators.RelativeStrengthIndex(Source, RsiPeriod);
            //布林带指标
            _bollingerBands = Indicators.BollingerBands(_rsi.Result, Volatility, StDev, MovingAverageType.Simple);
            //移动平均线指标(RSI的平均线)
            _price  = Indicators.MovingAverage(_rsi.Result, PricePeriod, PriceMaType);
            _signal = Indicators.MovingAverage(_rsi.Result, SignalPeriod, SignalMaType);
            //随机振荡器指标
            stochastic = Indicators.StochasticOscillator(kPeriods, kSlowing, dPeriods, stMaType);
            //自定义指标
            heikenAshi = Indicators.GetIndicator <HeikenAshi>(HeikenPeriod);
        }