CEESCALPTOR

Specification

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()

Responded

1
Developer 1
Rating
(392)
Projects
544
40%
Arbitration
30
57% / 3%
Overdue
57
10%
Free
Published: 11 codes
2
Developer 2
Rating
(269)
Projects
397
27%
Arbitration
38
39% / 50%
Overdue
1
0%
Working
3
Developer 3
Rating
(321)
Projects
499
19%
Arbitration
33
42% / 30%
Overdue
32
6%
Busy
4
Developer 4
Rating
(17)
Projects
21
10%
Arbitration
5
40% / 40%
Overdue
1
5%
Loaded
5
Developer 5
Rating
(250)
Projects
460
26%
Arbitration
140
20% / 59%
Overdue
100
22%
Working
6
Developer 6
Rating
(14)
Projects
14
21%
Arbitration
0
Overdue
0
Free
7
Developer 7
Rating
Projects
2
0%
Arbitration
4
25% / 50%
Overdue
1
50%
Free
8
Developer 8
Rating
(4)
Projects
3
33%
Arbitration
2
0% / 100%
Overdue
0
Free
9
Developer 9
Rating
(8)
Projects
9
22%
Arbitration
0
Overdue
0
Free
10
Developer 10
Rating
(32)
Projects
35
34%
Arbitration
5
0% / 80%
Overdue
0
Working
Published: 2 codes
11
Developer 11
Rating
(305)
Projects
548
35%
Arbitration
79
32% / 42%
Overdue
197
36%
Loaded
12
Developer 12
Rating
(77)
Projects
241
73%
Arbitration
7
100% / 0%
Overdue
1
0%
Free
13
Developer 13
Rating
(2)
Projects
3
0%
Arbitration
1
100% / 0%
Overdue
0
Free
Similar orders
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
PAIR : EURUSD ONLY TIMEFRAME: M1 SESSION:LONDON SESSION ONLY(CONFIGURABLE START / END TIME) TREND FILTER: - USE VWAP AS MAIN TREND FILTER - BUY ONLY WHEN PRICE IS ABOVE VWAP - SELL ONLY WHEN PRICEIS IS BELLOW VWAP STRUCTURE CONDITION : - TRADE ONLY AFTER A VALID BOS (BREAK OF STRUCTURE) - BOS MUST BE IN THE SAME DIRECTION AS VWAP TREND -IGNORE COUNTER-TREND BOS ENTERY CONDITION (ORDER BLOCK ): - AFTER BOS , WAIT FOR
I am looking for an experienced developer to create an automated trading bot on the Quantower platform based on my trading rules. The bot should execute trades automatically. Kindly bid for it if it is what you can code for me
MT5 Expert Advisor – XAUUSD Opening Range Breakout I am looking for an experienced MQL5 developer to build a robust MT5 Expert Advisor. STRATEGY DETAILS • Instrument: XAUUSD • Timeframe: M30 • Broker: Pepperstone (Spread Betting) • Trading days: Monday–Friday only OPENING RANGE • Opening range candle: 07:00 – 07:30 UK time • EA must automatically convert UK time to broker server time • Record OR High and OR Low from

Project information

Budget
50 - 200 USD
Deadline
from 7 to 10 day(s)