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
555
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
513
19%
Arbitrage
35
43%
/
31%
En retard
34
7%
Chargé
4
Évaluation
Projets
25
8%
Arbitrage
9
33%
/
33%
En retard
1
4%
Chargé
5
Évaluation
Projets
462
26%
Arbitrage
139
20%
/
60%
En retard
100
22%
Gratuit
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
565
35%
Arbitrage
81
31%
/
44%
En retard
204
36%
Gratuit
12
Évaluation
Projets
246
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
# HIGH-FREQUENCY M5/M15 CONCURRENT ENTRY SNIPER import time class HighFrequencySniper: def __init__(self): self.target_profit = 25.00 # Targeted Delta Move self.max_execution_time = 3600 # 1 Hour Sandbox (Seconds) self.lot_allocation = "CALIBRATED_TO_RISK" def execute_hft_scan(self, current_price, m5_rsi, m15_order_block): print(f"[SCANNING] Current Kernel Metric: ${current_price:.2f}")
I need a trading bot, please i need this project urgently and when messaing me kindly send me samples of past works and dont forget i need the project to be done as soon as possible
If you have good Market structure indicators with buffer no repaint internal structure and external structure etc good market structure if you have then i already have ea you have to input into the indicator soy current ea opens position based on the market structure
*Need an MQL5 EA for MT5 to trade gold and forex automatically. Must include Stop Loss, Take Profit, and basic risk management. Budget is $30 to $50. Looking for clean, stable code that works on VPS.*
MT5 EA for XAUUSDm - Trend Grid with EMA+ATR+ADX (Non-Martingale) 【Strategy Summary】 - EMA(50) on H1 judges trend direction. 2 H1 closes to confirm crossover. - ADX(14) below 20 stops new orders. Existing orders still managed. - Parallel mode: 5 stop orders placed at once. Spacing = ATR(14)×1.5 (300-600 pts). - TP: 1 new order at furthest price + spacing. SL: no replacement. - Fixed SL 300pts. No fixed TP. Trailing
MT5 EA Development / Enhancement
50 - 100 USD
Hello Developers, I am looking for an experienced MQL5 developer to complete the development of a custom MetaTrader 5 Expert Advisor (EA) based on my proprietary trading strategy. I already have a partially developed EA that includes the required custom indicators and part of the trading logic. The project can either be completed by modifying the existing EA or, if more appropriate, by rebuilding it from scratch
Description: I need an experienced MQL5 developer to build a professional MT5 Expert Advisor for XAU/USD based on my trading strategy. I require the full .mq5 source code and the compiled file. Trading Logic: Timeframes: H4 to determine overall direction, H1 for supply and demand zones, M15 for trade entries. Buy conditions: H4 trend is bullish, price reaches a valid H1 demand zone, liquidity sweep occurs below the
WORKING EA
35+ USD
I Need an existing proven profitable EA. EA should have at least 3 months track record of consistency. My budget is $35 and nothing more. If you do not have the working EA for that amount, please do not apply. I'm not paying a dime more. Again do not apply if you are not willing to take the above amount
Standby Description . Prop Firm Environment . ( Monitor Execution and Handling Environment Changes as Required ) . Technical Issues . Delete extra lines of code (Clean Code , Folder) . Asset related translation , no need for Logic Alteration
Only Technical Issues . Familiarization to Different Symbols . [Again Technical Assistance Only] . Deleting extra lines of code , Not Required Folders (Clean Code) . No Need for Logic Alteration (Strictly)
Informations sur le projet
Budget
50 - 200 USD
Délais
de 7 à 10 jour(s)