Техническое задание
# 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}")
Откликнулись
1
Оценка
Проекты
2
0%
Арбитраж
1
0%
/
0%
Просрочено
2
100%
Свободен
2
Оценка
Проекты
66
12%
Арбитраж
12
58%
/
42%
Просрочено
1
2%
Свободен
3
Оценка
Проекты
50
42%
Арбитраж
3
33%
/
33%
Просрочено
4
8%
Свободен
4
Оценка
Проекты
10
50%
Арбитраж
6
17%
/
50%
Просрочено
3
30%
Работает
5
Оценка
Проекты
4
50%
Арбитраж
4
0%
/
75%
Просрочено
0
Свободен
Похожие заказы
Welcome to my freelance profile. I am a disciplined and detail-oriented trading systems specialist with strong expertise in: Algorithmic Trading (MT4 & MT5) EA/Indicator Setup & Technical Support Signal Creation, Optimization & Risk Structuring Strategy Testing & Performance Evaluation Trade Automation & System Fine-Tuning My work is based on accuracy, transparency, and strict professional standards. I ensure that
Using news filter, simple price action, some indicators & statistics inputs to create Conservative BTCUSD and XAUUSD Scalping EA The required EA must: - Continuously working - Be with full source code given to me - Edges cases Solved > 99% - Be from a +5 successful similar projects coder - Be put in Trello for reviewing, validating and back testing - Be of clean
Mt5 mobile with delayed charts ios
100+ USD
Looking for a developer to make mobile MT5 with delayed charts can choose the day and will work exactly like normal metatrader, even lot size the profit and losses and everything can add capital etc
Pazuzu
30+ USD
generate or create me a python coded file that has mql5 language requirements for a trading bot under the following instructions. the bot must execute trades if necessary the bot must trade 24/7 the bot must trade gold and currency the bot must make unlimited profit hourly the bot must enter market with caution after market analysis of 98 percent of clear trade
Hi Developers, I am looking for a simple EA to trade XAUUSD. - no martingale / grid - price action and potential indicators based on Developers experience - 1M / 5M TF - testing and feedback cycles - risk management - profitability - source code if possible - session filter Looking forward hearing from you! Best regards, Dominik
Информация о проекте
Бюджет
30+ USD
Сроки выполнения
от 1 до 2 дн.