Zzz

MQL5 Эксперты

Техническое задание

// กำหนดค่าตัวแปรพื้นฐาน
input double lotSize = 0.1;        // ขนาดล็อตที่ต้องการ
input int takeProfit = 50;         // ระยะ Take Profit (จุด)
input int stopLoss = 50;           // ระยะ Stop Loss (จุด)
input int magicNumber = 123456;    // หมายเลข Magic Number
input int smaPeriod = 14;          // ช่วงเวลา Simple Moving Average (SMA)

// เวลาที่ออเดอร์ล่าสุดถูกเปิด
datetime lastOrderTime = 0;

// ฟังก์ชั่นหลักของ EA
void OnTick()
{
   // ตรวจสอบว่าผ่านไปมากกว่า 10 นาทีหรือยัง
   if (TimeCurrent() - lastOrderTime >= 600)  // 600 วินาที = 10 นาที
   {
      // ตรวจสอบสัญญาณ Buy หรือ Sell
      if (SignalBuy())
      {
         // เปิดออเดอร์ Buy
         OpenOrder(ORDER_TYPE_BUY);
      }
      else if (SignalSell())
      {
         // เปิดออเดอร์ Sell
         OpenOrder(ORDER_TYPE_SELL);
      }
      
      // บันทึกเวลาที่เปิดออเดอร์ล่าสุด
      lastOrderTime = TimeCurrent();
   }
}

// ฟังก์ชั่นเปิดออเดอร์ Buy หรือ Sell
void OpenOrder(int orderType)
{
   double price = (orderType == ORDER_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_ASK) : SymbolInfoDouble(_Symbol, SYMBOL_BID);
   double sl = (orderType == ORDER_TYPE_BUY) ? price - stopLoss * _Point : price + stopLoss * _Point;
   double tp = (orderType == ORDER_TYPE_BUY) ? price + takeProfit * _Point : price - takeProfit * _Point;

   // สร้างคำสั่งซื้อขาย
   MqlTradeRequest request;
   MqlTradeResult result;
   
   // กำหนดค่าของคำสั่ง
   request.action = TRADE_ACTION_DEAL;
   request.symbol = _Symbol;
   request.volume = lotSize;
   request.type = orderType;
   request.price = price;
   request.sl = sl;
   request.tp = tp;
   request.deviation = 3;
   request.magic = magicNumber;

   // ส่งคำสั่ง
   OrderSend(request, result);

   // ตรวจสอบผลลัพธ์
   if (result.retcode != TRADE_RETCODE_DONE)
   {
      Print("Error opening order: ", result.retcode);
   }
}

// ฟังก์ชั่นตรวจสอบสัญญาณ Buy (ใช้ SMA)
bool SignalBuy()
{
   double sma = iMA(_Symbol, 0, smaPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
   double priceClose = Close[0];  // ราคาปิดปัจจุบัน
   
   // ถ้าราคาปิดปัจจุบันสูงกว่าเส้น SMA -> ส่งสัญญาณ Buy
   return (priceClose > sma);
}

// ฟังก์ชั่นตรวจสอบสัญญาณ Sell (ใช้ SMA)
bool SignalSell()
{
   double sma = iMA(_Symbol, 0, smaPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
   double priceClose = Close[0];  // ราคาปิดปัจจุบัน
   
   // ถ้าราคาปิดปัจจุบันต่ำกว่าเส้น SMA -> ส่งสัญญาณ Sell
   return (priceClose < sma);
}

Откликнулись

1
Разработчик 1
Оценка
(44)
Проекты
62
52%
Арбитраж
3
0% / 0%
Просрочено
1
2%
Свободен
2
Разработчик 2
Оценка
(133)
Проекты
174
18%
Арбитраж
17
47% / 18%
Просрочено
0
Свободен
3
Разработчик 3
Оценка
(316)
Проекты
400
21%
Арбитраж
44
61% / 23%
Просрочено
46
12%
Работает
Похожие заказы
Hi I'm looking to have 2 of my pinescript strategies converted to MQL5 and was wondering if you could first give me a quote for the more simple strategy and then for both the simple and complex strategy together. The simple strategy is a MACD crossover type thing that uses a special EMA script that filters out some ranging price action and also fractal candles for the stop loss. The second strategy is market
I want grate robot for making profits that know when to start a good trade and close a trade and must be active all time to avoid lost of money
I have developed a very strong TradingView strategy in Pine Script but unfortunately, a third-party connector is requiired and in my opinion, I want a more direct connection. I am not brilliant at coding, but I have coded the majority of the MT5 code and I would like you to make sure that the MT5 code matches my TradingView script and executes the same way as the TradingView script that I will provide if you are
Mbeje fx 50+ USD
I like to own my robot that why I want to build my own.i like to be a best to every robot ever in the life to be have more money
I need an MT5 EA that can do the following: I have to give the EA a price in advance, when the price is reached the EA has to automatically place a buy stop or sell stop order 0.5 pips below or above the price. Is this possible
Dr Pattern 30+ USD
good day i need the service of the seaso coder to help me fix my ea The Job required 1 knowledge of Mt4 and Mt5 indicator coding 2. Telegram code 3. ability to code indicator to work on multiple Time frame combine to trade 4 Ability to Join two or three indicator on same ir different time frame if you have these skill please let chart i will discuss the details of the Job inside to you The required day including
Good day, I want someone to help me create a universal news filter with on/off switch, with start and end settings, and drawdown control with magic number of EAs, etc. Thanks
Hello, I am looking for a professional programmer to optimize my existing EA integrating it with ChatGPT to analyze currencies using various methods to make the right trading decisions. i want it to be an EA that can be trusted to carry trade with the help of chat gpt and also have a very low drawdown
Hello, I am looking for a professional programmer to create a trading expert on the MT4 platform, integrating it with ChatGPT to analyze currencies using various methods to make the right trading decisions. Further details will be provided to the applicants later
I have developed a very strong TradingView strategy in Pine Script but unfortunately, a third-party connector is requiired and in my opinion, I want a more direct connection. I am not brilliant at coding, but I have coded the majority of the MT5 code and I would like you to make sure that the MT5 code matches my TradingView script and executes the same way as the TradingView script that I will provide if you are

Информация о проекте

Бюджет
30+ USD

Заказчик

Размещено заказов1
Количество арбитражей0