Modifying a buy/sell stop
6件の返信
こんにちは,
Lets say I have a buy stop at the highest high of the past 10 periods. If the order is not triggered after the latest period, how do i modify the buy stop to account for the change in the 10 period lookback window?
0
こんにちは,
to modify a stop order you would cancel it using the “close position” function and then re-open a new order
0
こんにちは,
to modify a stop order you would cancel it using the “close position” function and then re-open a new order
トーマスさん、こんにちは,
Every time the buy stop of highest(10) is not triggered I want to adjust the entry price so that the highest high is updated. I tried this:
IF:
pending order exists(1000) is True
THEN:
close position, magic number 1000
Enter at stop, highest(10), magic number 1000
There is an error because there are 2 orders with magic number 1000. The rule that created the original buy stop also uses magic number 1000. Do I need a different magic number every time I modify a buy stop, even though the orders are actually the same?
0
こんにちは,
ok, we need to use a function to modify and order price. I will make an example for this and attach
0
You can add this function into EA Wizard CustomFunctions.mq4 placed in Wizard \ Code
void modifyPendingOrder(int orderMagicNumber, double newPO) {
bool found = false;
for (int cc = OrdersTotal() - 1; cc >= 0; cc--) {
if (!OrderSelect(cc, SELECT_BY_POS) ) continue;
if(OrderMagicNumber() == orderMagicNumber && OrderSymbol() == Symbol()) {
found = true;
Verbose("Moving PO for order with Magic Number: ", orderMagicNumber,", ticket: ", OrderTicket(), ", new PO: ", newPO);
tmpRet = OrderModify(OrderTicket(), newPO, 0, 0, 0);
}
}
if(!found) {
Verbose("Moving PO - order with Magic Number: ", orderMagicNumber, " wasn't found");
}
}
Then the order price can be modified as shown in the example attached
0
You can add this function into EA Wizard CustomFunctions.mq4 placed in Wizard \ Code
void modifyPendingOrder(int orderMagicNumber, double newPO) { bool found = false; for (int cc = OrdersTotal() - 1; cc >= 0; cc--) { if (!OrderSelect(cc, SELECT_BY_POS) ) continue; if(OrderMagicNumber() == orderMagicNumber && OrderSymbol() == Symbol()) { found = true; Verbose("Moving PO for order with Magic Number: ", orderMagicNumber,", ticket: ", OrderTicket(), ", new PO: ", newPO); tmpRet = OrderModify(OrderTicket(), newPO, 0, 0, 0); } } if(!found) { Verbose("Moving PO - order with Magic Number: ", orderMagicNumber, " wasn't found"); } }Then the order price can be modified as shown in the example attached
Hi Tomas, Thank you for your wonderful help.
I wish to add in an IF condition that needs to be satisfied before the pending order can be shifted according to the above code. If this condition is not satisfied, the pending order is deleted. Is there a way to add in this order deletion without creating another IF/THEN rule?
0
こんにちは,
yes, you can add additional conditions into the modify tab and create another tab for deleting the pending order (using “Close position” function to delete it)
0
6件の返信を表示中 - 1 - 6件目 (全6件中)