/// <summary>
        /// Выставление тейк-профита для позиции
        /// </summary>
        /// <param name="pos">Позиция</param>
        /// <param name="numBar">Номер бара, на котором выполняется действие, тейк-профит выставляется на следующий бар</param>
        public void SetTakeProfit(IPosition pos, int numBar)
        {
            if (pos != null && pos.IsActiveForBar(numBar))
            {
                double profitPrice = pos.GetProfitPrice(TakeProfitPct);

                if (pos.IsLong)
                {
                    pos.CloseAtProfit(numBar + 1, profitPrice, Slippage * pos.Security.Tick, "LXP");
                }
                else
                {
                    pos.CloseAtProfit(numBar + 1, profitPrice, Slippage * pos.Security.Tick, "SXP");
                }
            }
        }
        public void createOn(IPosition position, int barIndex)
        {
            double profitPrice = based[barIndex - 1] * koeff;

            if (position.IsShort) {
                profitPrice = position.EntryPrice - profitPrice;
            } else {
                profitPrice = position.EntryPrice + profitPrice;
            }

            position.CloseAtProfit(
                barIndex,
                profitPrice,
                Signals.TAKE_PROFIT_CLOSE
            );
        }
        public void createOn(IPosition position, int barIndex)
        {
            double profitPrice = 0.0;

            if (position.IsShort) {
                profitPrice = position.EntryPrice - maxProfit;
            } else {
                profitPrice = position.EntryPrice + maxProfit;
            }

            position.CloseAtProfit(
                barIndex,
                profitPrice,
                Signals.TAKE_PROFIT_CLOSE
            );
        }
Exemple #4
0
        public void createOn(IPosition position, int barIndex)
        {
            double profitPrice = 0.0;

            if (position.IsShort)
            {
                profitPrice = position.EntryPrice - maxProfit;
            }
            else
            {
                profitPrice = position.EntryPrice + maxProfit;
            }

            position.CloseAtProfit(
                barIndex,
                profitPrice,
                Signals.TAKE_PROFIT_CLOSE
                );
        }
Exemple #5
0
        public void createOn(IPosition position, int barIndex)
        {
            double profitPrice = based[barIndex - 1] * koeff;

            if (position.IsShort)
            {
                profitPrice = position.EntryPrice - profitPrice;
            }
            else
            {
                profitPrice = position.EntryPrice + profitPrice;
            }

            position.CloseAtProfit(
                barIndex,
                profitPrice,
                Signals.TAKE_PROFIT_CLOSE
                );
        }