Could you kindly advise me if I have made any mistake on the below coding as it could cancel my order when OrderStatus is accepted but it could not cancel my order when OrderStatus is Working.
if (this.Buyer != null)
{
Draw.Text(this, "NBUY" + CurrentBar, false, "b", 0, High[0], 5, Brushes.YellowGreen, textFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
if (this._CancelBuyPrice <= this.High[0] && (this.Buyer.OrderState == OrderState.Initialized ||
this.Buyer.OrderState == OrderState.Accepted ||
this.Buyer.OrderState == OrderState.Working
))
{
Print("Cancelling Buy...");
this.CancelOrder(this.Buyer);
}
By the way, this._CancelBuyPrice is my profit price.
Thanks.
Comment