Tarea técnica
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()
Han respondido
1
Evaluación
Proyectos
544
40%
Arbitraje
30
57%
/
3%
Caducado
57
10%
Libre
Ha publicado: 11 ejemplos
2
Evaluación
Proyectos
397
27%
Arbitraje
38
39%
/
50%
Caducado
1
0%
Trabaja
3
Evaluación
Proyectos
499
19%
Arbitraje
33
42%
/
30%
Caducado
32
6%
Ocupado
4
Evaluación
Proyectos
21
10%
Arbitraje
5
40%
/
40%
Caducado
1
5%
Trabajando
5
Evaluación
Proyectos
460
26%
Arbitraje
140
20%
/
59%
Caducado
100
22%
Trabaja
6
Evaluación
Proyectos
14
21%
Arbitraje
0
Caducado
0
Libre
7
Evaluación
Proyectos
2
0%
Arbitraje
4
25%
/
50%
Caducado
1
50%
Libre
8
Evaluación
Proyectos
3
33%
Arbitraje
2
0%
/
100%
Caducado
0
Libre
9
Evaluación
Proyectos
9
22%
Arbitraje
0
Caducado
0
Libre
10
Evaluación
Proyectos
35
34%
Arbitraje
5
0%
/
80%
Caducado
0
Trabaja
Ha publicado: 2 ejemplos
11
Evaluación
Proyectos
548
35%
Arbitraje
79
32%
/
42%
Caducado
197
36%
Trabajando
12
Evaluación
Proyectos
241
73%
Arbitraje
7
100%
/
0%
Caducado
1
0%
Libre
13
Evaluación
Proyectos
3
0%
Arbitraje
1
100%
/
0%
Caducado
0
Libre
Solicitudes similares
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
Breakout EA with multiple otions
30+ USD
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 MT5 Developer
30 - 120 USD
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
Creating Automated Bot on Quantower
30 - 35 USD
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
Información sobre el proyecto
Presupuesto
50 - 200 USD
Plazo límite de ejecución
de 7 a 10 día(s)