Reputation: 1
I am developing a simple Expert Indicator (EA) to analyze Forex chart and need assistance with the indicator signals. The code compiled without errors, but once initialized and tsignal is defaulted to the Max allowed double value of 1.79xxxxx
Please help to determine why it is not returning the correct signal values.
// Include the necessary MQL5 header files
#include <Trade\Trade.mqh>
#include <Indicators\Indicators.mqh>
// Create instances of the indicators and the trade class
CiBullsPower bullsPower;
CiRSI rsi;
CTrade trade;
double myBullsValue = 0;
double myRsiValue = 0;
void OnTick()
{
bullsPower.Create(_Symbol, _Period, 14);
myRsiValue = rsi.Create(_Symbol, _Period, 14, PRICE_CLOSE);
myBullsValue = bullsPower.Main(0);
myRsiValue = rsi.Main(0);
Comment(myBullsValue, "\n", myRsiValue, "\n");
// Check for buy signal
if (myBullsValue > 0 && myRsiValue > 30 && myRsiValue < 70)
{
// Place a buy order
trade.Buy(1, _Symbol);
}
// Check for sell signal
else if (myBullsValue < 0 && myRsiValue > 70)
{
// Place a sell order
trade.Sell(1, _Symbol);
}
}
Upvotes: 0
Views: 27