Indicators: BrainTrend2Sig

 

BrainTrend2Sig:

BrainTrend2Sig is an indicator of the market trends that assigns colors to candlesticks according to the trend direction.

While there is a downward trend on the market, all candlesticks are colored in red. As soon as the trend is upwards, all succeeding candlesticks will be colored in blue.

BrainTrend2Sig algorithm is based on the processing of ATR and Stochastic Oscillator indicators' information. In this indicator I extracted all algorithm variables that can be controlled into the indicator's input parameters, so it can be used not only with the default settings now.

Author: Nikolay Kositsin

BrainTrend2Sig

 

Hello good morning, I'm trying to use the indicator in a custom EA. In mt4 it works perfectly, but in mt5 I have difficulty doing the same, in mt4 I call the indicator this way and it has worked:

Hello good morning, I'm trying to use the indicator in a custom EA. In mt4 it works perfectly, but in mt5 I have difficulty doing the same, in mt4 I call the indicator this way and it has worked:


// Chama a função iCustom para obter o valor da seta azul
   redArrowValue = iCustom(Symbol(), Period(), "BT2", 0, 0);

// Chama a função iCustom para obter o valor da seta vermelha
   blueArrowValue = iCustom(Symbol(), Period(), "BT2", 1, 0);





// Condição de venda: Preço acima da linha de cima e sinal de venda no BT2
   if(!HasOpenPositions(Symbol(), MagicNumber) && CheckStartMarket() && currentPrice > upBuffer && redArrowValue == 1 && blueArrowValue > 0 && previousOpen > upBuffer)
     {
      SellOrder(TakeProfit, StopLoss);
      partialCloseActivated = false;
      breakevenActivated = false;
      Alert("Venda efetuada!");
     }

// Condição de compra: Preço abaixo da linha de baixo e sinal de compra no BT2
   if(!HasOpenPositions(Symbol(), MagicNumber) && CheckStartMarket() && currentPrice < dnBuffer && blueArrowValue == 2 && redArrowValue > 0 && previousOpen < dnBuffer)
     {
      BuyOrder(TakeProfit, StopLoss);
      partialCloseActivated = false;
      breakevenActivated = false;
      Alert("Compra efetuada!");
     }
  }