Building a ZigZig_EA MT5

MQL5 Experts

Specification

Building a ZigZig_EA MT5
If you used ZigZag indicator at least once, you know how many compromises you have to make when searching for optimal parameters. Too small parameter values divide a big movement into small parts, while too big parameter values skip short movements. The algorithm for searching graphical patterns is very demanding as of quality of finding extremums. While trying to find a middle ground, I decided to use the indicator with small parameter values and create an additional superstructure combining unidirectional movements with short corrections into one movement.
The attached CTrends class Trend.mqh has been developed to solve this issue.  During the initialization, a reference to the indicator class object and the minimum movement value considered as a trend continuation are passed to the class.
To get data on extremums, the following methods are provided in the class Trend.mqh:
•    ExtremumByTime — get the extremum number in the database for a specified time,
•    Extremum — return extremum at a specified position in the database,
•    IsHigh — return true if a specified extremum is a top and false if it is a bottom.
The general information block features methods returning the total number of saved extremums, used symbol and timeframe.
------------------------------------------------------------------------------------------------------------------
The main class logic of Trend.mqh is implemented in the Calculate method. Let's take a closer look at it.
At the beginning of the method, check the relevance of the reference to the indicator class object and the presence of extremums found by the indicator.
Next, define the number of unprocessed extremums. If all extremums are processed, exit the method with the true result.
After that, request the necessary amount of extremums from the indicator class.
If there have been no extremums in the database up to this time, add the oldest extremum to the database by calling the AddTrendPoint method.
Next, arrange the loop with iteration over all downloaded extremums. Previous extremums before the last saved one are skipped.
In the next step, check if the extreme points are unidirectional. If a new extremum re-draws the previous one, update the data.
For oppositely directed extreme points, check whether the new movement is a continuation of a previous trend. If yes, update data on extremums. If no, add data on the extremum by calling the AddTrendPoint method;
------------------------------------------------------------------------------------------------------------------


You need the classes:
Include/ZigZag.mqh
Include/Trends.mqh

You might need those classes also:
Include/Pattern.mqh
Include/Header.mqh
Include/Trade/LimitTakeProfit.mqh

All functions from ZigZag indicator and the optimizer ZigZag.mqh and Trends.mqh should be changeable in the EA.
Based on the smoothed ZigZag signals, the EA should sell or buy as follows:
Here is an example of the logic needed. It would be good to encapsulate this logic in a separate class, so that it can easily fit on a new base later:
Let's say (optimized) ZigZag indicator generates a sell signal for EURUSD at 1.20660 then EA checks the latest bottom price where (optimized) ZigZag indicator turned upwards. This may was 1.20563. Then ZigZag_EA calculates the difference between 1.20660 and 1.20563 that is 0.00097 and divide it by a figure I want to choose, 6 for example That comes to 0.00016. Take profit is then 1,20643.
After that EURUSD make an unexpected rise to 1.2077 and (optimized) ZigZag indicator redraws and generates a sell signal again. ZigZag_EA sells again (a number of times of the first lot I want to set, like martingale. New take profit for the new sell position would be at (1.2077- 1.20563)/6+1.20563=1.205975 but ZigZag_EA must not set a new TP .
Meanwhile I am 0.00207 in loss with the first position, of course. Then market turns and the last position generates profit. At the very point when the profit of first position plus the profit of second position equals the first TP distance of 0.00097 close all sell positions.
For buy positions vice versa.

Files:

ZIP
MQL5.zip
13.0 Kb

Responded

1
Developer 1
Rating
(171)
Projects
194
11%
Arbitration
37
38% / 35%
Overdue
5
3%
Loaded
2
Developer 2
Rating
(12)
Projects
12
25%
Arbitration
1
0% / 100%
Overdue
0
Free
3
Developer 3
Rating
(155)
Projects
239
70%
Arbitration
3
67% / 33%
Overdue
20
8%
Free
4
Developer 4
Rating
(379)
Projects
407
70%
Arbitration
3
100% / 0%
Overdue
2
0%
Loaded
5
Developer 5
Rating
(42)
Projects
88
14%
Arbitration
30
30% / 57%
Overdue
36
41%
Working
Similar orders
CHAPTER 1: BASICS 1.THE BASICS 1.1. EXPANSION AND RETRACEMENT Expansion =>occurs when there is an impulse movement towards a direction. Retracement => is the correction movement after an impulse movement. 1.2. FIBBONACCI RETRACEMENT USED TO DETERMINE THE END OF THE RETRACTION MOVEMENT, USUALLY THE PRICE RETRACTS TO 50% OR UNTIL OTE (0.62, 0.705, 0.79) BEFORE ANOTHER IMPULSE MOVEMENT OCCURS. 1.3. BMS - BREAK IN MARKET
Am looking for a developer who can convert an MT5 indicator into MT5 EA. I have the source code of the indicator and i want it modified a little to fit my parameters. Only developer with Smart Money Concept should get in touch. The developer will also add another MT5 indicator( this will be used to confirm entries and exit of orders. More details to follow
I want a program that automatically disables manual trade execution once a specified number of trades have already been placed. ie. After a total of 3 trades have been placed on that day, manual trade execution should be disabled. I want the program to also limit the amount of lots that can be traded in any given day. ie. Maximum of 15 standard lots in any given day. The program should disable manual trade execution
Currency Strength EA 30 - 80 USD
hi These ACS&Csdash indicators work in the same way but provide signals of different currency pairs. And Either of these two ACS indicators should be selected any one and set to trade. It provides signals of multiple currency pairs in the interface So the EA should work like that to trade multiple currency pairs on one chart. CsDash should analyze whether it is a strong signal to show on the dash board and make a
Hello Everyone, I want a professional programmer to help me create an Expert with the ability to take bids in accuracy and be able to manage trades effectively. I have developed a price mechanism that will help to identify if a trade is Going upwards or downwards. This has helped me to identify 2 price positions. So, after establishing the price positions, the next move of the market afterwards will then determine
I am looking for a highly sample and ready and tested profitable EA to purchase.if it meets my requirements i will order same one.EA must be low drawdown high profit on any timeframe
i have a ready made SMC EA and looking for optimizing and debugging and also adding back the missing things in the requirement file. Basically work with the current code and refine it to fit the requirement file. Most indicator is already in the EA and the requirement file below are mostly finish. here are the things need to add back and debug based on the requirement file 1. TP from the filter and need to check
If you think you can replicate EA ("reverse engineering") from Metarader's Market, and create a new EA from scratch that works 100% the same - please send an offer. I have already managed to find out many features of that EA (entry times, risk management, averaging, trailing...) but I still miss a few
Candle wick bot The bot will have a set amount of wick length to enter trade at candle open price, there will be a set Amount in points that the candle wick has to be to then enter that opposite of the wick direction Settings will look like this : Timeframe: (meaning which candles you’re using to measure open price from for the wick length ) If set to 5 min it’ll be using 5 min candles , if set to 15 it’ll use 15
Looking for a developer to create an MT4 EA based on a custom currency strength indicator and simple moving average. Will provide currency strength indicator code to the selected developer. Buy rules If the EA added in the EURUSD chart and EUR has a currency strength above or equal to 6 and USD has strength less than 2. Wait for the prices comes back to SMA and open the buy trade if the price closes above SMA. Place

Project information

Budget
100+ USD
VAT (19%): 19 USD
Total: 119 USD
For the developer
90 USD