StopTriggerMethod


Summary

The trigger side for the Stop Orders.

Syntax

public sealed enum StopTriggerMethod

Members

NameTypeSummary
DoubleOpposite FieldUses opposite prices for order triggering, and waits for
additional confirmation - two consecutive prices should meet criteria to trigger order.
Buy order and Stop Loss for Sell position will be triggered when two consecutive Bid prices >= order price.
Sell order and Stop Loss for Buy position will be triggered when two consecutive Ask prices <= order price.
DoubleTrade FieldUses default prices for order triggering, but waits for
additional confirmation - two consecutive prices should meet criteria to trigger order.
Buy order and Stop Loss for Sell position will be triggered when two consecutive Ask prices >= order price.
Sell order and Stop Loss for Buy position will be triggered when two consecutive Bid prices <= order price.
Opposite FieldOpposite method uses opposite price for order triggering.
Buy order and Stop Loss for Sell position will be triggered when Bid >= order price.
Sell order and Stop Loss for Buy position will be triggered when Ask <= order price.
Trade FieldTrade method uses default trigger behavior for Stop orders.
Buy order and Stop Loss for Sell position will be triggered when Ask >= order price.
Sell order and Stop Loss for Buy position will be triggered when Bid <= order price.

Example 1

using cAlgo.API;
namespace cAlgo.Robots
{
    // This sample shows how to use StopTriggerMethod of orders to control their execution price
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class StopTriggerMethodSample : Robot
    {
        [Parameter("Stop Trigger Method", DefaultValue = StopTriggerMethod.Trade)]
        public StopTriggerMethod StopTriggerMethod { get; set; }
        protected override void OnStart()
        {
            // Setting a new position StopTriggerMethod
            ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin, "StopTriggerMethod Test", 10, 10, string.Empty, false, StopTriggerMethod);
            // Setting a new stop order StopTriggerMethod for both order and its stop loss
            var target = Symbol.Bid + (100 * Symbol.PipSize);
            PlaceStopOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin, target, "StopTriggerMethod Test", 10, 10, null, string.Empty, false, StopTriggerMethod, StopTriggerMethod);
            // Changing open positions StopTriggerMethod
            foreach (var position in Positions)
            {
                if (!position.StopLoss.HasValue) continue;
                ModifyPosition(position, position.StopLoss, position.TakeProfit, position.HasTrailingStop, StopTriggerMethod);
            }
            // Changing open pending orders (Stop and StopLimit) StopTriggerMethod
            foreach (var order in PendingOrders)
            {
                if (!order.StopLossPips.HasValue || order.OrderType == PendingOrderType.Limit) continue;
                ModifyPendingOrder(order, order.TargetPrice, order.StopLossPips, order.TakeProfitPips, order.ExpirationTime, order.VolumeInUnits, order.HasTrailingStop, StopTriggerMethod, StopTriggerMethod);
            }
        }
    }
}
Reference