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

仕事が完了した

実行時間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 have a EA/indicator that I want built. I should say 1st off dont know how to code myself so I will be using AI to verify that the source code is complete and matches the documents spec or if better so if you can not truly do the job do not waste either of out time. This is a idea I came.up wit and used AI to produce a framework for it.... and of course AI isn't 100% accurate so I need a knowledgeable quantitative
TumiiFX 30 - 20000 USD
1. Use two EMAs: 20 and 50. If EMA 20 is above EMA 50 → uptrend (look for buys) If EMA 20 is below EMA 50 → downtrend (look for sells) 2. Wait for a pullback into the area between the two EMAs. - For buys: price must touch or move between EMA 20 and EMA 50 during the last few candles. - For stils: same idea, but in a downtrend. 3. Entry signal: Buy: a bullish engulfing candle in an uptrend after the pullback
I am looking for an experienced MQL4 developer to build a professional High-Frequency Trading (HFT) / Low-Latency Expert Advisor for MetaTrader 4 (MT4) . The EA will be deployed on an IC Markets Live account and should be optimized for the fastest possible execution using a low-latency VPS located in LD4 or NY4 . The primary instruments will be US30 and XAUUSD (Gold) . The goal is to create an EA capable of
A robot 50+ USD
HIGH-FREQUENCY M5/M15 CONCURRENT ENTRY SNIPER import time class HighFrequencySniper: def __init__(self): self.target_profit = 25.00 # Targeted Delta Move self.max_execution_time = 3600 # 1 Hour Sandbox (Seconds) self.lot_allocation = "CALIBRATED_TO_RISK" def execute_hft_scan(self, current_price, m5_rsi, m15_order_block): print(f"[SCANNING] Current Kernel Metric: ${current_price:.2f
I need a trading bot, please i need this project urgently and when messaing me kindly send me samples of past works and dont forget i need the project to be done as soon as possible
A lightweight MT5 chart overlay displaying total floating P&L, average entry price, combined lot size, and current symbol exposure as a percentage of account balance, all updating in real time with color-coded profit/loss indicators, delivered with clean object-oriented source code and no DLL dependencies
QUIERO CONSEGUIR EL CODIGO FUENTE DE ESTE INDICADOR QUE ME GUSTA MUCHO TAMBIEN TIENE EL NOMBRE DE ET BANDS O ENTRY EXIT TIMING . no se los componentes pero estas son las imagenes. que mejor lo describen
I am looking to convert my existing TradingView Pine Script (v5) strategy into an MQL5 Expert Advisor (EA) for MetaTrader 5. Strategy Details: Asset: Gold (XAUUSD) Timeframe: 15-minute Strategy Logic: The strategy is based on a breakout concept. Anchor Candle: The base calculation starts from the Specified Candle Entry Window: The EA should only look for entries As Per Indicator Risk Management: The strategy
I want to find a Developer to perform this work and settle payments in this Application. I undertake not to communicate with Applicants anywhere else except this Application, including third-party messengers, personal correspondence or emails. I understand that violators will be banned from publishing Orders in the Freelance
Akram boushaba 30 - 500 USD
مرحبا كيف حالكم انا اكرم مهتم بالتداول احاول ان اصمم برنامج روبوت قادر على التداول من تلقاء نفسه من يمكنه ان يساعدني او يعلمني كيف استطيع فهل ذلك وسأكون ممتناً له وشكرا لكم

プロジェクト情報

予算
30+ USD