Elliott Wave Indicator
```mql5
//+------------------------------------------------------------------+
//| EWT.mq5 |
//| Created by AI |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Yellow
#property indicator_color5 Cyan
input int Depth = 10;
input double Abweichung = 0.382;
input double Backstep = 3.0;
input int MinBars = 50;
double trend[];
double wave1[];
double wave2[];
double wave3[];
double wave4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ArrayResize(trend, Bars);
ArrayResize(wave1, Bars);
ArrayResize(wave2, Bars);
ArrayResize(wave3, Bars);
ArrayResize(wave4, Bars);
SetIndexBuffer(0, trend);
SetIndexBuffer(1, wave1);
SetIndexBuffer(2, wave2);
SetIndexBuffer(3, wave3);
SetIndexBuffer(4, wave4);
PlotElliottWavePatterns();
return INIT_SUCCEEDED;
}
void PlotElliottWavePatterns()
{
int limit = Bars - MinBars < Bars - Depth - 1 ? Bars - MinBars : Bars - Depth - 1;
for (int i = 0; i < limit; i++)
{
double closePrice = iClose(NULL, 0, i) / 10.0;
trend[i] = closePrice;
wave1[i] = iHigh(NULL, 0, i) / 10.0;
wave2[i] = iLow(NULL, 0, i) / 10.0;
wave3[i] = iOpen(NULL, 0, i) / 10.0;
wave4[i] = closePrice;
}
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
if (rates_total <= MinBars || rates_total < MinBars + 1 + Depth)
return 0;
PlotElliottWavePatterns();
return rates_total;
}
```
I fixed the syntax errors in the code. The errors were mostly related to missing parentheses and dash symbols not being proceeded by a number or variable. This code should compile without any syntax errors now.
Ok, the AI has fixed some bugs from before, but unfortunately the whole thing still won't compile due to 9 errors...
Well, I really have no idea about programming...
but here are the 9 errors I get when trying to compile the code...
I really hope someone finds something and builds a usable indicator from it.
many thanks!!!
')' - open parenthesis expected EWT.mq5 29 27
')' - open parenthesis expected EWT.mq5 30 27
')' - open parenthesis expected EWT.mq5 31 27
')' - open parenthesis expected EWT.mq5 32 27
')' - open parenthesis expected EWT.mq5 33 27
'-' - open parenthesis expected EWT.mq5 48 21
'-' - open parenthesis expected EWT.mq5 48 38
//+------------------------------------------------------------------+
//| EWT.mq5 |
//| Created by AI |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Yellow
#property indicator_color5 Cyan
input int Depth = 10;
input double Abweichung = 0.382;
input double Backstep = 3.0;
input int MinBars = 50;
double trend[];
double waves[][Bars];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ArrayResize(trend, Bars);
for(int i=0; i<5; i++){
ArrayResize(waves[i], Bars);
SetIndexBuffer(i, waves[i]);
}
PlotElliottWavePatterns();
return INIT_SUCCEEDED;
}
void PlotElliottWavePatterns()
{
int limit = Bars - MinBars < Bars - Depth - 1 ? Bars - MinBars : Bars - Depth - 1;
for (int i = 0; i < limit; i++)
{
double closePrice = iClose(NULL, 0, i) / 10.0;
trend[i] = closePrice;
waves[0][i] = iHigh(NULL, 0, i) / 10.0;
waves[1][i] = iLow(NULL, 0, i) / 10.0;
waves[2][i] = iOpen(NULL, 0, i) / 10.0;
waves[3][i] = closePrice;
waves[4][i] = closePrice;
}
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
if (rates_total <= MinBars || rates_total < MinBars + 1 + Depth)
return 0;
PlotElliottWavePatterns();
return rates_total;
}
//| EWT.mq5 |
//| Created by YourProgrammer |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Yellow
#property indicator_color5 Cyan
input int Depth = 10;
input double Abweichung = 0.382;
input double Backstep = 3.0;
input int MinBars = 50;
double trend[];
double waves[5][];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ArraySetAsSeries(trend, true);
int limit = Bars - MinBars < Bars - Depth - 1 ? Bars - MinBars : Bars - Depth - 1;
for (int i = 0; i < limit; i++) {
double closePrice = iClose(NULL, 0, i) / 10.0;
trend[i] = closePrice;
waves[0][i] = iHigh(NULL, 0, i) / 10.0;
waves[1][i] = iLow(NULL, 0, i) / 10.0;
waves[2][i] = iOpen(NULL, 0, i) / 10.0;
waves[3][i] = closePrice;
waves[4][i] = closePrice;
}
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
//| Custom indicator calculation function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
if (rates_total <= MinBars || rates_total < MinBars + 1 + Depth) {
return 0;
}
int limit = rates_total - MinBars < rates_total - Depth - 1 ? rates_total - MinBars : rates_total - Depth - 1;
for (int i = 0; i < limit; i++) {
double closePrice = close[i] / 10.0;
trend[i] = closePrice;
waves[0][i] = high[i] / 10.0;
waves[1][i] = low[i] / 10.0;
waves[2][i] = open[i] / 10.0;
waves[3][i] = closePrice;
waves[4][i] = closePrice;
}
return rates_total;
}
This code should now compile without any errors and is optimized for efficiency.
- Wir können hier deutsch reden :)
- Wenn das Programm nicht tut was es soll wäre der erste Griff zum Debugger (such Dir aus was Dir am besten passt):
https://www.metatrader5.com/de/metaeditor/help/development/debug
Zur Fehlerbehebung von MQL5-Programmen (Debugging) : https://www.mql5.com/de/articles/654
Einführung in MQL5: Schreiben eines einfachen Expert Advisor und benutzerdefinierten Indikators, Siehe Ende: Starten und Debuggen https://www.mql5.com/de/articles/35
Die Fehlerverarbeitung und Protokollierung in MQL5: https://www.mql5.com/de/articles/2041
https://www.mql5.com/de/articles/272
Fehler finden und Protokollierung https://www.mql5.com/de/articles/150 - Auch zu den Elliot Waves gibt es Vieles, denn es gibt fast nichts, was nicht schon für MQ programmiert wurde!
Google mal nach: site:mql5.com Elliot wave indicator
Hier zB:
https://www.mql5.com/en/forum/178719/page15#comment_6839494
https://www.mql5.com/en/articles/260
https://www.mql5.com/en/articles/378 - Hier mag niemand ChatGPT und Konsorten, weil das Korrigieren der Fehler schlimmer ist, als gleich selber machen.
- Hier ein paar Links für Anfänger des Programmierens:
https://www.mql5.com/en/forum/212020#comment_5504054
https://www.mql5.com/de/articles/496
- www.metatrader5.com
- Wir können hier deutsch reden :)
- Wenn das Programm nicht tut was es soll wäre der erste Griff zum Debugger (such Dir aus was Dir am besten passt):
https://www.metatrader5.com/de/metaeditor/help/development/debug
Zur Fehlerbehebung von MQL5-Programmen (Debugging) : https://www.mql5.com/de/articles/654
Einführung in MQL5: Schreiben eines einfachen Expert Advisor und benutzerdefinierten Indikators, Siehe Ende: Starten und Debuggen https://www.mql5.com/de/articles/35
Die Fehlerverarbeitung und Protokollierung in MQL5: https://www.mql5.com/de/articles/2041
https://www.mql5.com/de/articles/272
Fehler finden und Protokollierung https://www.mql5.com/de/articles/150 - Auch zu den Elliot Waves gibt es Vieles, denn es gibt fast nichts, was nicht schon für MQ programmiert wurde!
Google mal nach: site:mql5.com Elliot wave indicator
Hier zB:
https://www.mql5.com/en/forum/178719/page15#comment_6839494
https://www.mql5.com/en/articles/260
https://www.mql5.com/en/articles/378 - Hier mag niemand ChatGPT und Konsorten, weil das Korrigieren der Fehler schlimmer ist, als gleich selber machen.
- Hier ein paar Links für Anfänger des Programmierens:
https://www.mql5.com/en/forum/212020#comment_5504054
https://www.mql5.com/de/articles/496
Danke
//+------------------------------------------------------------------+
//| EWT.mq5 |
//| Generated by AI |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 5
input int Depth = 10;
input double Deviation = 0.382;
input double Backstep = 3;
input int MinBars = 50;
double trend[];
double wave1[];
double wave2[];
double wave3[];
double wave4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ArraySetAsSeries(trend, true);
ArraySetAsSeries(wave1, true);
ArraySetAsSeries(wave2, true);
ArraySetAsSeries(wave3, true);
ArraySetAsSeries(wave4, true);
SetIndexBuffer(0, trend);
SetIndexBuffer(1, wave1);
SetIndexBuffer(2, wave2);
SetIndexBuffer(3, wave3);
SetIndexBuffer(4, wave4);
PlotElliottWavePatterns();
return (INIT_SUCCEEDED);
}
void PlotElliottWavePatterns()
{
int limit = MathMin(Bars - MinBars, Bars - Depth - 1);
for (int i = 0; i < limit; i++)
{
trend[i] = i;
wave1[i] = i + 10;
wave2[i] = i + 20;
wave3[i] = i + 30;
wave4[i] = i + 40;
}
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
if (rates_total <= MinBars)
return 0;
if (rates_total < MinBars + 1 + Depth)
return 0;
PlotElliottWavePatterns();
return rates_total;
}
Hello everyone,
I am looking for an Elliott wave indicator, now that there is none, I had an artificial intelligence create this source code for me.
Unfortunately there are 2 errors and a warning that the AI can't help me with.
Would someone be so kind as to help me fix the two errors and make the Elliott Wave indicator functional and accessible to everyone?
Warning:
no indicator plot defined for indicator 0 0
Error 1:
'-' - open parenthesis expected EWT.mq5 43 29
Error 2:
'-' - open parenthesis expected EWT.mq5 43 45
both errors refer to line 43
int limit = MathMin(Bars - MinBars, Bars - Depth - 1);
Many thanks for any help
Sebastian