Spécifications
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()
Répondu
1
Évaluation
Projets
552
41%
Arbitrage
30
57%
/
3%
En retard
57
10%
Gratuit
Publié : 11 codes
2
Évaluation
Projets
403
28%
Arbitrage
40
40%
/
50%
En retard
1
0%
Gratuit
3
Évaluation
Projets
512
19%
Arbitrage
33
45%
/
30%
En retard
34
7%
Occupé
4
Évaluation
Projets
24
8%
Arbitrage
9
33%
/
33%
En retard
1
4%
Chargé
5
Évaluation
Projets
460
26%
Arbitrage
140
20%
/
59%
En retard
100
22%
Travail
6
Évaluation
Projets
15
20%
Arbitrage
1
100%
/
0%
En retard
0
Gratuit
7
Évaluation
Projets
2
0%
Arbitrage
4
25%
/
50%
En retard
1
50%
Gratuit
8
Évaluation
Projets
3
33%
Arbitrage
2
0%
/
100%
En retard
0
Gratuit
9
Évaluation
Projets
9
22%
Arbitrage
0
En retard
0
Gratuit
10
Évaluation
Projets
36
33%
Arbitrage
5
0%
/
80%
En retard
0
Travail
Publié : 2 codes
11
Évaluation
Projets
559
35%
Arbitrage
80
31%
/
44%
En retard
203
36%
Gratuit
12
Évaluation
Projets
243
74%
Arbitrage
7
100%
/
0%
En retard
1
0%
Gratuit
Publié : 1 article
13
Évaluation
Projets
3
0%
Arbitrage
1
100%
/
0%
En retard
0
Gratuit
Commandes similaires
Project Overview We have a highly optimized, production-ready custom cTrader cBot built for a fast-paced Renko breakout strategy (specifically trading XAUUSD/Gold). The core system architecture, structural mapping, and breakout logic are flawless. We are seeking an expert C# algorithmic developer for a targeted engagement to refine the execution mechanics and add an advanced trade management module. This is not a
SNIPER X AI
30 - 200 USD
I really need a developer Who can help me to create my SNIPER X AI - Elite AI Trading System Overview SNIPER X AI BOT is an AI-assisted trading system for Forex, Crypto, Stocks, Indices, and Gold. Currency: USD,RAND,KWD, POUND,EURO Core Features AI Scalping, Sniper Entries, Auto Buy/Sell, Smart Risk Management, Telegram Alerts, Mobile Monitoring, VPS Deployment. Supported Platforms MetaTrader 4, MetaTrader 5, Exness
Emmanuel bot
30 USD
No thank you just choose for me I need to be automatically buy and sell and take a profit only that is enough for me thank you so much my name is Emmanuel kabale
Limzy
30+ USD
//+------------------------------------------------------------------+ //| HighPerformanceEA.mq5 | //| Copyright 2026, AI Developer | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026" #property link " https://www.mql5.com " #property version "1.00" #property strict //
I need an experienced MQL5 developer to build a professional XAUUSD scalping Expert Advisor. The trading logic is already fully defined and will be shared privately with selected developers. Requirements Fast execution suitable for scalping Dynamic lot sizing Strict risk management Clean and optimized MQL5 code Compatible with MetaTrader 5 Additional Rules No repainting logic No delayed execution Avoid duplicate
Prepare expert for xauusd live chart [ expert is not executing xauusd trades , just printing the logic on the chart ] . Deletion and cleaning code ( subject to if required ) . Integration of candles with present logic, Since expert is coming out from an arbitration subject : Before project start , review the code if it is clean and ready for the developer to continue with previous developer's technical debt -thereby
Hello, I am looking for an experienced developer who can build a professional EA suitable for long-term prop firm account passing and account management. I am NOT interested in risky strategies such as martingale, grid, or aggressive recovery systems. My main priorities are: very low and stable drawdown, strong and consistent risk management, strict news filter, long-term sustainability, realistic and stable monthly
Need a Profitable with a good trading system or strategy. would test the product first Looking for a professional MT5 Expert Advisor based on smart strategies. The EA should include session filters, risk management, trailing stop, multi-pair support, and low drawdown protection. I need a consistent, high-probability automated trading system optimized for long-term profitability and funded account compliance
Junior EA
30+ USD
1. EA for MT5, hedging allowed. 2. Entry: 50 EMA crosses 200 EMA on H1. Buy on bullish cross, sell on bearish. 3. SL: 100 pips, TP: 200 pips. No trailing stop. 4. Lot size: 0.01 fixed. Max 3 trades at once. 5. Trade only 08:00-18:00 GMT. No trades if spread > 20 points. 6. Inputs: EMA periods, SL, TP, lot size, start/end time
Semi Automated Gold Trading Signal System for MT5
300 - 800 USD
I need an experienced MQL5 developer to build a semi automated trading signal system for Gold (XAUUSD) on MT5. The system is NOT a martingale or grid EA. The goal is to build a clean rule based signal engine that detects high probability setups based on predefined strategy rules and sends trading alerts with optional pending order logic. Main Requirements: 1. Signal Generation - Buy and Sell signals - Buy Limit - Buy
Informations sur le projet
Budget
50 - 200 USD
Délais
de 7 à 10 jour(s)