Ei pessoal,
Meus olhos estão sangrando
Alguém pode ver o que há de errado com o meu código, estou tentando há horas.
Erro ao anexar ao gráfico: array fora do intervalo - nesta linha: double current_high = High[current_bar_index];
Código inserido int ThisBarTrade = 0;/ ---------------------------------------------------------- ------------------- /| Função de inicialização do indicador personalizado |/ ---------------------------------------------------------- ------------------- int OnInit() {/--- mapeamento de buffers do indicador/Cada vez que o indi é recarregado (ou seja, alternar entre TFs, new apply , etc ...),/a barra atual não é verificada quanto a condições. ThisBarTrade = Time#91;0#93;;/--- return(INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- /| Função de desinicialização do indicador de cliente |/ ---------------------------------------------------------- ------------------- int deinit() { return(0); }/ ---------------------------------------------- -------------------- /| Função de iteração do indicador personalizado |/ ---------------------------------------------------------- ------------------- int OnCalculate(const int rate_total, const int prev_calculated, const datetime time#91;#93;, const double open#91;#93; , const double high#91;#93;, const double low#91;#93;, const double close#91;#93;, const long tick_volume#91;#93;, const long volume#91;#93; , const int spread#91;#93;) {/--- pares de string#91;#93;; int comprimento = getAvailableCurrencyPairs(pares); if (Bars != ThisBarTrade ) { ThisBarTrade = Bars;/garante apenas uma oportunidade de negociação por barra/Percorre os símbolos for(int i=0; i lt; length; i ) {/Alert(Pair #, i 1, : , pairs#91;i#93; );/Obtém o índice int current_bar_index = iHighest(pairs#91;i#93;, PERIOD_M5, MODE_HIGH, 1, 0); int anterior_bar_index = iHighest(pairs#91;i#93;, PERIOD_M5, MODE_HIGH, 1, 1); int current_bar_index_low = iLowest(pairs#91;i#93;, PERIOD_M5, MODE_LOW, 1, 0); int anterior_bar_index_low = iLowest(pairs#91;i#93;, PERIOD_M5, MODE_LOW, 1, 1);/Obter preços double current_high = High#91;current_bar_index#93;; double previous_high = High#91;previous_bar_index#93;; double current_low = Low#91;current_bar_index_low#93;; double previous_low = Low#91;previous_bar_index_low#93;;/Logic - Start if (( previous_low 1.0 * Point ) gt; current_low || ( previous_high - 1.0 * Point ) lt; current_high ) { Alert(Pair #, i 1, : , pairs#91;i#93; , tem um máximo mais alto ou um mínimo mais baixo); }/Logic - End }/for length }/if Bars/--- retorna o valor de prev_calculated para a próxima chamada return(rates_total); }/ ---------------------------------------------- -------------------- // ---------------------------------------------------------- ------------------- int getAvailableCurrencyPairs(string availableCurrencyPairs#91;#93;) {/--- bool selected = false; const int symbolCount = SymbolsTotal(selecionado); int currencypairsCount; ArrayResize(availableCurrencyPairs, symbolsCount); int idxCurrencyPair = 0; for(int idxSymbol = 0; idxSymbol lt; symbolCount; idxSymbol ) { string símbolo = SymbolName(idxSymbol, selected); string firstChar = StringSubstr(símbolo, 0, 1); if(firstChar != # StringLen(symbol) == 6) { availableCurrencyPairs#91;idxCurrencyPair #93; = símbolo; } } currencypairsCount = idxCurrencyPair; ArrayResize(availableCurrencyPairs, currencypairsCount); retornar moedaparesCount; }/ ---------------------------------------------- -------------------- class CFix { } ExtFix;/Força a avaliação de expressões durante a depuração