Beispiel #1
0
        /*public void OnTick(object sender)
         * {
         *  Robot bot = (Robot)sender;
         *  TimeFrame timeFrame = bot.TimeFrame;
         *
         *  CloseIfStopLossTriggered();
         *  CloseIfTakeProfitTriggered()
         * }*/

        public void CloseIfStopLossTriggered()
        {
            //l.LogTrace("[sl close debug] SL: " + StopLoss + " Ask: " + symbol.Ask + " " + TradeMath.IsStopLossTriggered(StopLoss, position, symbol));
            if (TradeMath.IsStopLossTriggered(StopLoss, position, symbol))
            {
                /* if (position.TradeType == TradeType.Sell)
                 * {
                 *  l.LogTrace("[SL CLOSE] Ask: " + symbol.Ask + " SL:" + StopLoss);
                 * }
                 * else
                 * {
                 *  l.LogTrace("[SL CLOSE] Bid: " + symbol.Bid + " SL:" + StopLoss);
                 * }*/
                bot.ClosePosition(position);
                return;
            }
        }