Stop Loss trigger for cancel current PendingOrder
Stop Loss trigger for cancel current PendingOrder
10 Sep 2021, 22:19
Hello good people!
Please, help!
There is a task to open buy-stop orders at the initial one price.
One pending order at a specific price has been filled in the OnTick () Method.
How to make the logic in which the 2nd buy-stop order is not placed until the first one hits the stop-loss, only after that
Replies
amusleh
13 Sep 2021, 11:06
There are Filled, Modified, and Canceled events for PendingOrders you can use, and there are similar events of positions like Closed, Modified, and Opened.
@amusleh
v.fiodorov83
14 Sep 2021, 17:38
RE:
amusleh said:
There are Filled, Modified, and Canceled events for PendingOrders you can use, and there are similar events of positions like Closed, Modified, and Opened.
Thanks. Apparently I'll have to write a counter. If the buy-stop is full, then the counter will be 1, and a new buy-stop will open if the counter is 0
@v.fiodorov83
m4trader4
03 Oct 2021, 11:05
RE: RE:
v.fiodorov83 said:
amusleh said:
There are Filled, Modified, and Canceled events for PendingOrders you can use, and there are similar events of positions like Closed, Modified, and Opened.
Thanks. Apparently I'll have to write a counter. If the buy-stop is full, then the counter will be 1, and a new buy-stop will open if the counter is 0
I have cut and pasted my code Use the function and place the orders accordingly.
private int CheckPositions(TradeType TTtype)
{
var positionsCBO = Positions.FindAll("", Symbol.Name, TTtype);
return (positionsCBO.Length);
}
=============================================================
if (CheckPositions(TradeType.Sell) == 0)
{
// Place order
}
if (CheckPositions(TradeType.Buy) == 0)
{
// Place Order
}
@m4trader4
emmasystems
16 Oct 2021, 00:02
RE:
amusleh said:
There are Filled, Modified, and Canceled events for PendingOrders you can use, and there are similar events of positions like Closed, Modified, and Opened.
Please , how are Pending orders placed in ctrader code like example , CreatePendingOrder, does that have to be used even modifying or setting Limit. Thanks
@emmasystems
amusleh
18 Oct 2021, 08:57
RE: RE:
emmasystems said:
amusleh said:
There are Filled, Modified, and Canceled events for PendingOrders you can use, and there are similar events of positions like Closed, Modified, and Opened.
Please , how are Pending orders placed in ctrader code like example , CreatePendingOrder, does that have to be used even modifying or setting Limit. Thanks
Hi,
You can find cBot examples for how to place/modify/cancel pending orders here: cAlgo API Reference - PendingOrder Interface (ctrader.com)
@amusleh
... Deleted by UFO ...