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
評価
(30)
プロジェクト
55
22%
仲裁
12
67% / 8%
期限切れ
2
4%
2
開発者 2
評価
(54)
プロジェクト
53
17%
仲裁
7
0% / 100%
期限切れ
5
9%
3
開発者 3
評価
(568)
プロジェクト
641
41%
仲裁
21
57% / 29%
期限切れ
47
7%
仕事中
類似した注文
Connect from Mt5 via binary deriv account api I have mt5 indicator, need to connect with binary deriv account through api. If anyone can setup via API then contact me. everything control mt5
Hello I am looking for a developer to create an 50% retracement Indicator of the previous candle . So once a candle close the Indicator is supposed to take the full candle size from high to low and make a 61% and 50% level on that candle and I would like the candle to show until the next previous candle is done creating. After this I would look to create an ea with it possibly
Hi, I have 2 indicators which are based on the super trend , the alerts on indicator (1) does not work at all , and on the other indicator the alerts do not come on time on time, which is kind of delayed. see attached file below
Looking for an experienced developer to modify my existing TDI strategy , want to add filter for Buy and Sell Signals, Arrows are displayed on chart and what only to leave high accurate arrows Source code to be provided
I have the mq5 file, I need a buffer adding to the indicator, so it appears in the data window so I can reference it later in an EA. As the below screenshot shows, there is a median ray line from yesterday (the dashed horizontal line) - I want this value in the data window called Median Ray. I want this to be a single value per day, so todays Median Ray would be 17868, and so on each day. So I want all the Developing
I would like to develop my own indicator on metatrader 4 and tradingview. We would start with a basic version that we would improve later. It is an indicator based on several analyses and which would provide several indications. I am looking for someone who can develop on MT4 and Mt5, initially I would like to do it on mt4 and then on mt5. If you have expertise in pinescript it is a plus because I would like to
I urgently require swift assistance to convert a complex indicator into a fully functional scanner, capable of automatically sending real-time data, alerts, and notifications via email, ensuring seamless integration and prompt delivery of critical information to facilitate informed decision-making and timely action
I need to improve the code of an indicator that is too heavy and slow when running and when used with iCustom in an EA. No other changes to the indicator are requested: the original features of the indicator should remain as theay are. I'll provide the indicator after job acceptance. I request final source code mq5 file. Thank you Regards
I have a mt5 indicator that is working perfectly but I will like to make it an expert advisor to have an automated trade. I will be glad if I can get a well experienced developer to execute this project. Thanks
O TRABALHO CONSISTE NA MUDANÇA DO HISTOGRAMA DO INDICADOR TREDN DIRECTION AND FORCE DSEMA SMOOTHED PARA O HISTOGRAMA DA FOTO ANEXA, OBEDECENDO AS TRES CORES VERDE (UP, VERMELHOR(DOWN) E CINZA(TREND). O MESMO TEM QUE ODECER O MESMO CALCULO E COLORIR DA MESMA FORMA POREM COM HISTOGRAMA DDE FORMATO DIFERENTE

プロジェクト情報

予算
30+ USD
VAT(付加価値税) (24%): 7.2 USD
合計: 37.2 USD
開発者用
27 USD