What's new

Double Extremum EA....Test test test...

Ricky24

New Member
Double Extremum

This is a mid-term Expert Advisor based on defining two extreme points formed by indicators and comparing them to the price extreme values.

Parameters
  • Start_lot – the initial lot size. If the dynamic lot is disabled (risk=0), the lot size of orders is constant.
  • risk – enable the dynamic lot with the specified risk level.
  • MaxOrders_InOneSet - the maximum number of orders in one set. 0 - no control. Allows you to flexibly limit the total number of orders, while allowing all sets to open orders (at least one at a time).
  • MaxOrders_InSymbol - the maximum number of orders for the current symbol (the sum of all sets). 0 - no control.
  • PartialCloseIfProfit_ATRs - partial closure. Close profitable orders if more than 3 orders within one set are open in the same direction and the price exceeded > PartialCloseIfProfit_ATRs.
These settings are sufficient for trading.

Expert Advisor Optimization
To improve trading, you can develop custom settings using optimization for a certain pair and write them to a plain text file:
"MetaTrader...\tester\files\DoubleExt.txt" - for testing, then copy to "MetaTrader...\MQL4\Files\DoubleExt.txt" - for trading.
The EA searches for the specified settings file and takes the basic ones from the code if none are found.
The following parameters allow configuring the EA.
  • OptimizationMode – enable/disable optimization mode. If OptimizationMode is enabled, the ForPeriod, Indicator, Ind_per, i3, i4, SL_ATRs, TPSL_koef, BreakEven_ATRs, TrailDist_ATRs, CoefExpr parameters are optimized. The best test results are placed in the specified text file (by means of a copy-paste), and from there, when the OptimizationMode is off, the EA takes the parameters when trading.
  • ForPeriod – chart period (timeframe), for which the optimization is performed.
  • Set_number – default is 0 (all sets). It is used to analyze a specific set, one of those written to the file.
  • Indicator – analyzed indicator for defining extreme values: AO, RSI, CCI, Stochastic, MACD, RVI, WPR and Momentum.
  • Ind_per – analyzed indicator period (not relevant for AO).
  • i3 – method of defining a double decreasing top. It varies from 0 to 3 (see the image below).
  • i4 – method of defining a double increasing top. It varies from 0 to 3 (see the image below).
  • SL_ATRs – initial stop loss level in the number of averaged candles. Here and further below, the size of an average candle for the tested timeframe is defined by ATR(200) indicator.
  • TPSL_coef – take profit/stop loss ratio. Recommended values are from 1 to 10.
  • BreakEven_ATRs – breakeven level in ATRs. Recommended values are from 1 to 10.
  • TrailDist_ATRs – trailing distance in ATRs. Recommended values are from 1 to 10.
If BreakEven exceeds TrailDist, trailing does not start till the price breaks the BreakEven level. In other words, BreakEven restrains trailing.
If BreakEven is less than TrailDist, an order is moved to breakeven when the price reaches the BreakEven level. This level remains unchanged till the price breaks the TrailDist level. After that, the trailing starts.
  • Coef_expr - expressiveness of the double extremum - the ratio of the lowest High to Low, to start the pattern validation. The smaller the coefficient, the more expressed the pattern and the less likely it is to be found. Recommended optimization range: from 0.55 to 0.95. Default is 0.95.
  • ShowProfitInfo – show/hide data on the EA's current trading results.
After optimization and analysis, select the most suitable test results and copy paste them to the text file. Enter a currency pair name, at which a certain result has been achieved, at the start of each line in the file (for example, "eurusd") and press TAB (mandatory). These will be the sets, each of them working according to its own parameters. After optimization, save the file.
Set OptimizationMode=false, and the EA is ready to trade according to your settings. The video is attached below.
Double Extremum

This is a mid-term Expert Advisor based on defining two extreme points formed by indicators and comparing them to the price extreme values.

Parameters
  • Start_lot – the initial lot size. If the dynamic lot is disabled (risk=0), the lot size of orders is constant.
  • risk – enable the dynamic lot with the specified risk level.
  • MaxOrders_InOneSet - the maximum number of orders in one set. 0 - no control. Allows you to flexibly limit the total number of orders, while allowing all sets to open orders (at least one at a time).
  • MaxOrders_InSymbol - the maximum number of orders for the current symbol (the sum of all sets). 0 - no control.
  • PartialCloseIfProfit_ATRs - partial closure. Close profitable orders if more than 3 orders within one set are open in the same direction and the price exceeded > PartialCloseIfProfit_ATRs.
These settings are sufficient for trading.

Expert Advisor Optimization
To improve trading, you can develop custom settings using optimization for a certain pair and write them to a plain text file:
"MetaTrader...\tester\files\DoubleExt.txt" - for testing, then copy to "MetaTrader...\MQL4\Files\DoubleExt.txt" - for trading.
The EA searches for the specified settings file and takes the basic ones from the code if none are found.
The following parameters allow configuring the EA.
  • OptimizationMode – enable/disable optimization mode. If OptimizationMode is enabled, the ForPeriod, Indicator, Ind_per, i3, i4, SL_ATRs, TPSL_koef, BreakEven_ATRs, TrailDist_ATRs, CoefExpr parameters are optimized. The best test results are placed in the specified text file (by means of a copy-paste), and from there, when the OptimizationMode is off, the EA takes the parameters when trading.
  • ForPeriod – chart period (timeframe), for which the optimization is performed.
  • Set_number – default is 0 (all sets). It is used to analyze a specific set, one of those written to the file.
  • Indicator – analyzed indicator for defining extreme values: AO, RSI, CCI, Stochastic, MACD, RVI, WPR and Momentum.
  • Ind_per – analyzed indicator period (not relevant for AO).
  • i3 – method of defining a double decreasing top. It varies from 0 to 3 (see the image below).
  • i4 – method of defining a double increasing top. It varies from 0 to 3 (see the image below).
  • SL_ATRs – initial stop loss level in the number of averaged candles. Here and further below, the size of an average candle for the tested timeframe is defined by ATR(200) indicator.
  • TPSL_coef – take profit/stop loss ratio. Recommended values are from 1 to 10.
  • BreakEven_ATRs – breakeven level in ATRs. Recommended values are from 1 to 10.
  • TrailDist_ATRs – trailing distance in ATRs. Recommended values are from 1 to 10.
If BreakEven exceeds TrailDist, trailing does not start till the price breaks the BreakEven level. In other words, BreakEven restrains trailing.
If BreakEven is less than TrailDist, an order is moved to breakeven when the price reaches the BreakEven level. This level remains unchanged till the price breaks the TrailDist level. After that, the trailing starts.
  • Coef_expr - expressiveness of the double extremum - the ratio of the lowest High to Low, to start the pattern validation. The smaller the coefficient, the more expressed the pattern and the less likely it is to be found. Recommended optimization range: from 0.55 to 0.95. Default is 0.95.
  • ShowProfitInfo – show/hide data on the EA's current trading results.
 

Attachments

  • Double Extremum.ex4
    167.7 KB · Views: 12

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock    No Thanks