Exemple #1
0
 protected override void Create()
 {
     m_dema      = new Dema(this);
     m_avgdouble = new VariableSeries <Double>(this);
     //Plotting
     Plot1 = AddPlot(new PlotAttributes("AvgDouble", 0, Color.Blue, Color.Empty, 0, 0, true));
     Plot2 = AddPlot(new StringPlotAttributes("Trend", Color.Aqua));
 }
Exemple #2
0
        protected override void Create()
        {
            // create variable objects, function objects, order objects etc.
            DailyDema  = new Dema(this, 1);
            WeeklyDema = new Dema(this, 2);

            FE         = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "FE", EOrderAction.Buy));
            SL1        = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "SL1", EOrderAction.Sell, OrderExit.FromEntry(FE)));
            TralingSL1 = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "Trail1", EOrderAction.Sell, OrderExit.FromEntry(FE)));

            StrategyPositionStates = new Dictionary <EMarketPositionSide, Action <double, double> >()
            {
                { EMarketPositionSide.Flat, this.EMarketPositionSideFlat },
                { EMarketPositionSide.Long, this.EMarketPositionSideLong },
                { EMarketPositionSide.Short, this.EMarketPositionSideShort }
            };
        }
Exemple #3
0
        protected override void Initialize()
        {
            Buffer = CreateDataSeries();

            // Moving Average Type according to input MA_Type
            switch (MAType)
            {
            case 1:
                // Simple Moving Average
                _sma = Indicators.SimpleMovingAverage(MAApplied, MAPeriod);
                break;

            case 2:
                // Exponential Moving Average
                _ema = Indicators.ExponentialMovingAverage(MAApplied, MAPeriod);
                break;

            case 3:
                // Smoothed Moving Average
                _wsma = Indicators.GetIndicator <Wsma>(MAApplied, MAPeriod);
                break;

            case 4:
                // Linear Weighted Moving Average
                _lwma = Indicators.GetIndicator <Lwma>(MAApplied, MAPeriod);
                break;

            case 5:
                // Double Exponential Moving Average
                _dema = Indicators.GetIndicator <Dema>(MAApplied, MAPeriod);
                break;

            case 6:
                // Triple Exponential Moving Average
                _tema = Indicators.GetIndicator <Tema>(MAApplied, MAPeriod);
                break;

            case 7:
                // T3 Moving Average
                _t3MA = Indicators.GetIndicator <T3MA>(MAApplied, MAPeriod, T3MAVolumeFactor);
                break;
            }
        }
Exemple #4
0
        protected override void Initialize()
        {
            Buffer = CreateDataSeries();

            // Moving Average Type according to input MA_Type
            switch (MAType)
            {
                case 1:
                    // Simple Moving Average
                    _sma = Indicators.SimpleMovingAverage(MAApplied, MAPeriod);
                    break;
                case 2:
                    // Exponential Moving Average
                    _ema = Indicators.ExponentialMovingAverage(MAApplied, MAPeriod);
                    break;
                case 3:
                    // Smoothed Moving Average		
                    _wsma = Indicators.GetIndicator<Wsma>(MAApplied, MAPeriod);
                    break;
                case 4:
                    // Linear Weighted Moving Average  
                    _lwma = Indicators.GetIndicator<Lwma>(MAApplied, MAPeriod);
                    break;
                case 5:
                    // Double Exponential Moving Average
                    _dema = Indicators.GetIndicator<Dema>(MAApplied, MAPeriod);
                    break;
                case 6:
                    // Triple Exponential Moving Average
                    _tema = Indicators.GetIndicator<Tema>(MAApplied, MAPeriod);
                    break;
                case 7:
                    // T3 Moving Average
                    _t3MA = Indicators.GetIndicator<T3MA>(MAApplied, MAPeriod, T3MAVolumeFactor);
                    break;
            }
        }