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

import MetaTrader5 as mt5
import datetime
import time

# Configure your trading symbols and parameters
TRADING_SYMBOLS = ["EURUSD", "USDJPY"]
TRADE_VOLUME = 0.1
STOP_LOSS = 50  # in points
TAKE_PROFIT = 100  # in points

# Initialize connection to MetaTrader 5
if not mt5.initialize():
    print("Initialize() failed:", mt5.last_error())
    quit()

def get_current_symbols():
    now = datetime.datetime.now()
    # If it's Saturday or Sunday between 9am and 9pm, only trade EUR/USD and USD/JPY
    if now.weekday() == 5 or now.weekday() == 6:  # Saturday = 5, Sunday = 6
        if 9 <= now.hour < 21:
            return ["EURUSD", "USDJPY"]
    return TRADING_SYMBOLS

def get_position(symbol):
    positions = mt5.positions_get(symbol=symbol)
    return positions[0] if positions else None

def close_position(position):
    order_type = mt5.ORDER_TYPE_SELL if position.type == mt5.ORDER_TYPE_BUY else mt5.ORDER_TYPE_BUY
    close_request = {
        "action": mt5.TRADE_ACTION_DEAL,
        "symbol": position.symbol,
        "volume": position.volume,
        "type": order_type,
        "position": position.ticket,
        "price": mt5.symbol_info_tick(position.symbol).bid if order_type == mt5.ORDER_TYPE_BUY else mt5.symbol_info_tick(position.symbol).ask,
        "deviation": 20,
        "magic": 123456,
        "comment": "Auto close loss",
        "type_time": mt5.ORDER_TIME_GTC,
        "type_filling": mt5.ORDER_FILLING_IOC,
    }
    result = mt5.order_send(close_request)
    return result

def open_trade(symbol, order_type):
    price = mt5.symbol_info_tick(symbol).ask if order_type == mt5.ORDER_TYPE_BUY else mt5.symbol_info_tick(symbol).bid
    sl = price - STOP_LOSS * 0.0001 if order_type == mt5.ORDER_TYPE_BUY else price + STOP_LOSS * 0.0001
    tp = price + TAKE_PROFIT * 0.0001 if order_type == mt5.ORDER_TYPE_BUY else price - TAKE_PROFIT * 0.0001

    request = {
        "action": mt5.TRADE_ACTION_DEAL,
        "symbol": symbol,
        "volume": TRADE_VOLUME,
        "type": order_type,
        "price": price,
        "sl": sl,
        "tp": tp,
        "deviation": 20,
        "magic": 123456,
        "comment": "Auto trade",
        "type_time": mt5.ORDER_TIME_GTC,
        "type_filling": mt5.ORDER_FILLING_IOC,
    }

    result = mt5.order_send(request)
    return result

def simple_strategy(symbol):
    # Simple logic: open buy if price is above 50-MA
    rates = mt5.copy_rates_from_pos(symbol, mt5.TIMEFRAME_M5, 0, 100)
    if rates is None or len(rates) < 50:
        return

    closes = [bar.close for bar in rates]
    ma50 = sum(closes[-50:]) / 50
    last_close = closes[-1]

    position = get_position(symbol)

    if position:
        # Close if loss is more than X points
        profit = position.profit
        if profit < -10:  # Close if loss is more than $10
            print(f"Closing loss on {symbol}")
            close_position(position)
    else:
        if last_close > ma50:
            print(f"Opening BUY trade for {symbol}")
            open_trade(symbol, mt5.ORDER_TYPE_BUY)
        elif last_close < ma50:
            print(f"Opening SELL trade for {symbol}")
            open_trade(symbol, mt5.ORDER_TYPE_SELL)

def main_loop():
    try:
        while True:
            symbols = get_current_symbols()
            for symbol in symbols:
                simple_strategy(symbol)
            time.sleep(60)  # Wait 1 minute before checking again
    except KeyboardInterrupt:
        print("Bot stopped by user.")
    finally:
        mt5.shutdown()

if __name__ == "__main__":
    main_loop()

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

1
Разработчик 1
Оценка
(392)
Проекты
544
40%
Арбитраж
30
57% / 3%
Просрочено
57
10%
Свободен
Опубликовал: 11 примеров
2
Разработчик 2
Оценка
(269)
Проекты
397
27%
Арбитраж
38
39% / 50%
Просрочено
1
0%
Работает
3
Разработчик 3
Оценка
(321)
Проекты
499
19%
Арбитраж
33
42% / 30%
Просрочено
32
6%
Занят
4
Разработчик 4
Оценка
(17)
Проекты
21
10%
Арбитраж
5
40% / 40%
Просрочено
1
5%
Загружен
5
Разработчик 5
Оценка
(250)
Проекты
460
26%
Арбитраж
140
20% / 59%
Просрочено
100
22%
Работает
6
Разработчик 6
Оценка
(14)
Проекты
14
21%
Арбитраж
0
Просрочено
0
Свободен
7
Разработчик 7
Оценка
Проекты
2
0%
Арбитраж
4
25% / 50%
Просрочено
1
50%
Свободен
8
Разработчик 8
Оценка
(4)
Проекты
3
33%
Арбитраж
2
0% / 100%
Просрочено
0
Свободен
9
Разработчик 9
Оценка
(8)
Проекты
9
22%
Арбитраж
0
Просрочено
0
Свободен
10
Разработчик 10
Оценка
(32)
Проекты
35
34%
Арбитраж
5
0% / 80%
Просрочено
0
Работает
Опубликовал: 2 примера
11
Разработчик 11
Оценка
(305)
Проекты
548
35%
Арбитраж
79
32% / 42%
Просрочено
197
36%
Загружен
12
Разработчик 12
Оценка
(77)
Проекты
241
73%
Арбитраж
7
100% / 0%
Просрочено
1
0%
Свободен
13
Разработчик 13
Оценка
(2)
Проекты
3
0%
Арбитраж
1
100% / 0%
Просрочено
0
Свободен
Похожие заказы
Budget: [100$ - 200$] I need an experienced MQL5 developer to optimize my existing auto-trading EA and integrate manual trading capabilities from a second EA. The goal is to create a complete EA that combines automated signal-based trading with full manual control. Two reference codes are attached for review before bidding: Code 1 ( 1 Auto Trade.mq5) : Auto-trading EA (main codebase - needs optimization) Code 2 (
Hello, I am looking for an experienced MT5 (MQL5) developer to review, test, and validate an existing Expert Advisor. The EA is already developed. The requirement is analysis, debugging, and refinement , not a full rewrite. Scope of Work Review entry and exit execution Validate hedging behavior (ON vs OFF) Review support/resistance handling and trade triggering Identify logic mismatches between expected vs actual
My EA, based on the Ultimate Renko indicator created by Artur Zas, is no longer working. I am not sure if it's my computer or the latest version of MetaTrader, but I need help running the EA (16 errors need to be corrected). I will send you the EA source code, and after corrections, you will send me the corrected source code. Please do not apply if you do not have the package (Renko-GenX) and the UltimateRenko
EA Development mentor 30 - 40 USD
am looking for a Mentor that has verifiable experience trading forex and commodities. Somebody who has a couple years experience in failures and successes. I am not a beginner. I have modest success already with discretionary trading. I have had an EA created that is very promising. It has extensive testing with very good results. The idea would be to work together advancing the existing EA and build additional EA's
Existing EA 30 USD
I’m looking to acquire an existing, profitable Expert Advisor (EA) with full source code to add to our client investment portfolio. To be clear, this is not a request to develop or design a new strategy. If you already have an EA that is proven, consistent, and production-ready, I’m open to reviewing it immediately. Please apply only if you meet all the requirements below. Submissions without a proper introduction or
Need to create an MT5 EA based on break out strategy. This will be all in one EA including daily breakout, hourly breakout, support and resistance breakout, pivot breakout, super trend break out, moving average breakout. Extra features include TP, SL, breakeven, notifications, dashboard
Looking for an MT5 developer to build an automated trading bot that executes trades based on indicator signals. The bot should support flexible inputs, work across Forex, commodities, and crypto, and allow basic configuration options. If you're experienced with MT5 EAs and indicator integration, please reach out
🔹 Project Description I need a very simple MT4 (MQL4) Expert Advisor to be used on a DEMO account . Main Purpose: When enabled, the EA must prevent opening any NEW trades , while allowing existing open trades to be managed and closed normally . Required Behavior: Do NOT close any open trades. Do NOT modify TP or SL. Prevent opening of: New initial trades New trade cycles Existing trades must continue until they
Salom, Menda allaqachon ishlaydigan MQL5 ekspert maslahatchisi bor . EA to'liq ishlaydi , savdolarni to'g'ri ochadi va boshqaradi hamda qat'iy qoidalarga asoslangan mantiqqa amal qiladi . Men noldan yangi EA yaratmoqchi emasman . 🔹 Allaqachon bajarilgan ishlar: EA MQL5 da yozilgan Strategiya mantig'i to'liq va barqaror Kundalik zona mantig'i to'g'ri ishlaydi Keyingi M5 shamida yozuv bajariladi O'zgartirish (teskari)
I want a reliable and broker-independent copy-trading solution that copies trades from a master MT5 account to multiple MT4 and/or MT5 client accounts. The system is designed for stable live trading and works with any broker, handling common differences in symbols, pricing, and execution. The copier supports full trade synchronization, including trade opening, closing, partial closes, and SL/TP modifications, with

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

Бюджет
50 - 200 USD
Сроки выполнения
от 7 до 10 дн.