MQL5: Execution orders New comment [Deleted] 2018.04.01 18:06 Dear Metatraders, I am receiving an error when trying to execute an order, it is giving me an unknown retcode 0 in the backtestingAny idea why ?Many thanks, //+------------------------------------------------------------------+ //| PlacingOrders.mq5 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_plots 0 #include <Trade\Trade.mqh> CTrade trade; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { if (TimeCurrent()==D'2018.01.02 10:36:00') { Print("Long NZDCHF"); double ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits); // Print(trade.Buy(0.1, NULL, ask, 0, 0, "OK")); if(!trade.Buy(1, NULL, ask, 0, 0, "")) { Print("Buy() method failed. Return code=",trade.ResultRetcode()," Code description: ",trade.ResultRetcodeDescription()); } else { Print("Buy() method executed successfully. Return code=",trade.ResultRetcode()," (",trade.ResultRetcodeDescription(),")"); } } return(rates_total); } //+------------------------------------------------------------------+ How to retrieve the high and low of the last 100 bars of all Major currency pairs via an indicator OrdersTotal() in MQL5 is always giving me 0 Error -1 Eleni Anna Branou 2018.04.01 19:01 #1 Please use the </> button to insert your code. William Roeder 2018.04.01 19:16 #2 You should have edited your original post, not reposted. Messages EditorIndicators can not trade. New comment
Dear Metatraders,
I am receiving an error when trying to execute an order, it is giving me an unknown retcode 0 in the backtesting
Any idea why ?
Many thanks,