Spécifications

# Import necessary libraries
import pandas as pd

# Define parameters
stop_loss_percentage = 0.02  # Set stop loss percentage (2% in this example)
take_profit_percentage = 0.05  # Set take profit percentage (5% in this example)

# Read historical price data
df = pd.read_csv("historical_data.csv")  # Replace with your historical data file or API integration

# Calculate moving averages
df['SMA_50'] = df['Close'].rolling(window=50).mean()
df['SMA_200'] = df['Close'].rolling(window=200).mean()

# Initialize variables
position = None
entry_price = 0.0

# Start trading loop
for i in range(200, len(df)):
    current_price = df['Close'].iloc[i]

    # Check for entry conditions
    if position is None and df['SMA_50'].iloc[i] > df['SMA_200'].iloc[i]:
        position = 'long'
        entry_price = current_price
        print(f"Enter long position at {entry_price}")

    elif position is None and df['SMA_50'].iloc[i] < df['SMA_200'].iloc[i]:
        position = 'short'
        entry_price = current_price
        print(f"Enter short position at {entry_price}")

    # Check for exit conditions
    if position == 'long' and current_price >= (1 + take_profit_percentage) * entry_price:
        position = None
        exit_price = current_price
        print(f"Exit long position at {exit_price}")
        profit = exit_price - entry_price
        print(f"Profit: {profit}")

    elif position == 'long' and current_price <= (1 - stop_loss_percentage) * entry_price:
        position = None
        exit_price = current_price
        print(f"Exit long position at {exit_price}")
        loss = exit_price - entry_price
        print(f"Loss: {loss}")

    elif position == 'short' and current_price <= (1 - take_profit_percentage) * entry_price:
        position = None
        exit_price = current_price
        print(f"Exit short position at {exit_price}")
        profit = entry_price - exit_price
        print(f"Profit: {profit}")

    elif position == 'short' and current_price >= (1 + stop_loss_percentage) * entry_price:
        position = None
        exit_price = current_price
        print(f"Exit short position at {exit_price}")
        loss = entry_price - exit_price
        print(f"Loss: {loss}")

Répondu

1
Développeur 1
Évaluation
(2)
Projets
2
0%
Arbitrage
1
0% / 0%
En retard
2
100%
Gratuit
2
Développeur 2
Évaluation
(43)
Projets
66
12%
Arbitrage
12
58% / 42%
En retard
1
2%
Gratuit
3
Développeur 3
Évaluation
(35)
Projets
50
42%
Arbitrage
3
33% / 33%
En retard
4
8%
Gratuit
4
Développeur 4
Évaluation
(6)
Projets
10
50%
Arbitrage
6
17% / 50%
En retard
3
30%
Travail
5
Développeur 5
Évaluation
(5)
Projets
4
50%
Arbitrage
4
0% / 75%
En retard
0
Gratuit
Commandes similaires
Range detector 30+ USD
dear coders I am looking for range detector to be implemented on my indicator, if you have please send me a demo for review. I have read the Rules of using the Freelance service and accept them. I agree with the fact that the service Administration has the right to suspend, forcibly complete or cancel my job due to the arbitration decision. I also confirm that I have read the following articles: regards
I am looking for developer who can create custom price alert indicator for MT5. The function of alerts in MT5 is fine but it does not allow setting custom sounds for specific charts with ease. For example, one can attach custom sound to new price alert, but if you use a lot of alerts daily (which i do) and want to have each ticker/pair to have its own sound alerts it gets too time consuming. I am looking for
i want help on puting my ea in mql5 for sale, help for 10percentage on every sales a higher profit scalper on gold 5minute trader non martingale none hedging mt4 version
Alphapipfx 30+ USD
Sniper Strategy EA -Presicion Forex Trading Bot for MT4 and MT5 Sniper Strategy EA is a fully automated Expert Advisor that executes high-probability forex trades using EMA 50/200 trend detection, RSI 14 momentum filtering, and automatic Support and Resistance zone identification. This bot does not chase price — it waits for price to come to key levels and confirms with multiple indicators before entering, just like
We are looking for a Prop Firm Operations & Technology Manager to help us creating our risk and technology infrastructure for our new prop firm. This is a key role for someone who understands both trading infrastructure and day-to-day prop firm operations . You will be responsible for managing the systems, platforms, configurations, and workflows that keep the firm running smoothly, while also helping us scale
I already have an MT5 trading bot called Omega Bot and I am looking for a marketer / seller who can help me find real buyers. Commission: 100 USD per successful sale Bot details: - MT5 only - Gold and Silver - M15 - ORB strategy - Asia and New York sessions - Automatic risk management - Break-even - Trailing stop - Spread filter - Beginner friendly - Ready settings file - Trial version available - Support after sale
I want to find a Developer to perform this work and settle payments in this Application. I undertake not to communicate with Applicants anywhere else except this Application, including third-party
Hi guys I’m looking for a coder who’s experienced in one script. The candidate must be familiar with fractals and self similarity. If you can’t code self similarity, please don’t bother contacting me ( respectfully). I just don’t want us to waste each others time. My budget is 100$. If that’s too low for you please, don’t contact me. Only contact me if you can code self similarity and can accept 100$. I will provide
Looking to acquire a good MT5 based EA that works on Gold, forex pairs or BTC. Must be suitable for current market conditions and profitable in backtests. Suitable on 1 Min timeframe to be used on, Must be actively opening many positions throughout the day. Share me the details if this matches something you have or developed. Looking to get this finalised within the weekend
I am looking for an experienced MQL5 developer to improve an existing forex EA, not build a completely new robot from zero. Important note: I use GPT to help me write because my English is limited. The wording may be assisted by GPT, but the trading issues, testing observations, and improvement goals are real from my side. I need a developer who is patient, understands strategy logic well, and can explain the

Informations sur le projet

Budget
30+ USD
Délais
de 1 à 2 jour(s)