Termos de Referência
import MetaTrader5 as mt5
import time
import pandas as pd
mt5.initialize()
SYMBOL = "EURUSD"
MAX_SPREAD = 0.00008 # 0.8 pip
def is_good_market():
tick = mt5.symbol_info_tick(SYMBOL)
spread = tick.ask - tick.bid
if spread > MAX_SPREAD:
print(f"Spread trop haut: {spread} - SKIP")
return False
return True
def get_trend():
rates = mt5.copy_rates(SYMBOL, mt5.TIMEFRAME_M1, 0, 250)
df = pd.DataFrame(rates)
df['ema20'] = df['close'].ewm(span=20).mean()
df['ema200'] = df['close'].ewm(span=200).mean()
last = df.iloc[-1]
return "BUY" if last['ema20'] > last['ema200'] else "SELL"
while True:
if is_good_market():
trend = get_trend()
if trend == "BUY":
request = {
"action": mt5.TRADE_ACTION_DEAL,
"symbol": SYMBOL,
"volume": 0.01,
"type": mt5.ORDER_TYPE_BUY,
"price": mt5.symbol_info_tick(SYMBOL).ask,
"sl": mt5.symbol_info_tick(SYMBOL).ask - 0.0010,
"tp": mt5.symbol_info_tick(SYMBOL).ask + 0.0005,
"deviation": 10,
}
mt5.order_send(request)
time.sleep(60) # 1 trade par minute max - règle HFT retail
time.sleep(0.1) # check chaque 100ms
Respondido
1
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
2
Classificação
Projetos
838
61%
Arbitragem
33
27%
/
45%
Expirado
24
3%
Livre
Publicou: 1 código
Pedidos semelhantes
Bonjour, Je recherche un développeur expérimenté en Python + MetaTrader5 pour créer un Bot Scanner. OBJECTIF DU BOT: Scanner n'importe quel graphique MT5 : Forex, Indices Synthétiques, Indices, Actions, Métaux, Crypto. Détecter uniquement des FIGURES CHARTISTES sans indicateur. Envoyer une alerte instantanée sur Telegram ou par mails avec : Paire, Timeframe, Nom de la Figure, fiabilité en % , Capture d'écran du
Informações sobre o projeto
Orçamento
35+ USD
Prazo
de 1 para 50 dias
Cliente
Pedidos postados2
Número de arbitragens0