The following code cannot be used in test mode, please ask, thank you

 
Hello bosses
This code is an input box, which can be modified and taken in the backtest in mt4. In the test mode of mt5, the input box is always blank after clicking, and the input value cannot be obtained.

Please help, thank you.



//+------------------------------------------------------------------+
//|                                                         test.mq5 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
string kcsjdss="0.01";

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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()
  {
//---
   EditCreate(0,"kcsjd1_2",0,100,100,50,20,kcsjdss,"Arial",10,ALIGN_CENTER,false,CORNER_LEFT_UPPER,clrBlack,clrWhite,clrNONE,false,false,true,1);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool EditCreate(const long             chart_ID=0,               
                const string           name="Edit",              
                const int              sub_window=0,             
                const int              x=0,                      
                const int              y=0,                      
                const int              width=50,                 
                const int              height=18,                
                const string           text="Text",              
                const string           font="Arial",             
                const int              font_size=10,             
                const ENUM_ALIGN_MODE  align=ALIGN_CENTER,       
                const bool             read_only=false,          
                const ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER, 
                const color            clr=clrBlack,             
                const color            back_clr=clrWhite,        
                const color            border_clr=clrNONE,       
                const bool             back=false,               
                const bool             selection=false,          
                const bool             hidden=true,              
                const long             z_order=0)                
  {
//--- 重置错误的值
   ResetLastError();
//--- 创建编辑字段

   if(ObjectFind(chart_ID,name)<0)
     {
      if(!ObjectCreate(chart_ID,name,OBJ_EDIT,sub_window,0,0))
        {
         Print(__FUNCTION__,
               ": failed to create \"Edit\" object! Error code = ",GetLastError());
         return(false);
        }
      ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);
      ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);
      ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
      ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
      ObjectSetInteger(chart_ID,name,OBJPROP_ALIGN,align);
      ObjectSetInteger(chart_ID,name,OBJPROP_READONLY,read_only);
      ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
      ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_COLOR,border_clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
      ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
      ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
      ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
      ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
     }
   else
     {
      ObjectGetString(chart_ID,name,OBJPROP_TEXT,0,kcsjdss);
      Comment(kcsjdss);
     }

   return(true);
  }
//+------------------------------------------------------------------+
通过MQL5社区和服务探索MetaTrader 5的新机遇
通过MQL5社区和服务探索MetaTrader 5的新机遇
  • 2021.02.22
  • www.mql5.com
MQL5:MetaTrader 5客户端内置的交易策略语言。语言允许编写您自己的自动交易系统,技术指标,脚本和函数程序库
 

The above picture is a normal chart, which is only available for test mode.

In the test, click will always be blank.

I beg my brothers for help, thank you so much!

 
Zhe Tang:

The above picture is a normal chart, which is only available for test mode.

In the test, click will always be blank.

I beg my brothers for help, thank you so much!

If you click it, it will be blank apart from the cursor. You need to enter something.

 
Keith Watford:

If you click it, it will be blank apart from the cursor. You need to enter something.

I input the content and press Enter, but it is still blank and the value is not available.

Thanks Reply

 
Keith Watford:

If you click it, it will be blank apart from the cursor. You need to enter something.

How about you try it, this is a very strange question, I am too stupid, this question tortured me for several days. thank you very much.

 
Zhe Tang:

How about you try it, this is a very strange question, I am too stupid, this question tortured me for several days. thank you very much.

Input objects like Edit Combo etc don't work in the strategy tester, never have as far as I know.

 
Paul Anscombe:

Input objects like Edit Combo etc don't work in the strategy tester, never have as far as I know.

Thanks for the reply, I hope there is a solution, it can be used in mt4, mt5 shouldn't be bad.
 
I also encountered this problem on mt5. Please tell me how to fix it.
Reason: