Skip to content

StopTriggerMethod

Summary

The trigger side for the Stop Orders.

Signature

1
public enum StopTriggerMethod

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 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);
             }
         }
     }
 }

Fields

Trade

Summary

Trade 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.

Signature

1
public static StopTriggerMethod Trade;

Return Value

StopTriggerMethod

Opposite

Summary

Opposite 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.

Signature

1
public static StopTriggerMethod Opposite;

Return Value

StopTriggerMethod

DoubleTrade

Summary

Uses default prices for order triggering, but waits foradditionalconfirmation - 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.

Signature

1
public static StopTriggerMethod DoubleTrade;

Return Value

StopTriggerMethod

DoubleOpposite

Summary

Uses opposite prices for order triggering, and waits foradditional 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.

Signature

1
public static StopTriggerMethod DoubleOpposite;

Return Value

StopTriggerMethod