Author: Copyright � 2009, ������� �������
!Writer

This script is designed to synchronize trading data across multiple open charts or different trading platforms where the same currency pair and timeframe are being viewed. It acts as a coordination tool, ensuring that your terminal "knows" which specific market setup you are currently focusing on.

How it Works

The logic operates by managing a list of unique identifiers (Global Variables) that the software uses to track different trading environments. Here is the step-by-step process of how it handles this:

  • Initialization: When you run the script, it first checks if a master synchronization system is active. If it doesn't find one, it creates a base marker to begin the process.
  • Identifying Markets: The script looks through all the active trading pairs and timeframes currently registered in your system's memory.
  • The "Active" Selection: It identifies the specific combination of the current currency (e.g., EURUSD) and the timeframe (e.g., H1) that you are looking at right now.
  • Synchronization Logic: It then updates all other potential market markers in the background:
    • The marker for your current active chart is set to "Active" (Value of 1).
    • All other markers for different pairs or timeframes are set to "Inactive" (Value of -1).

The Practical Benefit

By constantly updating these values, the script ensures that other automated tools or indicators on your platform can distinguish between your active chart and your secondary charts. It effectively tells the rest of your trading software: "This specific currency pair and timeframe is the priority; ignore the others." This prevents multiple automated systems from trying to trigger actions on different charts simultaneously.

16 Views
0 Downloads
0 Favorites
!Writer
//+------------------------------------------------------------------+
//|                                                 SetMainDupel.mq4 |
//|                                Copyright © 2009, Ñåðãååâ Àëåêñåé |
//|                                      mailto: profy.mql@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Ñåðãååâ Àëåêñåé"
#property link      "mailto: profy.mql@gmail.com"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
{
	if (!GlobalVariableCheck("DupelSync")) GlobalVariableSet("DupelSync", 0); // ñîçäà¸ì, åñëè íåò
	int n=GlobalVariablesTotal();
	for (int i=0; i<n; i++)
	{
		string name=GlobalVariableName(i);
		string st=StringSubstr(name, 0, 10);
		if (st=="DupelSync_")
		{
			if (name=="DupelSync_"+Symbol()+Period()) GlobalVariableSet(name, 1);
			else GlobalVariableSet(name, -1);
		}
	}
	return(0);
}
//+------------------------------------------------------------------+

Comments