Tick-by-tick simulation for accelerated testing of indicator ver.2.2 - MetaTrader 4 Script - MT4/MT5 Resources








The script is designed to set two offset parameters through global variables as well as the number of calculated data for indicators, EAs or other scripts. It is also possible to automatically iterate the data range from the initially set bar to the zero bar, with a delay. Examples of linear regression indicators used in conjunction with additional scripts are provided.
An example with indicators is also provided in the script code. Indicators can perform calculations independently or in combination with scripts (there is a running script). If used in conjunction with a script, the parameters required for indicator calculation (offset and number of calculated data) are stored in global variables (CE_Time and CE_Count respectively).
The script is able to manage the indicator in manual mode (set translation - position linear regression object using mouse) or automatic mode (set translation - position linear regression object by setting new coordinates of translation -1). Use the _Emulated global variable to set manual and automatic management modes: _Emulated=0 - manual mode, _Emulated=1 automatic mode. Setting the global variable value can be performed using the "F3" global variable or by removing the "Automatic Simulation" or "Manual Simulation" text labels - this will change the value to its opposite.
Once the object reaches the zero bar in automatic mode, the script switches to manual control mode. The _PauseCount global variable sets the delay parameters for the next run of the indicator. The _Calculated global variable defines the readiness of the indicator to perform the next calculation. After the calculation is completed, the indicator will set the flag _CW_xxxxx=true. _CW_xxxxx global variables are formed during indicator initialization and are unique for each indicator added to any chart with its own time frame. When the CE_Time global variable changes, the indicator automatically determines whether the data needs to be recalculated.
If the edges of the linear regression object extend beyond the chart screen, the chart automatically moves to show the new selected range. At the end of the script operation, all linear regression objects are deleted and the uninstallation is confirmed. My thanks go to Oleg Poddubny and his script Mover.mq4 for the original idea.
The images below provide examples of usage over different time periods.
Add an indicator on the Н4 period, managed by a script on the Н1 period
Display corresponding points of shift positions in different periods
And how to switch indicator operation from manual to automatic quote simulation mode
Attachment download
📎geLR_MA_Ctrl_v2_2.mq4 (8.83 KB)
📎 geSCtrl_Tick_v2_2.mq4 (14.89 KB)
📎ge_TicketCtrl.mq4 (2.13 KB)
📎ge_VKKeyCode.mq4 (3.99 KB)
Source: MQL5 #8717
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •