Working with positions
Position opening
sec.Positions.BuyAtMarket(i + 1, 2, "LE"); // Buy two market contracts at the next bar.
sec.Positions.BuyAtPrice(i + 1, 2, 65000, "LE"); // Set a limit order for the purchase of two contracts on the next bar at a price of 65,000.
sec.Positions.BuyIfGreater(i + 1, 2, 65000, "LE"); // Place a conditional order to buy two contracts on the next bar if the price is above 65,000.
sec.Positions.BuyIfLess(i + 1, 2, 65000, "LE"); // Place a conditional order to buy two contracts on the next bar if the price is below 65,000.sec.Positions.SellAtMarket(i + 1, 2, "LE"); // Sell two market contracts at the next bar.
sec.Positions.SellAtPrice(i + 1, 2, 65000, "LE"); // Set a limit order for the sale of two contracts at the next bar at a price of 65,000.
sec.Positions.SellIfGreater(i + 1, 2, 65000, "LE"); // Place a conditional order to sell two contracts at the next bar if the price is 65,000.
sec.Positions.SellIfLess(i + 1, 2, 65000, "LE"); // Place a conditional order to sell two contracts on the next bar if the price is below 65,000Getting position
Position change
Closing position

Last updated
Was this helpful?