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

//+------------------------------------------------------------------+
//| Scalping_M5_Bot.mq5 |
//| Copyright 2026, MQL5 Freelance |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026"
#property link "https://www.mql5.com"
#property version "1.00"
#include <Trade\Trade.mqh>
CTrade trade;
//--- Paramètres d'entrée
input double InpLotSize = 0.1; // Taille du lot
input int InpTakeProfit = 20; // Take Profit en points
input int InpStopLoss = 15; // Stop Loss en points
input int InpRSI_Period = 14; // Période RSI
//--- Variables globales
int rsiHandle;
datetime lastBarTime;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
rsiHandle = iRSI(_Symbol, PERIOD_M5, InpRSI_Period, PRICE_CLOSE);
if(rsiHandle == INVALID_HANDLE)
{
Print("Erreur lors de la création de l'indicateur RSI.");
return(INIT_FAILED);
}
lastBarTime = 0;
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
IndicatorRelease(rsiHandle);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Vérifier la nouvelle bougie M5
datetime currentBarTime = iTime(_Symbol, PERIOD_M5, 0);
if(currentBarTime == lastBarTime) return;
double rsiValues[];
ArraySetAsSeries(rsiValues, true);
if(CopyBuffer(rsiHandle, 0, 0, 2, rsiValues) <= 0) return;
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
// Condition d'achat (RSI survendu < 30)
if(rsiValues[0] < 30 && PositionsTotal() == 0)
{
double sl = bid - InpStopLoss * _Point;
double tp = ask + InpTakeProfit * _Point;
trade.Buy(InpLotSize, _Symbol, ask, sl, tp, "Scalping M5 Buy");
lastBarTime = currentBarTime;
}
// Condition de vente (RSI suracheté > 70)
if(rsiValues[0] > 70 && PositionsTotal() == 0)
{
double sl = ask + InpStopLoss * _Point;
double tp = bid - InpTakeProfit * _Point;
trade.Sell(InpLotSize, _Symbol, bid, sl, tp, "Scalping M5 Sell");
lastBarTime = currentBarTime;
}
}

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

Бюджет
30 - 70 USD
Сроки выполнения
от 1 до 15 дн.

Заказчик

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