I Made this code with CHAT GPT! It has 2 errors.Can Anyone help to fix it!

MQL5 Indicadores Experts

Trabalho concluído

Tempo de execução 1 dia
Comentário do desenvolvedor
very nice and kind
Comentário do cliente
Very good coder!He provided creative solutions and went above and beyond. I look forward to working with him again.

Termos de Referência

Hi.So Here is what i want to EA to do. EA needs to work in all instruments and all timeframes.It needs to opedate only trades it has taken.I Want to have These values so that i can change them :Time to trade,Daily profit target and max loss target(if hit stop trading fo the day), EMA values ,Rsi values and atr values all can be changed.

For buy Check if its trading time,check if daily target is hit,Buy if fast Ema (13,can be changed) crosses above slow Ema  (50,can be changed) and RSI is above (50 can be changed).So Buy only Once When Crosses above and Sell only when crosses below an RSI IS below (50 can be changed) set takeprofit ATR (2 can be changed) and stoploss ATR (1can be changed).


And Code needs to be open so it can be edited.


#define Ask    SymbolInfoDouble(_Symbol, SYMBOL_ASK)

#define Bid    SymbolInfoDouble(_Symbol, SYMBOL_BID)


input int      InpMagicNumber = 123456;   //Magic Number


void OnStart() {

  int ticket;

  // Set the values for the variables that can be changed by the user

  int timeToTrade = 90000; // Time to start trading (in seconds since midnight)

  double dailyProfitTarget = 100.0; // Daily profit target in dollars

  double maxLossTarget = 50.0; // Maximum loss target in dollars

  int fastEmaPeriod = 13; // Period for the fast EMA

  int slowEmaPeriod = 50; // Period for the slow EMA

  int rsiPeriod = 14; // Period for the RSI

  int rsiThreshold = 50; // Threshold for the RSI

  double atrTakeProfit = 2.0; // ATR multiple for the take profit

  double atrStopLoss = 1.0; // ATR multiple for the stop loss


  // Check if it's time to start trading

  if (TimeCurrent() >= timeToTrade) {

    // Calculate the current daily profit or loss

    double dailyProfit = AccountInfoDouble(ACCOUNT_PROFIT);


    // Check if the daily profit or loss has reached the target

    if (dailyProfit >= dailyProfitTarget || dailyProfit <= -maxLossTarget) {

      // End the script if the profit or loss target has been reached

      return;

    }


    // Calculate the values for the fast and slow EMAs

    double fastEma = iMA(NULL, 0, fastEmaPeriod, 13, MODE_EMA, PRICE_CLOSE, 0);

    double slowEma = iMA(NULL, 0, slowEmaPeriod, 26, MODE_EMA, PRICE_CLOSE, 0);


    //// Calculate the value for the RSI

double rsi = iRSI(NULL, 0, rsiPeriod, PRICE_CLOSE, 0);


// Calculate the value for the ATR

double atr = iATR(NULL, 0, 14, 0);


MqlTradeRequest request;

MqlTradeResult result;


// Check if the fast EMA has crossed above the slow EMA

if (fastEma > slowEma) {

  // Check if the RSI is above the threshold

  if (rsi > rsiThreshold) {

  while (true) {

    // Place a buy order

    request.type = OP_BUY;

    request.volume = 0.1;

    request.price = Ask;

    request.slippage = 3;

    request.magic = 0;

    request.take_profit = Ask + atrTakeProfit * atr;

    request.stop_loss = Ask - atrStopLoss * atr;

    request.comment = "EA Order";

    request.expiration = 0;

    request.arrow_color = Green;

    if((m_position.Magic() == InpMagicNumber) && (m_position.Symbol() == m_symbol.Name()))

    if (OrderSend(request, result)) {

      // Order has been placed successfully

    } else {

      // An error occurred while placing the order

      Print("Error code: ", GetLastError());

    }

  }

} else if (fastEma < slowEma) {

  // Check if the RSI is below the threshold

  if (rsi < rsiThreshold) {

    // Place a sell order

    request.type = OP_SELL;

    request.price = Bid;

    request.take_profit = Bid - atrTakeProfit * atr;

    request.stop_loss = Bid + atrStopLoss * atr;

        request.arrow_color = Red;

    if (OrderSend(request, result)) {

      // Order has been placed successfully

    } else {

      // An error occurred while placing the order

      Print("Error code: ", GetLastError());

      }

   }

}



Respondido

1
Desenvolvedor 1
Classificação
(30)
Projetos
55
22%
Arbitragem
12
67% / 8%
Expirado
2
4%
Livre
2
Desenvolvedor 2
Classificação
(54)
Projetos
53
17%
Arbitragem
7
0% / 100%
Expirado
5
9%
Livre
3
Desenvolvedor 3
Classificação
(568)
Projetos
641
41%
Arbitragem
21
57% / 29%
Expirado
47
7%
Trabalhando
Pedidos semelhantes
Hello, I want to create an EA that can be able to take and optimise trade bids using the trend tracker concept I have developed. The tracker will monitor the 2 lines in the below pictures and then start to activate bids once they cross each other and then be able to manage all bids afterwards towards the direction of the market by opening and closing them intermittently and profitably until the position at the other
Hi man, How are u? I have an EA and I need to check few aspects of the code, if It works fine? I am looking for an expert coder, who can understand mt4 language and help us to solve this out. This job will hardly take about 3-4 hours max for an experienced coder, when explained detail. Also, I would like to give this to someone, who can understand and speak English well. Also, the coder should be able to come via
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA. THREE TYPES OF ENTRIES 1: AGGRESSIVE 2: DIVERGENCE 3
Indicator in use: Bollinger Bands Mechanism (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the lowest point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal; or if on Futures if the increment is .25 or .10 then this is used) 2. Enter sell ONLY on the next candle if price breaks
Indicator in use: Bollinger Bands Mechanism: (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal) 2. Enter sell ONLY on the next candle if price breaks below the trigger candle LOW (using the e.g. above- if next candle price
hey guys, im looking for an auto mt5 license system through a web app i have already, i simply want it so a unique license key is generated for memebers, they input this onto the EA input and then it checks if its valid. active license per user capped at 5. i already have an mt5 coder and dec team for the app so i dont know if youd prefer to intergrate onto the webapp yourself or simply provide the code and doc so my
I need a simple panel to execute both buy and sell operations with very basic things like stopp loss take profit that functions for both market orders such as buy stop sell stop buy limit sell limit I don't care about colors or design I just want how you can do it what interests me most are the functions
I want to create an EA that can take bids according to information of a logic I have developed to give indication of a BUY or SELL opportunity. The EA will then be able to activate the BUY at the lowest possible position once the indicator clears it for a BUY and take bid upwards or identify the highest point and clears it for a SELL and take bids downwards. As you can see from example of JULY 2024 data to see how
We are seeking a skilled developer who can convert a Tradingview indicator written in Pinescript to a NinjaTrader indicator written in C#. The goal is to create a profitable trading strategy using this indicator. The successful candidate will have expertise in both Pinescript and C# programming languages, as well as a strong understanding of trading indicators and strategies. The main responsibilities will include
I am seeking an experienced MQL5 developer to create a user-friendly manual Grid Trading Expert Advisor (EA) with the following key features: Dynamic Grid Trading: Adjustable Grid Distance: Traders can manually input grid distance in pips via an intuitive, movable table. Take Profit Management: Fixed TP for the initial positions (e.g., first 5 trades). Stop-Loss (Optional): Traders can choose to use a stop-loss with

Informações sobre o projeto

Orçamento
30+ USD
IVA (24%): 7.2 USD
Total: 37.2 USD
Desenvolvedor
27 USD