cancel pending orders by label
cancel pending orders by label
19 May 2021, 14:45
hello everyone.
I am trying make bot.
and I have not idea how to cancel pending order by label. roughly my robot making pending orders in bouth direction i am looking for cancel sell pending orders when 1st buy is open and cancel buy pending orders when 1st sell is open.
I am just learning programing:
try this;
public void openedposition(PositionOpenedEventArgs args)
{
var pos = args.Position;
foreach (var order in PendingOrders)
{
if (pos.Label != order.Label)
// CancelPendingOrder(order);
if (pos.Label == label1)
{
Chart.RemoveObject("g1");
Chart.RemoveObject("g2");
Chart.RemoveObject("g3");
Chart.RemoveObject("g4");
Chart.RemoveObject("g5");
Chart.RemoveObject("g6");
Chart.RemoveObject("g7");
Chart.RemoveObject("g8");
}
else
{
Chart.RemoveObject("r1");
Chart.RemoveObject("r2");
Chart.RemoveObject("r3");
Chart.RemoveObject("r4");
Chart.RemoveObject("r5");
Chart.RemoveObject("r6");
Chart.RemoveObject("r7");
Chart.RemoveObject("r8");
}
CancelPendingOrderAsync(order);
}