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

MQL5 指标 专家

工作已完成

执行时间1 一天
员工反馈
very nice and kind
客户反馈
Very good coder!He provided creative solutions and went above and beyond. I look forward to working with him again.

指定

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());

      }

   }

}



反馈

1
开发者 1
等级
(32)
项目
57
23%
仲裁
12
67% / 8%
逾期
2
4%
空闲
2
开发者 2
等级
(54)
项目
53
17%
仲裁
7
0% / 100%
逾期
5
9%
空闲
3
开发者 3
等级
(568)
项目
641
41%
仲裁
25
48% / 36%
逾期
46
7%
工作中
相似订单
Only programmers with experience with orderflow please, it's not the easiest project, I don't want to have arbitration etc. I am not expert in orderflow yet, if you have suggestion about strategy it would be very nice. Source of code required, I am searching a programmer for a longer co-operation
Please create an simple EA in mql5 based on RSI indicator with e-mail, sounds and push notification alerts, of course can't be any bugs, errors, but I think it's obvious. I am searching a programmer for longer co-operation. Thank you for your attention, Have a nice day
Hi, I am looking for an already made profitable EA. It can be an indicator but then it must be possible to make an EA from the indicator. Will need to test before payment (this can be in demo or limited time test). I will pay up to $6000. Do not apply if you want an upfront payment. I need to test for a few times first. Mostly only pips matters. I look much the risk safety, money management, risk reward, and overall
Привіт. Шукаю когось, хто б застосував мій код як бота . Я торгую індексом Aus_200 SFE (не XJO). Бот базується на MACD входу/виходу, RSI, стохастиці та vwap. Як тільки роботу приймуть, мені потрібно внести кілька коректив; однак, нічого суттєвого. Дякую
SMC Martingale Pro is an advanced MetaTrader 5 Expert Advisor designed for high-volatility markets like XAU/USD. It combines institutional Smart Money Concepts with a dynamic risk recovery system. Key Features Dual FVG Engine: Automatically identifies and renders both bullish and bearish Fair Value Gaps in real time. Multi-Timeframe Flexibility: Operates independently of the active chart timeframe to target
I am looking for an experienced Sierra Chart ACSIL (C++) developer to create a custom indicator that measures the average Prior Day High-Low range over a configurable number of trading days (default: 7 days) using a 23-hour trading session
I have a technical specification ready for a custom alert indicator in NinjaTrader 8 (NinjaScript / C#). Important clarification: it is NOT an automatic trading bot, it is solely a visual indicator (arrows/lines on the chart) and sound alerts (notifications) based on EMA crossovers and range breakouts (ORB 15m) on lower timeframes for futures (MES). I already have the exact rules written out unambiguously
Custom MT5 EA for buy stop and sell stop breakout strategy.’ ‘Requirements, develop a custom Expert Advisor for MetaTrader 5 that places buy-stop and sell-stop pending orders based on defined breakout rules.’ ‘All important values adjustable via inputs.’ ‘Includes stop loss, take profit, trailing stop, and configurable risk management.’ ‘One trade at a time, works on demo before live.’ Provide source code and
I have an automated trading strategy in NinjaTrader 8 (C# / NinjaScript) that is currently under development. Before diving into technical details, I’d like to ask a quick question from someone who's interested. Do you work on existing / in-progress codebases to debug, refactor, or add new features, or do you strictly build projects from scratch? NOTE : Only professional Developer should apply for this project
السلام عليكم ورحمة الله وبركاته، ​أبحث عن مبرمج MQL5 خبير ومتمكن جداً لتطوير روبوت تداول (Expert Advisor) محترف لمنصة MetaTrader 5 يعمل باستراتيجية هيدج محددة بصفقة واحدة فقط في كل اتجاه (1 Buy & 1 Sell Max) مع إدارة مخاطر صارمة. ​المواصفات والاستراتيجية المطلوبة: ​1. آلية الهيدج المحدود (Single Position Hedging Limit): ​الحد الأقصى للصفقات: يُسمح للروبوت بفتح صفقة شراء واحدة (1 Buy) وصفقة بيع واحدة (1 Sell) فقط كحد

项目信息

预算
30+ USD