Building a ZigZig_EA MT5

MQL5 전문가

명시

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.

파일:

ZIP
MQL5.zip
13.0 Kb

응답함

1
개발자 1
등급
(171)
프로젝트
194
11%
중재
37
38% / 35%
기한 초과
5
3%
로드됨
2
개발자 2
등급
(12)
프로젝트
12
25%
중재
1
0% / 100%
기한 초과
0
무료
3
개발자 3
등급
(155)
프로젝트
239
70%
중재
3
67% / 33%
기한 초과
20
8%
무료
4
개발자 4
등급
(383)
프로젝트
411
69%
중재
3
100% / 0%
기한 초과
2
0%
바쁜
5
개발자 5
등급
(42)
프로젝트
88
14%
중재
31
29% / 55%
기한 초과
36
41%
작업중
비슷한 주문
Dears, I hope you are doing well. I am looking to develop a trading bot specifically for trading gold on the MT5 platform. My target is for the bot to generate a monthly return of 40-60% on the initial capital, which will start at $2,000, with a leverage of 1:400. Additionally, I would like to have access to the indicators and tools necessary for evaluating the bot’s performance. These should include key metrics like
I have an expert that wrote in Mq4 .. and I would like to convert it to Mq5 .. to work as it works on mq4 .. with some added options.. so who can do it for me
Mega-FX Indicator 30 - 100 USD
Hello the Mega-Fx Indicator is currently running on MT4. I would need it in Mt5 and automatic trading with free setting of parameters. Specifically. When he should make a trade should be adjustable
I am looking for someone to help me to automate my trading from mt4/5 expert advisors and own trades to tradovate. My trades are generated by my expert in MT5, I want those trades copied to Tradovate's platform using their API to different accounts, that some programmers have suggested is a REST API and should be easily doable
Kindly access the vps to check out the EA, the name of the EA I'm referring to is called TOPGUN 2.0 The EA is in below VPS Server: 176.57.188.42 User:administrator Password: Test20082024! The project is to replicate the same EA in the server and code a very similar one based on the exact functionality in that existing EA
Good day. I would like to have an EA that closes all positions when a certain equity has been achieved. For example, I set balance to 100$ and equity target profit to 5$. When equity reaches 105$, it closes all positions and does the process again to 110$, 115$ and so on and so forth
*Forex Robot Requirements Specification* *General Information* - Robot Name: [Success Fighter] - Trading Platform: [MetaTrader 4/5] - Broker Compatibility: [Exness] - Currency Pairs: [ *Major Currency Pairs:* 1. EUR/USD (Euro/US Dollar) 2. USD/JPY (US Dollar/Japanese Yen) 3. GBP/USD (British Pound/US Dollar) 4. USD/CHF (US Dollar/Swiss Franc) 5. AUD/USD (Australian Dollar/US Dollar) 6. USD/CAD (US Dollar/Canadian
Hello, I need a capable programmer who can convert a Tradingview indicator I created into an EA based on a given trading strategy. I need both an MT4 and MT5 version. Thank you for your offers =)
Hello, I am looking for a skilled developer to create an Expert Advisor (EA) using Parabolic SAR Brief Task Description: 1. This EA will use the Parabolic SAR indicator for signals, and its open and close orders will be based on the signal, as well as the "candlestick behavior of price relative to the Parabolic SAR This EA will have a time-based function, subject to the
The service of a coder is required to Add an indicator menu and indicator file to the existing ea The Indicator will work with already installed indicator Details of the strategy will discussed when you applies The ea will be proof on the live market before its approved

프로젝트 정보

예산
100+ USD
VAT (19%): 19 USD
총: 119 USD
개발자에게
90 USD