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%
工作中
相似订单
I DO NOT need any programming or strategy development. I already have a working NinjaTrader 8 automated strategy based on a 3/5 EMA crossover. I need you to run my existing strategy through NinjaTrader Strategy Analyzer/Optimizer, test the existing adjustable parameters, and find robust settings with the best profit factor and lowest reasonable drawdown. I will provide the existing NinjaScript ZIP. I do not want the
Mr quetta 100+ USD
Yes, that is exactly what I need. The bot should not be restricted to a fixed list of currency pairs. It should technically scan all available Quotex pairs in real time and automatically select the pair where the market conditions are strongest. The bot should analyze each pair using multiple confirmations, such as short-term price momentum, trend direction, market structure, support/resistance, candle formation
Platform: TradingView Programming Language: Pine Script v6 Type: Custom Indicator Project Name: Scalping Reaction Zones + Valid Order Blocks MAIN GOAL I need a custom TradingView indicator for scalping. The indicator must detect: 1. Reaction / Explosion Zones 2. Valid Order Blocks 3. Combined Reaction Zone + Order Block zones The indicator should NOT generate: Buy signals Sell signals TP SL Entry signals Trading
Project Description I am looking for an experienced MQL5/MT5 Expert Advisor developer to develop an automated trading EA for XAUUSD on the M3 timeframe , running on an Exness account . The EA will automate a manual strategy based on SNR/GAP zones , using two setup types: Price Rejection Price Correction The EA should identify valid BUY/SELL setups around predefined SNR/GAP areas, apply configurable RSI, SMA, EMA and
Indicador Maximas e Minimas + Super Trend O Indicador MAX/MIN é um indicador de análise técnica para o MetaTrader 5 , desenvolvido para ajudar você a identificar regiões importantes de preço e possíveis oportunidades de compra e venda. O que ele faz MAX/MIN: identifica máximas e mínimas relevantes do mercado e mostra os preços no gráfico. HH / HL / LH / LL: ajuda a visualizar a estrutura do mercado, mostrando quando
Hello Traders, Have a trading strategy or idea you want to automate? I specialize exclusively in MQL5 development, helping traders turn their concepts into professional trading solutions. Custom Expert Advisors — automate your strategy and reduce manual execution Custom Indicators — transform your market ideas into powerful trading tools Fix & Debug — identify errors and get your existing code working properly
I DO NOT need any programming or strategy development. I already have a working NinjaTrader 8 automated strategy based on a 3/5 EMA crossover. I need you to run my existing strategy through NinjaTrader Strategy Analyzer/Optimizer, test the existing adjustable parameters, and find robust settings with the best profit factor and lowest reasonable drawdown. I will provide the existing NinjaScript ZIP. I do not want the
I'm looking for an experienced developer to create an automated gold trading bot. The bot should be compatible with MetaTrader 4/5 and TradingView. Key Requirements: - Automated trading bot - Compatible with MetaTrader 4/5 and TradingView - Implement scalping and swing trading strategies Ideal Skills and Experience: - Proficiency in trading algorithms - Experience with gold trading - Familiarity with MetaTrader and
I need a robust optimization of my MT5 EA, mainly for XAUUSD (Gold). Please optimize the existing adjustable parameters such as entry/exit settings, SL/TP, trailing/break-even settings, and any other strategy parameters that are appropriate. I want the optimization focused on stable profitability, low/moderate drawdown, and robustness rather than simply the highest possible profit. Please use out-of-sample testing
NinjaTrader 8 / NinjaScript Phase 1 build: convert an existing Auction Market Theory (AMT) strategy into objective, alert-only decision-support logic. Not a bot, no auto-execution — trades stay manual. Covers NQ/MNQ, ES, CL, MGC using 30-min TPO/Volume Profile context with 5-min confirmation: one 5-min close outside VAH/VAL = acceptance, close back inside = rejection. Dashboard shows bias, auction state, location

项目信息

预算
30+ USD