Exp_CGOscillator_X2 - MetaTrader 5 Expert - MT4/MT5 Resources




Exp_CGOscillator_X2 trend trading system is based on two signals CG oscillator indicator. The first indicator determines the direction of the slow trend based on the position of the main and signal lines. The second indicator determines the moment to start trading when the line is crossed or touched. A signal is formed when the bar closes if two conditions are met:
//+------------------------------------------------+ //|Input parameters of EA indicator| //+------------------------------------------------+ Enter String Trade = "Trade Management" ; //+================ Trade Management================+ Enter double MM= 0.1 ; //Share of deposit in a transaction Enter the margin mode MMMode=LOT; //Lot size detection method Input unit Stop loss_= 1000 ; //Stop loss points Input unit profit_= 2000 ; //Profit in points Input string must trade = "Trade Permit" ; //+================ Trade Permit==============+ Enter integer Deviation_= 10 ; //Maximum price deviation (in points) Enter Boolean BuyPosOpen= True ; //Allow entry into long position Enter a Boolean value SELL OPEN = TRUE ; //Allow short positions to be opened //+------------------------------------------------+ //|Input parameters for filtering indicators | //+------------------------------------------------+ input string filter = "slow trend parameter" ; //+============== trend parameter==============+ Input ENUM_TIMEFRAMES time range = PERIOD_H8 ; //1 trend chart period Input integer length = 10 ; // indicator period Input unit signal column = 1 ; //Get the bar index of the received signal Input boolean buy close = true ; //Allow exit of long positions on trend Enter a Boolean value Sell transaction close = true ; //Allow exit of short positions according to trend //+------------------------------------------------+ //|Input parameters of the entry indicator | //+------------------------------------------------+ input string input = "input parameter" ; //+================ input parameter==============+ Enter ENUM_TIMEFRAMES time range_= PERIOD_H1 ; //2 chart period for entry Input integer length_= 10 ; // indicator period Input unit signal column_= 1 ; //Bar index to receive entry signal Enter boolean BuyPosClose_= false ; //Allow closing of long positions via signal Enter boolean SellPosClose_= False ; //Allow closing of short positions via signal //+------------------------------------------------+
The string variable containing the text from the input code is only for better visualization of the EA input window.
The CGOscillator_HTF indicator in the EA is only used for more convenient visualization of trends in the strategy tester, they are inactive in other operating modes.
In order for the compiled Expert Advisor to run correctly, you should add the compiled CGOscillator.ex5 and CGOscillator_HTF.ex5 indicator files to
Please note that the TradeAlgorithms.mqh library file allows trading Expert Advisors with non-zero spreads and the option to set Stop Loss and Take Profit along with opening positions with brokers that offer the following services. You can download more variants of this library via the following link: Trading Algorithms .
The input parameters of the default Expert Advisor were used in the test shown below. Stop Loss and Take Profit were not used during testing.

Figure 1. Example of trade on chart
EURUSD test results in 2015, H8 is a slow trend and H1 is a fast trend entry:
Figure 2. Test result chart
Attachment download
📎 tradealgorithms.mqh (178.46 KB)
📎 cgoscillator.mq5 (13.53 KB)
📎exp_cgoscillator_x2.mq5 (18.67 KB)
Source: MQL5 #17666
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •