PositionCloseReason
Summary
The reason for closing the position.
Signature
| public enum PositionCloseReason
|
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
32 | using cAlgo.API;
namespace cAlgo.Robots
{
// This sample shows how to use PositionCloseReason
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class PositionCloseReasonSample : Robot
{
protected override void OnStart()
{
Positions.Closed += Positions_Closed;
}
private void Positions_Closed(PositionClosedEventArgs obj)
{
Print(obj.Reason);
switch (obj.Reason)
{
case PositionCloseReason.Closed:
// Do something if position closed
break;
case PositionCloseReason.StopLoss:
// Do something if position stop loss got hit
break;
case PositionCloseReason.StopOut:
// Do something if position stopped out
break;
case PositionCloseReason.TakeProfit:
// Do something if position take profit got hit
break;
}
}
}
}
|
See Also
Fields
Closed
Summary
Positions was closed by the trader.
Signature
| public static PositionCloseReason Closed;
|
Return Value
PositionCloseReason
StopLoss
Summary
Position was closed by the Stop Loss.
Signature
| public static PositionCloseReason StopLoss;
|
Return Value
PositionCloseReason
TakeProfit
Summary
Position was closed by the Take Profit.
Signature
| public static PositionCloseReason TakeProfit;
|
Return Value
PositionCloseReason
StopOut
Summary
Position was closed because the Stop Out level reached.
Signature
| public static PositionCloseReason StopOut;
|
Return Value
PositionCloseReason