Posted By: steyr
Placing BuyStop and SellStop Orders - 10/19/23 18:41
Hello dear community,
I am working with the MT5 bridge, and currently I am struggling to place Buy Limit and Sell Limit orders.
When I run my code, the Buy/Sell Limit order is placed almost directly at the current price, instead of at a 0.2% distance from the current price.
Furthermore, I am wondering how to program Buy/Sell Stop orders in Zorro. The manual doesn't seem to provide proper code examples. Can anyone of you help me out with this?
Best regards,
steyr
I am working with the MT5 bridge, and currently I am struggling to place Buy Limit and Sell Limit orders.
When I run my code, the Buy/Sell Limit order is placed almost directly at the current price, instead of at a 0.2% distance from the current price.
Furthermore, I am wondering how to program Buy/Sell Stop orders in Zorro. The manual doesn't seem to provide proper code examples. Can anyone of you help me out with this?
Best regards,
steyr
Code
if(priceC(0) <= priceO(0) and NumPendingShort <= 0) { OrderLimit = priceO(0)-(priceC(1)*(0.2/100)); // 0.2% Distance from current Price MaxShort = 1; enterShort(OrderLimit); } else if(priceC(0) >= priceO(0) and NumPendingLong <= 0) { OrderLimit = priceO(0)+(priceC(1)*(0.2/100));// 0.2% Distance from current Price MaxLong = 1; enterLong(OrderLimit); }