/// <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]);
            //TwoSMARule rule1 = new TwoSMARule(data.Close, (int)parameters[3], (int)parameters[4]);
            TwoSMABasicMACDRule rule = new TwoSMABasicMACDRule(data.Close, parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]);
            int Bar = data.Close.Count - 1;

            if (rule.DownTrend(Bar))
            {
                BusinessInfo info = new BusinessInfo();
                info.Weight = data.Close[Bar];
                SelectStock(Bar, info);
            }
        }
        /// <summary>
        /// Strategy following hybrid : basic MACD rule&&2sma
        /// </summary>
        override protected void StrategyExecute()
        {
            //BasicMACDRule rule = new BasicMACDRule(data.Close, (int)parameters[0], (int)parameters[1], (int)parameters[2]);
            //TwoSMARule rule1 = new TwoSMARule(data.Close, (int)parameters[3], (int)parameters[4]);
            TwoSMABasicMACDRule rule = new TwoSMABasicMACDRule(data.Close, parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]);
            int cutlosslevel         = (int)parameters[5];
            int trailingstoplevel    = (int)parameters[6];
            int takeprofitlevel      = (int)parameters[7];


            for (int idx = 0; idx < data.Close.Count; idx++)
            {
                //Buy condition
                if (rule.isValid_forBuy(idx))
                {
                    BusinessInfo info = new BusinessInfo();
                    info.SetTrend(AppTypes.MarketTrend.Upward, AppTypes.MarketTrend.Unspecified, AppTypes.MarketTrend.Unspecified);
                    info.Weight = data.Close[idx];
                    BuyAtClose(idx, info);
                }
                //Sell condition
                else
                if (rule.isValid_forSell(idx))
                {
                    BusinessInfo info = new BusinessInfo();
                    info.SetTrend(AppTypes.MarketTrend.Downward, AppTypes.MarketTrend.Unspecified, AppTypes.MarketTrend.Unspecified);
                    SellAtClose(idx, info);
                }
                if (is_bought && CutLossCondition(data.Close[idx], buy_price, cutlosslevel))
                {
                    SellCutLoss(idx);
                }

                if (is_bought && TakeProfitCondition(data.Close[idx], buy_price, takeprofitlevel))
                {
                    SellTakeProfit(idx);
                }

                if (trailingstoplevel > 0)
                {
                    TrailingStopWithBuyBack(rule, data.Close[idx], trailingstoplevel, idx);
                }
            }
        }
 /// <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]);
     //TwoSMARule rule1 = new TwoSMARule(data.Close, (int)parameters[3], (int)parameters[4]);
     TwoSMABasicMACDRule rule = new TwoSMABasicMACDRule(data.Close, parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]);
     int Bar = data.Close.Count - 1;
     if (rule.DownTrend(Bar))
     {
         BusinessInfo info = new BusinessInfo();
         info.Weight = data.Close[Bar];
         SelectStock(Bar, info);
     }
 }
        /// <summary>
        /// Strategy following hybrid : basic MACD rule&&2sma
        /// </summary>
        override protected void StrategyExecute()
        {
            //BasicMACDRule rule = new BasicMACDRule(data.Close, (int)parameters[0], (int)parameters[1], (int)parameters[2]);
            //TwoSMARule rule1 = new TwoSMARule(data.Close, (int)parameters[3], (int)parameters[4]);
            TwoSMABasicMACDRule rule = new TwoSMABasicMACDRule(data.Close, parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]);
            int cutlosslevel = (int)parameters[5];
            int trailingstoplevel = (int)parameters[6];
            int takeprofitlevel = (int)parameters[7];

            
            for (int idx = 0; idx < data.Close.Count; idx++)
            {
                //Buy condition
                if (rule.isValid_forBuy(idx))
                {
                    BusinessInfo info = new BusinessInfo();
                    info.SetTrend(AppTypes.MarketTrend.Upward, AppTypes.MarketTrend.Unspecified, AppTypes.MarketTrend.Unspecified);
                    info.Weight = data.Close[idx];
                    BuyAtClose(idx, info);
                }
                //Sell condition
                else
                    if (rule.isValid_forSell(idx) )
                    {
                        BusinessInfo info = new BusinessInfo();
                        info.SetTrend(AppTypes.MarketTrend.Downward, AppTypes.MarketTrend.Unspecified, AppTypes.MarketTrend.Unspecified);
                        SellAtClose(idx, info);
                    }
                if (is_bought && CutLossCondition(data.Close[idx], buy_price, cutlosslevel))
                    SellCutLoss(idx);

                if (is_bought && TakeProfitCondition(data.Close[idx], buy_price, takeprofitlevel))
                    SellTakeProfit(idx);

                if (trailingstoplevel > 0)
                    TrailingStopWithBuyBack(rule, data.Close[idx], trailingstoplevel, idx);
            }
        }