Algo.Positions
property · Algo · cAlgo.API.Internals
DesktopCLICloud
The list of all open positions of the account.
Definition
public Positions Positions {get;}
api.Positions: Positions
Returns Positions
Examples
foreach (var position in Positions)
{
if (position.StopLoss == null)
position.ModifyStopLossPips(20);
}
var sellPosition = Positions.Find("myLabel", SymbolName, TradeType.Sell);
if (sellPosition != null)
Print("Net profit: {0}", sellPosition.NetProfit);
for position in api.Positions:
if position.StopLoss is None:
position.ModifyStopLossPips(20)
sellPosition = api.Positions.Find("myLabel", api.SymbolName, TradeType.Sell)
if sellPosition is not None:
api.Print(f"Net profit: {sellPosition.NetProfit}")