Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Exp_WeightOscillator_Direct - MetaTrader 5 Expert

author EAcpu | 3 reads | 0 comments |

Exp_WeightOscillator_Direct - expert for MetaTrader 5

Exp_WeightOscillator_Direct - expert for MetaTrader 5

The trading system is based on the directional changes of the weighted oscillator WeightOscillator . Sell ​​when the oscillator changes direction from up to down and buy when the direction changes to up. The signal is formed at the close of the bar.

The WeightOscillator_HTF indicator in the EA is only used for easier visualization of trends in the strategy tester, in other operating modes it is inactive.

Place the WeightOscillator.ex5 and WeightOscillator_HTF.ex5 compiled files into <terminal data folder>\MQL5\indicators .

After compilation, the Exp_WeightOscillator.ex5 expert file contains the WeightOscillator.ex5 and WeightOscillator_HTF.ex5 indicators as shown in the resources below, therefore, they do not need to be present in the terminal folder for the compiled EA to work! For this purpose, corresponding code has been added to the EA code in order to include these indicators in the EA's executable file.

The indicator executable has been added as a global scope resource:

 //----Include the indicator as a resource in the EA code
#Resource "\\Indicators\\WeightOscillator.ex5"
#Resource "\\Indicators\\WeightOscillator_HTF.ex5"

The string path used as the indicator for the resource in the OnInit() function block has changed:

 //---- Get the WeightOscillator indicator handle InpInd_Handle= Customized ( symbol (),InpInd_Timeframe, "::Indicator\\Weight Oscillator" ,RSIWeight,RSIPeriod,RSIPrice,MFIWeight,MFIPeriod,MFIVolumeType,
                        WPRWeight,WPRPeriod,DeMarkerWeight,DeMarkerPeriod,bMA_Method,bLength,bPhase,HighLevel,LowLevel);
if (InpInd_Handle== INVALID_HANDLE )
    {
print ( "Unable to obtain handle to WeightOscillator indicator" );
Return ( initialization failed );
    } //---- Get the handle of the WeightOscillator_HTF indicator for visualization in the strategy tester if ( MQLInfo integer ( MQL_VISUAL_MODE ))
    {
//---- Get the handle integer of the WeightOscillator_HTF indicator Ind_Handle= Customized ( symbol (), period (), "::Indicator\\WeightOscillator_HTF" , InpInd_Timeframe,
                            RSIWeight,RSIPeriod,RSIPrice,MFIWeight,MFIPeriod,MFIVolumeType,
                            WPRWeight,WPRPeriod,DeMarkerWeight,DeMarkerPeriod,bMA_Method,bLength,bPhase,HighLevel,LowLevel);
if (Ind_Handle== INVALID_HANDLE )
        {
print ( "Unable to obtain handle to WeightOscillator_HTF indicator" );
Return ( initialization failed );
        }
    }

Therefore, the executable compiled by experts can be used independently on other trading terminals without indicators.

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.

Exp_WeightOscillator_Direct - expert for MetaTrader 5

Figure 1. Example of trade on chart

EURAUD H6 test results 2015:

Exp_WeightOscillator_Direct - expert for MetaTrader 5

Figure 2. Test result chart


Attachment download

📎 tradealgorithms.mqh (178.23 KB)

📎 weightoscillator.mq5 (23.62 KB)

📎 weightoscillator_htf.mq5 (22.29 KB)

📎 exp_weightoscillator_direct.mq5 (21.38 KB)

Source: MQL5 #17529

Verification code Refresh