Script of sell/buy stop order not working New comment Marcus Dantas 2018.06.21 17:12 I'm writing a script to learn more about mql5, this is a simple buy/sell stop order script, but it isn't workin. I used PRINT function to test the if condition, the PRINT works, so trade.BuyStop is running, but nothing happens when I use the script. Am I using the trade.BuyStop and trade.SellStop wrong? #include<Trade\Trade.mqh>; #property version "1.00" #property script_show_inputs //--- input parameters input double Price=72200; input double StopLoss=100; input double TakeProfit=200; input double Lot=1; input int Type=1; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ CTrade trade; void OnStart() { //--- if (Type==1) { trade.BuyStop(Lot,Price*_Point,_Symbol,Price-StopLoss*_Point,Price+TakeProfit*_Point,ORDER_TIME_GTC,0,0); Print("print if the code gets here"); } else trade.SellStop(Lot,Price*_Point,_Symbol,Price+StopLoss*_Point,Price-TakeProfit*_Point,ORDER_TIME_GTC,0,0); } //+------------------------------------------------------------------+ I want to Open a Pending order when a trade is opened Open only 1 Sellstop and 1 Buystop maximum 2 Orders Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. Arvind Shah 2018.06.22 09:04 #1 Marcus Dantas You should enter symbol() before lot in buy and sell stop code New comment
I'm writing a script to learn more about mql5, this is a simple buy/sell stop order script, but it isn't workin.
I used PRINT function to test the if condition, the PRINT works, so trade.BuyStop is running, but nothing happens when I use the script.
Am I using the trade.BuyStop and trade.SellStop wrong?