download older version and block updates.
i would like to solve it or want moderators to report this if its a bug or looking forward for any demo code which imports some demo bars using CustomTicksAdd function to a demo custom symbol on mt5 build 4016
for e.g.
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetTimer(1); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- ResetLastError(); MqlTick tick[1]; tick[0].bid = 1.2; tick[0].ask = 1.21; tick[0].flags= TICK_FLAG_BID|TICK_FLAG_ASK; tick[0].volume =10; tick[0].volume_real =12; tick[0].time = TimeGMT(); tick[0].time_msc=0; if(!CustomTicksAdd("a_STRAXUSDT",tick)) { Print ("Error ",GetLastError()); } } //+------------------------------------------------------------------+
i would like to solve it or want moderators to report this if its a bug or looking forward for any demo code which imports some demo bars using CustomTicksAdd function to a demo custom symbol on mt5 build 4016
for e.g.
What is the "path" of the symbol when it was created ?
(on 4000 it works , are you using a beta version perhaps?)
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetTimer(1); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- ResetLastError(); MqlTick tick[1]; tick[0].bid = 1.2; tick[0].ask = 1.21; tick[0].flags= TICK_FLAG_BID|TICK_FLAG_ASK; tick[0].volume =10; tick[0].volume_real =12; tick[0].time = TimeGMT(); tick[0].time_msc=0; string symbol_name="a_STRAXUSDT"; if(CustomTicksAdd(symbol_name,tick)==-1) { int error=GetLastError(); Print ("Error ",GetLastError()); if(error==5300){ if(CustomSymbolCreate(symbol_name,"",NULL)){ Print("Created "+symbol_name); }else{ Print("Cannot create "+symbol_name+" #"+IntegerToString(GetLastError())); } }else if(error==4302){ if(SymbolSelect(symbol_name,true)){ Print("Selecting "+symbol_name); }else{ Print("Cannot select "+symbol_name+" #"+IntegerToString(GetLastError())); } } }else{ Print("Added tick"); ExpertRemove(); } } //+------------------------------------------------------------------+
path is Custom/
i checked it says Added tick but in reality does not add any bar on symbol on build 4016.
i think you must add the first bar if it has no origin.
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetTimer(1); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- ResetLastError(); MqlTick tick[1]; tick[0].bid = 1.2; tick[0].ask = 1.21; tick[0].flags= TICK_FLAG_BID|TICK_FLAG_ASK; tick[0].volume =10; tick[0].volume_real =12; tick[0].time = TimeGMT(); tick[0].time_msc=0; string symbol_name="a_STRAXUSDT"; if(CustomTicksAdd(symbol_name,tick)==-1) { int error=GetLastError(); Print ("Error ",GetLastError()); if(error==5300){ if(CustomSymbolCreate(symbol_name,"",NULL)){ Print("Created "+symbol_name); }else{ Print("Cannot create "+symbol_name+" #"+IntegerToString(GetLastError())); } }else if(error==4302){ if(SymbolSelect(symbol_name,true)){ Print("Selecting "+symbol_name); }else{ Print("Cannot select "+symbol_name+" #"+IntegerToString(GetLastError())); } } }else{ Print("Added tick"); MqlRates rates[]; ArrayResize(rates,1,0); rates[0].time=flatten_time(tick[0].time,60); rates[0].open=tick[0].bid; rates[0].spread=(int)((tick[0].ask-tick[0].bid)/0.01); rates[0].close=tick[0].bid; rates[0].tick_volume=1; rates[0].high=tick[0].bid; rates[0].low=tick[0].bid; rates[0].real_volume=0; if(CustomRatesUpdate(symbol_name,rates,1)>0){ Print("DONE"); }else{ Print("Cannot start M1 rates "+IntegerToString(GetLastError())); } ExpertRemove(); } } //+------------------------------------------------------------------+ datetime flatten_time(datetime time,int seconds){ datetime flat=(datetime)(((long)(seconds))*((long)(MathFloor(((double)time)/((double)seconds))))); return(flat); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Im getting Error 5040 since recent update on MT5
All program were working fine om previous build and my mt5 version is 4016
It includes CustomTicksAdd function