CEESCALPTOR

Termos de Referência

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

Respondido

1
Desenvolvedor 1
Classificação
(393)
Projetos
547
40%
Arbitragem
30
57% / 3%
Expirado
57
10%
Trabalhando
Publicou: 11 códigos
2
Desenvolvedor 2
Classificação
(272)
Projetos
401
27%
Arbitragem
39
41% / 49%
Expirado
1
0%
Livre
3
Desenvolvedor 3
Classificação
(326)
Projetos
507
19%
Arbitragem
33
42% / 30%
Expirado
34
7%
Ocupado
4
Desenvolvedor 4
Classificação
(18)
Projetos
22
9%
Arbitragem
6
33% / 50%
Expirado
1
5%
Trabalhando
5
Desenvolvedor 5
Classificação
(250)
Projetos
460
26%
Arbitragem
140
20% / 59%
Expirado
100
22%
Trabalhando
6
Desenvolvedor 6
Classificação
(14)
Projetos
14
21%
Arbitragem
0
Expirado
0
Trabalhando
7
Desenvolvedor 7
Classificação
Projetos
2
0%
Arbitragem
4
25% / 50%
Expirado
1
50%
Livre
8
Desenvolvedor 8
Classificação
(4)
Projetos
3
33%
Arbitragem
2
0% / 100%
Expirado
0
Livre
9
Desenvolvedor 9
Classificação
(8)
Projetos
9
22%
Arbitragem
0
Expirado
0
Livre
10
Desenvolvedor 10
Classificação
(32)
Projetos
35
34%
Arbitragem
5
0% / 80%
Expirado
0
Trabalhando
Publicou: 2 códigos
11
Desenvolvedor 11
Classificação
(309)
Projetos
555
35%
Arbitragem
79
32% / 42%
Expirado
201
36%
Carregado
12
Desenvolvedor 12
Classificação
(77)
Projetos
243
74%
Arbitragem
7
100% / 0%
Expirado
1
0%
Livre
Publicou: 1 artigo
13
Desenvolvedor 13
Classificação
(2)
Projetos
3
0%
Arbitragem
1
100% / 0%
Expirado
0
Livre
Pedidos semelhantes
Hello, I am looking for an experienced MT5 (MetaTrader 5) developer to create a simple and reliable Forex trading EA. Broker: Skyriss Platform: MT5 Requirements: • EA should work only on Forex pairs (EURUSD, GBPUSD, USDJPY, USDCHF) • Around 1–2 trades per day is enough • Proper risk management with Stop Loss (SL) and Take Profit (TP) • Prefer low-risk trading with 0.01–0.03 lot depending on balance • No martingale or
Looking for an experienced MQL5 developer to optimise and backtest my Expert Advisor (EA). The full requirements and EA file will be shared once accepted. You should have solid experience with strategy testing in MetaTrader 5 and be comfortable working with custom EAs. If this sounds like something you can help with, feel free to reach out and we can get started Developers with no reviews and no projects will be
hello, please take a moment to review my project. It is for Quanttower. it is very detailed in the instructions. Thank you, Just let me know if you can do it and the whats the cost and timeframe
Key Requirements: Source Account: Connect to a Master account using Investor (Read-only) Password. Destination Account: Execute trades on a Live Slave account with full trading access. Currency Focus: The system must handle Currency Pairs accurately, including symbol mapping (e.g., EURUSD to EURUSD.m) between different brokers. Stealth Features: Remove/Disable all trade comments. Assign custom Magic Numbers to the
I need a developer to start robot from scratch based on existing EA that is running live. I do not have the source file as my previous coder did not give it to me. What I do have is the investor password which is running the EA from the coder side but not from my end. I like someone to monitor the account and re create the same system for me
Project Overview: I am looking for a highly experienced MetaTrader 4 (MQL4) developer to build a sophisticated automated trading system. This is not a standard grid bot; it requires complex trade management, dynamic exposure rebalancing, and a custom "Salami" liquidation module for partial loss mitigation . Key Features to Implement: Virtual Grid & Dynamic Trend: Price-action-based grid triggers without pending
We are looking for a professional developer or trader who already has a proven profitable EA or strategy based mainly on price action logic. Important requirements: No Martingale No Grid No Micro-scalping Avoid heavy indicator-based strategies Strategy should be based mainly on price behavior / market structure We are not looking for aggressive systems that promise unrealistic returns. Our focus is on stable
I run an ea it makes good profits bit that one bad grid blows up the account. I want an EA which runs parallel to it which can intelligently close bad trades or grids. It shouldn't close recoverable trades but close very bad entries and grids. It can even close with hedging. The goal recover max and also not blow up the account
I am looking for an expert MQL5 developer to build a high-precision Hedging System between two different MT5 brokers running on the same local PC. Core Objective: Execute opposite (inverse) trades between a Master and Slave account (e.g., Master BUY = Slave SELL, Master SELL = Slave BUY). The Challenge: Standard "Trade Copiers" are insufficient as they cannot prevent single-legged exposure when using manual trading
I want robot that can help me trade and make some money so that I can be able to learn from it while I'm still in depot account now.Is how it gonna help me with some money

Informações sobre o projeto

Orçamento
50 - 200 USD
Prazo
de 7 para 10 dias