İş Gereklilikleri

import MetaTrader5 as mt5
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from backtrader import Cerebro

# Connect to MetaTrader 5
mt5.initialize()

# Function to fetch historical data from MT5
def get_historical_data(symbol, timeframe, num_bars):
    rates = mt5.copy_rates_from_pos(symbol, timeframe, 0, num_bars)
    df = pd.DataFrame(rates)
    df['time'] = pd.to_datetime(df['time'], unit='s')
    return df

# Fetch XAUUSD data
symbol = "XAUUSD"
data = get_historical_data(symbol, mt5.TIMEFRAME_M1, 10000)

# Prepare features for the AI model
X = np.array([data['open'], data['close'], data['high'], data['low']]).T
y = np.array([1 if data['close'][i] > data['open'][i] else 0 for i in range(len(data))])

# Split data for AI model
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# Train a Random Forest model
model = RandomForestClassifier()
model.fit(X_train, y_train)

# Make predictions on test data
predictions = model.predict(X_test)

# Add Moving Average Strategy to DataFrame (EMA12 and EMA26)
data['EMA_12'] = data['close'].ewm(span=12, adjust=False).mean()
data['EMA_26'] = data['close'].ewm(span=26, adjust=False).mean()
data['Signal'] = np.where(data['EMA_12'] > data['EMA_26'], 1, -1)

# Risk management (stop loss, take profit)
def place_trade(symbol, order_type, volume, stop_loss, take_profit):
    ask_price = mt5.symbol_info_tick(symbol).ask
    bid_price = mt5.symbol_info_tick(symbol).bid
    if order_type == "buy":
        mt5.order_send(symbol=symbol, action=mt5.TRADE_ACTION_DEAL, order_type=mt5.ORDER_TYPE_BUY, volume=volume, price=ask_price, sl=stop_loss, tp=take_profit)
    elif order_type == "sell":
        mt5.order_send(symbol=symbol, action=mt5.TRADE_ACTION_DEAL, order_type=mt5.ORDER_TYPE_SELL, volume=volume, price=bid_price, sl=stop_loss, tp=take_profit)

# Example trade (modify parameters as needed)
place_trade(symbol, "buy", 0.1, 5, 10)

# Backtesting Setup with Backtrader
class MyStrategy(bt.Strategy):
    def __init__(self):
        self.ema12 = bt.indicators.ExponentialMovingAverage(self.data.close, period=12)
        self.ema26 = bt.indicators.ExponentialMovingAverage(self.data.close, period=26)

    def next(self):
        if self.ema12 > self.ema26:
            self.buy(size=1)
        elif self.ema12 < self.ema26:
            self.sell(size=1)

# Backtest function
def run_backtest(data):
    cerebro = Cerebro()
    cerebro.addstrategy(MyStrategy)
    # Add your data feed here
    cerebro.run()

# Convert MT5 data to Backtrader data feed format if needed
# run_backtest(data)

# Shutdown MT5 connection
mt5.shutdown()

Yanıtlandı

1
Geliştirici 1
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
2
Geliştirici 2
Derecelendirme
(2)
Projeler
5
0%
Arabuluculuk
3
0% / 100%
Süresi dolmuş
3
60%
Serbest
3
Geliştirici 3
Derecelendirme
(11)
Projeler
26
27%
Arabuluculuk
3
0% / 0%
Süresi dolmuş
1
4%
Yüklendi
Benzer siparişler
MODIFY EXPERT ADVISOR TO FILTER-OUT TRADES IN CHOPPY MARKET CONDITIONS AND ADD NEW COURSE OF ACTION TO ANALYSE MARKETS CONDITIONS. POTENTIAL BUY OR SELL MUST ONLY BE ACTIVATED AFTER XXX NUMBER OF PIPS AWAY FROM RANGE TRADE DETECTION AND PREVENTION LINE, AND TRADE ENTRIES WILL BE WITH BETTER CONDITIONS THAT WILL BE PROVIDED
I'm planning on building/creating an mt4/5 trading indicator that use a break and retest strategy I will share a link for the idea strategy, Kindly message me to send you the link, I can't send it here
in this document i have explained the EA requirements in details and given some pictures of needed options . please Grid EA expert apply to my job . and do not come with no experience. https://docs.google.com/document/d/1Y_Vbv87Ep5BQavRxgDlsWT7GH5VjSgVDnm6C1wtVtj0/edit?usp=sharing i can pay 30 USD now but later on if EA get successful . i'll gift with tip of 50 USD after successful month
Must speak English exceptionally well without translator Must read English exceptionally well without translator Must write English exceptionally well without converting text to English Must know mql5 Must be COMPLETELY FREE with NO jobs IF YOU CAN NOT ADJUST CODE WITHOUT REWITNG, THEN DONOT TAKE THIS JOB! All you are doing is removing a few conditions and adding new ones. That's it. This job is for MT5 expert
I am seeking a custom trading robot/EA for MetaTrader 5, based on a proprietary strategy utilizing various technical indicators. Indicators: Vigor XProfuter/Maxwell's Equation Indicator Heiken Ashi Candlesticks Please ensure the trading robot/EA is fully functional, reliable, and compatible with MetaTrader 5. Additionally, clear documentation and support for any adjustments or optimizations in the future would be
I Need An Expert Advisor That Creates Multiple Buy Stop, Buy Limit, Sell Stop And Sell Limit Orders Automatically for example if price reach 2659.22 enter auto buy stop with auto tp and sl
I need an indicator like the one of the two photos that print on current candle 0, or pre alert 60% win rate minimum for mt5 or 4 I would like too trail until Friday as this is when I get paid pls
An Indicator is already developed in Ami Broker AFL and needs to be Converted and further developed in a Trading strategy / EA / Auto Trade BOT on MQL5. Project will be in 3 Phases. Phase 1 - Indicator Development Phase 2 - Entry / TGT / SL Order Development. Phase 3 - Hedging / Reverse Trade Mechanism
Nt8 30+ USD
i'm searching a way to define which IP address is using by NT8 cause i'm using a multiple IPs machine (for my daily job) and I'd need to have a further confirmation that I'm using the correct IP address with NT8 could anyone explain explain me how to do it for a fee
I need a developer with FxDreema experience to build an MT5 EA that: Manages recovery zones with pending buy/sell orders. Implements trailing stops, pre-defined profit lines, and dynamic lot sizing. Supports money management based on account balance and lot size and money value. Offers options for continuous or stop trading. The developer must provide the source code and FxDreema link . More specific details will be

Proje bilgisi

Bütçe
50 - 500 USD

Müşteri

Verilmiş siparişler1
Arabuluculuk sayısı0