Help me debug this and make it operational

 
*****


 

Please edit your post (don't create a new post) and replace your code properly (with "</>" or Alt-S), or attach the original file directly with the "+ Attach file" button below the text box.

 

Please state what is wrong or the issue you are having.

Does it have compile problems? If yes than show the compile log and indicate where in the code the issue occurs.

Is it a runtime problem? Then show the output of the Journal and Experts log for the errors.

Is it a logic problem? Then explain the issue and show screenshots of the problem.

 
Here is the compile log
Files:
asdads.JPG  50 kb
 
ALEX CHRISTOPHER SOTO #: Here is the compile log

Useless since you didn't include the line/column numbers.

 
Alrighty hope this is better than the one before
Files:
asdasdasd.JPG  83 kb
 
William Roeder #:

Useless since you didn't include the line/column numbers.

Done

 
Fernando Carreiro #:

Please state what is wrong or the issue you are having.

Does it have compile problems? If yes than show the compile log and indicate where in the code the issue occurs.

Is it a runtime problem? Then show the output of the Journal and Experts log for the errors.

Is it a logic problem? Then explain the issue and show screenshots of the problem.

I really dont know what kind of issue it is. 


There is many errors and have done within my knowledge to get it going seems I am having some difficulty

 
ALEX CHRISTOPHER SOTO #:I really dont know what kind of issue it is. There is many errors and have done within my knowledge to get it going seems I am having some difficulty

It is a compile problem, given that you are unable to compile it.

So, please correct you initial post as I requested. In this case, please attach the file itself so that the line numbers match.

 
ALEX CHRISTOPHER SOTO #: Alrighty hope this is better than the one before

Without even trying to compile I can already major issues. Your file is a MQL5 program, but your code has many MQL4 trade functions.

MT4 and MT5 are not compatible and the trade functionality is completely different. You can't use MQL4 trade functionality in an MQL5 program.

 
//+------------------------------------------------------------------+
//|                                                 SuccessWhole.mq5 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
#include <Arrays\Array.mqh>

// Indicator periods
const int rsiPeriod = 14;

// RSI thresholds
const int oversoldThreshold = 30;
const int overboughtThreshold = 70;

// Support and resistance levels
double supportLevel;
double resistanceLevel;

// Array to store RSI values
 rsiValues;

// Function to calculate the RSI
int calcRSI(int period)
{
  double rsi;
  double up = 0;
  double down = 0;
  double close;
  double change;

  for (int i = period; i > 0; i--)
  {
    close = iClose(Symbol(), PERIOD_H1, i);
    change = close - iClose(Symbol(), PERIOD_H1, i + 1);
    if (change > 0)
      up += change;
    else
      down -= change;
  }

  rsi = up / (up + down) * 100;
  rsiValues.(rsi, 0);

  return (int)rsi;
}

// Function to calculate support and resistance levels
void calcSupportResistance(double &support, double &resistance)
{
  double high;
  double low;

  for (int i = 1; i <= rsiPeriod; i++)
  {
    high = iHigh(Symbol(), PERIOD_H1, i);
    low = iLow(Symbol(), PERIOD_H1, i);

    if (high > resistance)
      resistance = high;
    if (low < support)
      support = low;
  }
}

// Function to generate signals based on RSI and support/resistance levels
int generateSignals()
{
  int signal = 0;
  double close = iClose(Symbol(), PERIOD_H1, 0);

  // Calculate RSI and support/resistance levels
  int rsi = calcRSI(rsiPeriod);
  calcSupportResistance(supportLevel, resistanceLevel);

  // Generate signals based on RSI and support/resistance levels
  if (rsi < oversoldThreshold && close > supportLevel)
    signal = 1;
  else if (rsi > overboughtThreshold && close < resistanceLevel)
    signal = -1;

  return signal;
}

// Function to place orders based on signals
void placeOrders(int signal)
{
  if (signal == 1)
  {
    // Place a buy order
    OrderSend(Symbol(), OP_BUY, 0.1, Ask, 3, 0, 0, "Buy order", 123456, 0, Green);
  }
  else if (signal == -1)
  {
    // Place a sell order
    OrderSend(Symbol(), OP_SELL, 0.1, Bid, 3, 0, 0, "Sell order", 123456, 0, Red);
  }
}

// Main function
void OnTick()
{
  // Generate signals
  int signal = generateSignals();

  // Place orders based on signals
  placeOrders(signal);
}


Also