ClosePosition Method (3)
ClosePosition (1 of 3)
Summary
Close a position
Signature
| public TradeResult ClosePosition(Position position)
|
Parameters
Name | Type | Description |
position | Position | Position to close |
Return Value
TradeResult
Declaring Type
cAlgo.API.Robot
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 | namespace cAlgo.Robots
{
[Robot]
public class myCBot : Robot
{
protected override void OnStart()
{
//This method is called when the cBot is being started, once.
}
protected override void OnBar()
{
// Called on each incoming Bar.
}
protected override void OnTick()
{
// Called on each incoming tick.
}
protected override void OnError(Error error)
{
Print("There has been an Error");
}
protected override void OnStop()
{
//This method is called when the cBot is being stoped.
}
}
|
ClosePosition (2 of 3)
Summary
Close a position
Signature
| public TradeResult ClosePosition(Position position, long volume)
|
Parameters
Name | Type | Description |
position | Position | Position to close |
volume | long | Volume which is closed |
Return Value
TradeResult
Declaring Type
cAlgo.API.Robot
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 | namespace cAlgo.Robots
{
[Robot]
public class myCBot : Robot
{
protected override void OnStart()
{
//This method is called when the cBot is being started, once.
}
protected override void OnBar()
{
// Called on each incoming Bar.
}
protected override void OnTick()
{
// Called on each incoming tick.
}
protected override void OnError(Error error)
{
Print("There has been an Error");
}
protected override void OnStop()
{
//This method is called when the cBot is being stoped.
}
}
|
ClosePosition (3 of 3)
Summary
Close a position
Signature
| public TradeResult ClosePosition(Position position, double volume)
|
Parameters
Name | Type | Description |
position | Position | Position to close |
volume | double | Volume which is closed |
Return Value
TradeResult
Declaring Type
cAlgo.API.Robot
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 | namespace cAlgo.Robots
{
[Robot]
public class myCBot : Robot
{
protected override void OnStart()
{
//This method is called when the cBot is being started, once.
}
protected override void OnBar()
{
// Called on each incoming Bar.
}
protected override void OnTick()
{
// Called on each incoming tick.
}
protected override void OnError(Error error)
{
Print("There has been an Error");
}
protected override void OnStop()
{
//This method is called when the cBot is being stoped.
}
}
|
Last update: March 23, 2023