Skip to content

PositionOpenedEventArgs

Summary

Provides data for the position opening event.

Signature

1
public class PositionOpenedEventArgs

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 public class SampleRobot : Robot
 {
     protected override void OnStart()
     {
         Positions.Opened += Positions_Opened;
         ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, "myLabel");
     }
     private void Positions_Opened(PositionOpenedEventArgs args)
     {
         var position = args.Position;
         if(position.Label == "myLabel")
             Print("Position opened by SampleRobot");
     }
     //...
 }

See Also

Properties

Position

Summary

Gets or sets the position being opened.

Signature

1
public Position Position {get;}

Return Value

Position

Examples

1
2
3
4
5
 private void PositionsOnOpened(PositionOpenedEventArgs args)
 {
     var position = args.Position;
     Print("Position opened at {0}", position.EntryPrice);
 }