Revisar e ajustar um Indicador MT5

Работа завершена

Время выполнения 23 часа

Техническое задание

Eu criei um indicador pelo ChatGPT e ele está compilando corretamente mas as linhas que são plotadas na janela separada do indicador MT5 não estão sendo atualizadas corretamente, elas aparecem como linhas retas horizontais e não tem nenhuma variação, e eu não sei programar e não sei como ajustar isso e o chatGPT também não conseguiu resolver.

O código é bem pequeno e básico, acredito ser simples de resolver para quem sabe programar.


Segue o código gerado pelo chatGPT:


//+------------------------------------------------------------------+

//| Custom indicator for MetaTrader 5                                |

//+------------------------------------------------------------------+

#property indicator_separate_window

#property indicator_buffers 3

#property indicator_plots   3

#property indicator_type1   DRAW_LINE

#property indicator_type2   DRAW_LINE

#property indicator_type3   DRAW_LINE

#property indicator_color1  DeepSkyBlue  // Amplitude

#property indicator_color2  Red          // Média da Amplitude

#property indicator_color3  Green        // Linha Limite


//--- input parameters

input int PeriodoAmplitude = 30;

input int PeriodoMediaAmplitude = 17;

input double LinhaLimite = 20.0;


//--- indicator buffers

double amplitudeBuffer[];

double mediaAmplitudeBuffer[];

double linhaLimiteBuffer[];


//+------------------------------------------------------------------+

//| Indicator initialization function                                |

//+------------------------------------------------------------------+

int OnInit()

{

    SetIndexBuffer(0, amplitudeBuffer);

    SetIndexBuffer(1, mediaAmplitudeBuffer);

    SetIndexBuffer(2, linhaLimiteBuffer);


    ArraySetAsSeries(amplitudeBuffer, true);

    ArraySetAsSeries(mediaAmplitudeBuffer, true);

    ArraySetAsSeries(linhaLimiteBuffer, true);


    PlotIndexSetString(0, PLOT_LABEL, "Amplitude");

    PlotIndexSetString(1, PLOT_LABEL, "Média da Amplitude");

    PlotIndexSetString(2, PLOT_LABEL, "Linha Limite");


    IndicatorSetString(INDICATOR_SHORTNAME, "Indicador Customizado de Amplitude");

    return INIT_SUCCEEDED;

}


//+------------------------------------------------------------------+

//| Custom indicator iteration 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[])

{

    int required = MathMax(PeriodoAmplitude, PeriodoMediaAmplitude);

    if (rates_total < required)

        return 0;


    for (int i = prev_calculated > required ? prev_calculated : required; i < rates_total; i++)

    {

        amplitudeBuffer[i] = high[iHighest(NULL, 0, MODE_HIGH, PeriodoAmplitude, i)] - low[iLowest(NULL, 0, MODE_LOW, PeriodoAmplitude, i)];

        mediaAmplitudeBuffer[i] = iMA(NULL, 0, PeriodoMediaAmplitude, 0, MODE_SMA, PRICE_CLOSE);

        linhaLimiteBuffer[i] = LinhaLimite;


        // Debugging information

        Print("Bar ", i, ": Amplitude = ", amplitudeBuffer[i], ", Media = ", mediaAmplitudeBuffer[i], ", LinhaLimite = ", linhaLimiteBuffer[i]);

    }


    return rates_total;

}



---------------------------------------------------------------------




Ele deveria ficar como na imagem anexo...




Откликнулись

1
Разработчик 1
Оценка
(23)
Проекты
29
14%
Арбитраж
3
0% / 67%
Просрочено
3
10%
Работает
2
Разработчик 2
Оценка
(32)
Проекты
53
23%
Арбитраж
2
50% / 0%
Просрочено
13
25%
Свободен
3
Разработчик 3
Оценка
(801)
Проекты
1372
72%
Арбитраж
112
29% / 48%
Просрочено
341
25%
Работает
Похожие заказы
Olá Já possuo um código de um EA que opera entrando e invertendo o movimento conforme o rompimento do candle. Ou seja quando o preço rompe a maxima/minima anterior, ele entra na direção do movimento. Já tenho esse código, preciso que somente seja otimizado, pois eu mesmo quem fiz. Porém minha solicitação é que ele rode em renko também, pois não consigo fazer ele rodar em renko, somente em candle, preciso que o
Hello. I open this work with the intention of changing the indicator that is present in my EA code. This is an EMA 200 code, called STR-EMA. I will send a FINAL-EMA file for the exchange to take place. Furthermore, I would like a simple modification to FINAL-EMA, which is the possibility of changing the period in X candles (it is currently set to pattern 200) Please note that the functionality of the EA should not be
//+------------------------------------------------------------------+ //| SimpleEA.mq5| //| Copyright 2023, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "2023, MetaQuotes Software Corp." #property link " https://www.mql5.com " #property version "1.00" #property strict input int FastMAPeriod = 12; // Período da média

Информация о проекте

Бюджет
34+ USD
Исполнителю
30.6 USD
Сроки выполнения
до 1 дн.