Ejemplo n.º 1
0
        protected override void OnStart()
        {
            Positions.Opened += OnPositionOpen;
            tm = new TradeManager(this);
            tm.PrintTestMessage();

            IndAtr = Indicators.AverageTrueRange(14, MovingAverageType.Simple);
            IndSMA = Indicators.SimpleMovingAverage(SMASource, SMAPeriod);
            IndSAR = Indicators.ParabolicSAR(SARMINAF, SARMAXAF);
            IndDMS = Indicators.DirectionalMovementSystem(DMSPeriod);

            /*
             * ===============================================================================================
             * DETERMINE STOP LOSS AND TAKE PROFIT VALUES
             * ===============================================================================================
             */
            if (TrailingStopTrigger == 0 || IncludeTrailingStop == false)
            {
                Vstop_loss = null;
            }
            else
            {
                Vstop_loss = TrailingStopTrigger;
            }
            // TAKE PROFIT
            // IF SET TO 0 OR USER HAS NOT INCLUDED TAKE PROFIT - SET TO NULL
            if (TakeProfitTrigger == 0 || IncludeTakeProfit == false)
            {
                Vtake_profit = null;
            }
            else
            {
                Vtake_profit = TakeProfitTrigger;
            }
        }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
        protected override void Initialize()
        {
            _highSeries = CreateDataSeries();
            _lowSeries  = CreateDataSeries();

            _smaHigh = Indicators.SimpleMovingAverage(_highSeries, SmaPeriod);
            _smaLow  = Indicators.SimpleMovingAverage(_lowSeries, SmaPeriod);

            _dms = Indicators.DirectionalMovementSystem(AdxPeriod);
        }
Ejemplo n.º 4
0
        internal BandScalpingEngine(BandScalpingcBot robot)
        {
            bsBot = robot;

            bb  = bsBot.Indicators.BollingerBands(bsBot.Bars.ClosePrices, bsBot.BBPeriods, bsBot.BBStandardDev, MovingAverageType.Exponential);
            rsi = bsBot.Indicators.RelativeStrengthIndex(bsBot.Bars.ClosePrices, bsBot.RSIPeriods);
            adx = bsBot.Indicators.DirectionalMovementSystem(bsBot.DMSPeriod);

            Start();
        }
Ejemplo n.º 5
0
        protected override void Initialize()
        {
            _highSeries = CreateDataSeries();
            _lowSeries = CreateDataSeries();

            _smaHigh = Indicators.SimpleMovingAverage(_highSeries, SmaPeriod);
            _smaLow = Indicators.SimpleMovingAverage(_lowSeries, SmaPeriod);

            _dms = Indicators.DirectionalMovementSystem(AdxPeriod);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Viene generato all'avvio dell'indicatore, si inizializza l'indicatore
        /// </summary>
        protected override void Initialize()
        {
            // --> Stampo nei log la versione corrente
            Print("{0} : {1}", NAME, VERSION);

            _MyMAup = Indicators.MovingAverage(Bars.HighPrices, Period, MaType);
            _MyMA   = Indicators.MovingAverage(Bars.ClosePrices, Period, MaType);
            _MyMAdw = Indicators.MovingAverage(Bars.LowPrices, Period, MaType);

            _MyADX = Indicators.DirectionalMovementSystem(Smoothed);
        }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
 protected override void Initialize()
 {
     _dms  = Indicators.DirectionalMovementSystem(ADX_Periods);
     _rsi  = Indicators.RelativeStrengthIndex(Source, FastRSI);
     _rsi2 = Indicators.RelativeStrengthIndex(Source, SlowRSI);
 }
Ejemplo n.º 9
0
 protected override void Initialize()
 {
     _dms = Indicators.DirectionalMovementSystem(14);
 }
Ejemplo n.º 10
0
 protected override void Initialize()
 {
     adx = Indicators.DirectionalMovementSystem(14);
 }
Ejemplo n.º 11
0
 protected override void Initialize()
 {
     // Initialize and create nested indicators
     dms  = Indicators.DirectionalMovementSystem(ADX_Periods);
     stoc = Indicators.StochasticOscillator(K_Period, Slow_K, D_Period, MAType);
 }
Ejemplo n.º 12
0
 protected override void Initialize()
 {
     _dms     = Indicators.DirectionalMovementSystem(ADX_Periods);
     DI_Plus  = Indicators.SimpleMovingAverage(buy, ADX_Periods);
     DI_Minus = Indicators.SimpleMovingAverage(sell, ADX_Periods);
 }
        protected override void OnStart()
        {
            if (TimeFrame <= TimeFrame.Hour)
                PivotTimeFrame = TimeFrame.Daily;
            else if (TimeFrame < TimeFrame.Daily)
                PivotTimeFrame = TimeFrame.Weekly;
            else
                PivotTimeFrame = TimeFrame.Monthly;

            Adx = Indicators.DirectionalMovementSystem(ADXPeriods);
        }
        public Candle(MarketSeries marketSeries, int index, int period, DirectionalMovementSystem dms)
        {
            High = marketSeries.High.Last(index);
            Open = marketSeries.Open.Last(index);
            Close = marketSeries.Close.Last(index);
            Low = marketSeries.Low.Last(index);
            OpenTime = marketSeries.OpenTime.Last(index);

            if (dms.DIPlus.Last(index) > dms.DIMinus.Last(index))
                Trend = TypeTrend.Upper;
            if (dms.DIPlus.Last(index) < dms.DIMinus.Last(index))
                Trend = TypeTrend.Down;
            if (dms.DIPlus.Last(index) == dms.DIMinus.Last(index))
                Trend = TypeTrend.Lateral;

            StrongTrend = false;
            if (dms.ADX.Last(index) >= 20)
                StrongTrend = true;

            Bull = Open < Close;
            BodySize = Math.Abs(Open - Close);
            ShadeHigh = High - Open;
            ShadeLow = Close - Low;
            if (Bull)
            {
                ShadeHigh = High - Close;
                ShadeLow = Open - Low;
            }
            HighLow = High - Low;

            double sum = 0;
            for (int i = index + 1; i <= period; i++)
                sum = sum + Math.Abs(marketSeries.Open.Last(i) - marketSeries.Close.Last(i));
            sum = sum / period;

            //--- long
            if (BodySize > sum * 1.3)
                Type = TypeCandlestick.CandLong;

            //--- short
            if (BodySize < sum * 0.5)
                Type = TypeCandlestick.CandShort;

            //--- doji
            if (BodySize < HighLow * 0.03)
                Type = TypeCandlestick.CandDoji;

            //--- maribozu
            if ((ShadeLow < BodySize * 0.01 || ShadeHigh < BodySize * 0.01) && BodySize > 0)
            {
                if (Type == TypeCandlestick.CandLong)
                    Type = TypeCandlestick.CandMaribozuLong;
                else
                    Type = TypeCandlestick.CandMaribozu;
            }

            //--- hammer
            if (ShadeLow > BodySize * 2 && ShadeHigh < BodySize * 0.1)
                Type = TypeCandlestick.CandHammer;

            //--- invert hammer
            if (ShadeLow < BodySize * 0.1 && ShadeHigh > BodySize * 2)
                Type = TypeCandlestick.CandInvertHammer;

            //--- spinning top
            if (Type == TypeCandlestick.CandShort && ShadeLow > BodySize && ShadeHigh > BodySize)
                Type = TypeCandlestick.CandSpinTop;
        }
Ejemplo n.º 15
0
 protected override void Initialize()
 {
     adx = Indicators.DirectionalMovementSystem(interval);
 }