MQL5 Is it possible to Pause Backtesting when an order is opened by Using Coding?

 
I'm trying to pause the Back Testing from the EA. Can anyone help? MQL5 with Strategy Tester and Visualization Mode.
Is there any way to send keystrokes such as space key from the EA?
(Don't want to use the Debug MODE)
 
Christos Papageorgiou:
I'm trying to pause the Back Testing from the EA. Can anyone help? MQL5 
DebugBreak()
 
Alain Verleyen:
DebugBreak()

No that doesn't Pause the Back Testing. 

if(trade.Buy(LotSize,NULL,Ask,(Bid-StopLoss)-(50*Point()),0,"Neural Network Indicator Signal"))
         {
            DebugBreak();
            
            //Create Label
            ObjectCreate(ChartID(),(string)PositionLabel,OBJ_TEXT,0,TimeCurrent(),Bid-indATR14PriceArray[0]*4);
            ObjectSetString(ChartID(),(string)PositionLabel,OBJPROP_TEXT,"NN");
            ObjectSetInteger(ChartID(),(string)PositionLabel,OBJPROP_COLOR,clrLime);
            ObjectSetDouble(ChartID(),(string)PositionLabel,OBJPROP_ANGLE,90);
            ObjectSetInteger(ChartID(),(string)PositionLabel,OBJPROP_BACK,false);
            ObjectSetInteger(ChartID(),(string)PositionLabel,OBJPROP_SELECTABLE,false);
            PositionLabel = PositionLabel+1;
            
            //Take ScreenShot
            string name=Symbol()+" "+(string)TimeCurrent()+".jpg";
            int replaced=StringReplace(name,":"," ");
            if(PrintScreen==true)ChartScreenShot(ChartID(),name,1700,1080,ALIGN_RIGHT);
            
            //Remember Current Time Stamp for Next Time
            TimeStampLastCheck = TimeStampCurrentCandle;
         }
         else
         {
            Print("Error Opening the Position: ",GetLastError()," - ",ErrorDescription(GetLastError()));
         }
 
Christos Papageorgiou:

No that doesn't Pause the Back Testing. 

Yes it is. If you run your code in debug mode. Please read the documentation.
 
Alain Verleyen:
Yes it is. If you run your code in debug mode. Please read the documentation.

Thanks again.
I'm trying to find a way to pause the Strategy Tester on Visualization Mode when an Order is executed. 
Is there anyway just to send a keystroke "space";

 
#import "user32.dll"
    void keybd_event(int bVk, int bScan, int dwFlags,int dwExtraInfo);
#import
#define VK_SPACE 0x20 //Space
#define VK_RETURN 0x0D //Return - Enter Key
#define KEYEVENTF_KEYUP 0x0002  //Key up

//Pause During Test
            if(MQLInfoInteger(MQL_TESTER) && MQLInfoInteger(MQL_VISUAL_MODE))
            {
               keybd_event(VK_SPACE, 0, 0, 0);
               keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP , 0);
            }
In Case Someone else is looking for a solution!!!

Key Codes
https://docs.microsoft.com/el-gr/windows/desktop/inputdev/virtual-key-codes
Virtual-Key Codes
Virtual-Key Codes
  • 2018.05.31
  • Michael Satran
  • docs.microsoft.com
The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.
 

@Christos Papageorgiou what Alain Verleyen said is working.

Just add DebugBreak(); after you open the position, select Visualize and Start debugging. See attached screenshots (I don't know how to embed them).