Delice Bot

MQL5 Experts

Specification

//+------------------------------------------------------------------+
//| HFT Scalper - Base Pro |
//+------------------------------------------------------------------+
input double LotSize = 0.01;
input int MaxSpreadPoints = 80; // 0.8 pip
input int FastEMA = 20;
input int SlowEMA = 200;
input int RSI_Period = 14;

int handle_fast, handle_slow, handle_rsi;

int OnInit(){
   handle_fast = iMA(_Symbol, PERIOD_M1, FastEMA, 0, MODE_EMA, PRICE_CLOSE);
   handle_slow = iMA(_Symbol, PERIOD_M1, SlowEMA, 0, MODE_EMA, PRICE_CLOSE);
   handle_rsi = iRSI(_Symbol, PERIOD_M1, RSI_Period, PRICE_CLOSE);
   return(INIT_SUCCEEDED);
}

void OnTick(){
   // 1. FILTRE SPREAD HFT
   long spread = SymbolInfoInteger(_Symbol, SYMBOL_SPREAD);
   if(spread > MaxSpreadPoints) return;

   // 2. FILTRE NEWS - ne trade pas si volatilité extrême (exemple simple)
   double atr[];
   // tu peux ajouter iATR pour filtrer

   // 3. SIGNAL TENDANCE
   double ema_fast[1], ema_slow[1], rsi[1];
   CopyBuffer(handle_fast, 0, 0, 1, ema_fast);
   CopyBuffer(handle_slow, 0, 0, 1, ema_slow);
   CopyBuffer(handle_rsi, 0, 0, 1, rsi);

   bool upTrend = ema_fast[0] > ema_slow[0] && rsi[0] > 50;
   bool downTrend = ema_fast[0] < ema_slow[0] && rsi[0] < 50;

   // 4. EXECUTION HFT - scalping de 5 pips
   if(upTrend && PositionsTotal() == 0){
      double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
      double sl = ask - 100 * _Point; // 10 pips SL
      double tp = ask + 50 * _Point; // 5 pips TP
      trade.Buy(LotSize, _Symbol, ask, sl, tp);
   }
   if(downTrend && PositionsTotal() == 0){
      double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
      double sl = bid + 100 * _Point;
      double tp = bid - 50 * _Point;
      trade.Sell(LotSize, _Symbol, bid, sl, tp);
   }import MetaTrader5 as mt5
import time
import pandas as pd

mt5.initialize()

SYMBOL = "EURUSD"
MAX_SPREAD = 0.00008 # 0.8 pip

def is_good_market():
    tick = mt5.symbol_info_tick(SYMBOL)
    spread = tick.ask - tick.bid
    if spread > MAX_SPREAD:
        print(f"Spread trop haut: {spread} - SKIP")
        return False
    return True

def get_trend():
    rates = mt5.copy_rates(SYMBOL, mt5.TIMEFRAME_M1, 0, 250)
    df = pd.DataFrame(rates)
    df['ema20'] = df['close'].ewm(span=20).mean()
    df['ema200'] = df['close'].ewm(span=200).mean()
    last = df.iloc[-1]
    return "BUY" if last['ema20'] > last['ema200'] else "SELL"

while True:
    if is_good_market():
        trend = get_trend()
        if trend == "BUY":
            request = {
                "action": mt5.TRADE_ACTION_DEAL,
                "symbol": SYMBOL,
                "volume": 0.01,
                "type": mt5.ORDER_TYPE_BUY,
                "price": mt5.symbol_info_tick(SYMBOL).ask,
                "sl": mt5.symbol_info_tick(SYMBOL).ask - 0.0010,
                "tp": mt5.symbol_info_tick(SYMBOL).ask + 0.0005,
                "deviation": 10,
            }
            mt5.order_send(request)
            time.sleep(60) # 1 trade par minute max - règle HFT retail
    time.sleep(0.1) # check chaque 100ms
}

Files:

Responded

1
Developer 1
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free

Project information

Budget
30+ USD
Deadline
from 1 to 50 day(s)

Customer

Placed orders2
Arbitrage count0