Ejemplo n.º 1
0
 /// <summary>
 /// Screening following basic MACD rule
 /// </summary>
 override protected void StrategyExecute()
 {
     BasicMACDRule rule = new BasicMACDRule(data.Close, (int)parameters[0], (int)parameters[1], (int)parameters[2]);
     if (rule.isValid())
     {
         int Bar = data.Close.Count - 1;
         BusinessInfo info = new BusinessInfo();
         info.Weight = rule.macd[Bar] * 100;
         SelectStock(Bar, info);
     }
 }
Ejemplo n.º 2
0
        override protected void StrategyExecute()
        {
            BasicMACDRule rule = new BasicMACDRule(data.Close, (int)parameters[0], (int)parameters[1], (int)parameters[2]);

            for (int idx = 0; idx < rule.macd.Count; idx++)
            {
                if (rule.isValid_forBuy(idx))
                    BuyAtClose(idx);
                if (rule.isValid_forSell(idx))
                    SellAtClose(idx);
            }            
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Screening following basic MACD rule
        /// </summary>
        override protected void StrategyExecute()
        {
            BasicMACDRule rule = new BasicMACDRule(data.Close, (int)parameters[0], (int)parameters[1], (int)parameters[2]);

            if (rule.isValid())
            {
                int          Bar  = data.Close.Count - 1;
                BusinessInfo info = new BusinessInfo();
                info.Weight = rule.macd[Bar] * 100;
                SelectStock(Bar, info);
            }
        }
Ejemplo n.º 4
0
        public HybridTestRules(DataBars db, double atrperiod, double shortperiod, double longperiod)
        {
            rules = new Rule[3];
            rules[0] = new TwoSMARule(db.Close, shortperiod, longperiod);
            rules[1] = new BasicATRRule(db, atrperiod, "atr");
            rules[2] = new BasicMACDRule(db.Close, 12, 26, 9);

            adxTrend = new ADXMarketTrend(db, 14);
            //Kiem tra volume
            volumeRule = new PriceTwoSMARule(db.Volume, 10, 30);
            data = db;
            Volume_Filter = 50000;
        }
Ejemplo n.º 5
0
        public HybridTestRules(DataBars db, double atrperiod, double shortperiod, double longperiod)
        {
            rules    = new Rule[3];
            rules[0] = new TwoSMARule(db.Close, shortperiod, longperiod);
            rules[1] = new BasicATRRule(db, atrperiod, "atr");
            rules[2] = new BasicMACDRule(db.Close, 12, 26, 9);

            adxTrend = new ADXMarketTrend(db, 14);
            //Kiem tra volume
            volumeRule    = new PriceTwoSMARule(db.Volume, 10, 30);
            data          = db;
            Volume_Filter = 50000;
        }
Ejemplo n.º 6
0
        override protected void StrategyExecute()
        {
            BasicMACDRule rule = new BasicMACDRule(data.Close, (int)parameters[0], (int)parameters[1], (int)parameters[2]);

            for (int idx = 0; idx < rule.macd.Count; idx++)
            {
                if (rule.isValid_forBuy(idx))
                {
                    BuyAtClose(idx);
                }
                if (rule.isValid_forSell(idx))
                {
                    SellAtClose(idx);
                }
            }
        }
Ejemplo n.º 7
0
 public TwoSMABasicMACDRule(DataSeries ds, double fast, double slow, double signal, double shortperiod, double longperiod)
 {
     rules    = new Rule[2];
     rules[0] = new BasicMACDRule(ds, (int)fast, (int)slow, (int)signal);
     rules[1] = new TwoSMARule(ds, shortperiod, longperiod);
 }
Ejemplo n.º 8
0
 public TwoSMABasicMACDRule(DataSeries ds, double fast, double slow, double signal, double shortperiod, double longperiod)
 {
     rules = new Rule[2];
     rules[0] = new BasicMACDRule(ds, (int)fast,(int)slow,(int)signal);
     rules[1] = new TwoSMARule(ds, shortperiod, longperiod);
 }