Specification

import pandas as pd
import numpy as np

def generate_signals(data):
    signals = pd.DataFrame(index=data.index)
    signals['price'] = data['Close']
    
    # Calculate moving averages
    signals['short_ma'] = data['Close'].rolling(window=20, min_periods=1).mean()
    signals['long_ma'] = data['Close'].rolling(window=50, min_periods=1).mean()
    
    # Generate buy signals
    signals['buy_signal'] = np.where(signals['short_ma'] > signals['long_ma'], 1, 0)
    
    # Generate sell signals
    signals['sell_signal'] = np.where(signals['short_ma'] < signals['long_ma'], -1, 0)
    
    return signals

def backtest_strategy(signals, initial_capital=10000):
    positions = pd.DataFrame(index=signals.index).fillna(0.0)
    positions['asset'] = 1000 * signals['buy_signal'] + -1000 * signals['sell_signal']
    
    # Calculate portfolio value
    portfolio = positions.multiply(signals['price'], axis=0)
    pos_diff = positions.diff()
    portfolio['holdings'] = (positions.multiply(signals['price'], axis=0)).sum(axis=1)
    portfolio['cash'] = initial_capital - (pos_diff.multiply(signals['price'], axis=0)).sum(axis=1).cumsum()
    portfolio['total'] = portfolio['cash'] + portfolio['holdings']
    portfolio['returns'] = portfolio['total'].pct_change()
    
    return portfolio

# Example usage:
# Assuming 'data' is a DataFrame containing historical price data with 'Date' as index and 'Close' as a column
# signals = generate_signals(data)
# portfolio = backtest_strategy(signals)
# print(portfolio.tail())

Responded

1
Developer 1
Rating
(279)
Projects
378
72%
Arbitration
19
32% / 47%
Overdue
16
4%
Free
Published: 15 codes
2
Developer 2
Rating
(252)
Projects
462
26%
Arbitration
139
20% / 60%
Overdue
100
22%
Free
3
Developer 3
Rating
(298)
Projects
478
40%
Arbitration
105
40% / 24%
Overdue
82
17%
Loaded
Published: 2 codes
Similar orders
Require an EA that opens trades at preselected RSI values. The EA will then monitor the gain/loss of the open positions and close them as specified in terms of points gain/loss. Once a position closes, the action will trigger the opening of other positions as specified
Look at this chart. The ellipses that I have identified show reversals and liquidity was I am trying to find a good way to identify these areas an indicator that automatically detects the sweep and reversal Look at this chart. The ellipses that I have identified show reversals and liquidity was
Ich möchte einen professionellen Expert Advisor (EA) für MetaTrader 5 entwickeln lassen, der sich funktional am ThunderGold Scalper orientiert. Instrument: XAUUSD / GOLD Zeitrahmen: M15 Plattform: MetaTrader 5 / MQL5 Der EA soll eine eigene, nachprogrammierte Strategie verwenden und keine geschützten Quellcodes oder proprietären Dateien des Originalprodukts kopieren. Gewünschte Funktionen: automatischer Handel auf
I need a fully automated Expert Advisor (EA) written in MQL5 for MetaTrader 5. The EA must work directly inside MT5 and must NOT require TradingView, PineConnector, webhooks, or another external connector to place trades. Trading Instrument Primary symbol: XAGUSD (Silver) My broker may display the symbol as XAGUSD-ECN, so the EA should work with the broker’s available XAGUSD symbol. Main entry timeframe: 5-minute
Hi, I am looking for a profitable manual strategy for trading in forex, no bot no EA , only EA. I want to make good profit.If any one has please let me know, i will test it and if satisfied only i will make the payment. Regards
RECHERCHE DÉVELOPPEUR MQL5 — PARTENARIAT 50/50 Objectif : développer un EA de trading automatisé en 11 jours maximum pour participer à plusieurs concours de trading démo. Je recherche un développeur MQL5 expérimenté, capable de développer, tester et optimiser un EA proprement, avec une vraie maîtrise de la gestion du risque. CONCOURS VISÉS 🥇 XM — Weekly Demo Contest - Concours récurrent - Prize pool annoncé : 25 000
GoldTrade EA 89+ USD
//+------------------------------------------------------------------+ //| XAUUSD Wolfe + SMC Quick Profit EA | //| MT5 / MQL5 | //+------------------------------------------------------------------+ #property strict #include <Trade/Trade.mqh> CTrade trade; //================================================================== // INPUTS //================================================================== //--- General
can you help me with I have an indicator that I built and I work with PickMyTrade. The entries come through the alerts I get from Trading View . Trading View needs to send an alert and PickMyTrade executes a trade at that exact same second. Now, I have a problem in Trading View with the synchronization between the alert and the signal. I have a box that I built for a trade. It needs to output the box and get an
Buying profitable EA Budget up to 1.5k (Serious offer) Specification EN I will pay 1.5k (negotiable) for an EA for existing MT4 that generates a minimum of 5% or higher a month consistently no monthly DD more than 5% on ,5k account Please send demo version with optimal settings so I can test, if it performs in a strategy tester i will also need option to forward test it in a demo account. Developer should be willing
I need an MT4 Expert Advisor (MQL4). 1. Open one Buy and one Sell trade simultaneously. 2. Adjustable lot size (default 0.01). 3. Stop Loss on both trades. 4. If one trade hits Stop Loss: - Do not open a replacement trade. - Leave the remaining trade open. 5. Optional trailing stop: - On/Off switch. - Adjustable distance. 6. When the remaining trade closes: - Open a new Buy and Sell pair. - Repeat continuously

Project information

Budget
30 - 50 USD
Deadline
from 1 to 14 day(s)