Specification
# 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}")
Responded
1
Rating
Projects
2
0%
Arbitration
1
0%
/
0%
Overdue
2
100%
Free
2
Rating
Projects
62
8%
Arbitration
12
58%
/
42%
Overdue
1
2%
Free
3
Rating
Projects
50
42%
Arbitration
3
33%
/
33%
Overdue
4
8%
Free
4
Rating
Projects
10
50%
Arbitration
6
17%
/
50%
Overdue
3
30%
Working
5
Rating
Projects
4
50%
Arbitration
4
0%
/
75%
Overdue
0
Free
Similar orders
Run Python Code and update it
30+ USD
Hello I have a piece of python code that connects telegram and pocket option, I need help running it and will update it before tomorrow speed is paramount.We can use anydesk for to connect my pocket option with telegram basically run the code, once that is done will give 2 updates on the code
Modifications in an EA i have
30+ USD
I need to create an EA based on my own strategy that actually is a little bit different from most of the usual EA. This because it use an indicator but the power of the system is just because it can shows target price by designing trendline on the price chart in a unusual way. A friend of mine tried to create it on MT4 platform but, in the end, he realized that this platform has big limits when the program lines
Hey there! I’m looking for a talented NinjaTrader programmer to partner with on some exciting projects. If you have a knack for NinjaScript and a passion for trading tech, let’s team up! What You Can Expect: A friendly collaboration on diverse projects Fair pay—50/50 split on all earnings An opportunity to dive deep into innovative trading strategies What I’m Hoping You Bring: Experience with NinjaTrader and
Programmer for ninjatrader 8 indicator
40 - 80 USD
STRATEGY : Here’s a comprehensive specification document in English for developing your NinjaTrader bid/ask imbalance indicator: --- ### Bid/Ask Imbalance Indicator for NinjaTrader: Full Specifications #### **Objective**The goal is to develop a custom bid/ask imbalance indicator for NinjaTrader 8. The indicator will calculate and visualize bid/ask imbalances in real-time and on historical tick data using Tick Replay
**Job Description**: I am looking for an experienced developer to convert my fully functioning TradingView code into an automated trading bot for the MQL5 terminal. The bot will be connected to my Exness account and should execute trades based on specific signals generated by the strategy. **Key Responsibilities**: - Convert existing TradingView Pine Script strategy into MQL5 code. - Ensure the MQL5 bot replicates
I need someone to code NinjaTrader 8 indicator
50 - 80 USD
Here’s a comprehensive specification document in English for developing your NinjaTrader bid/ask imbalance indicator: --- ### Bid/Ask Imbalance Indicator for NinjaTrader: Full Specifications #### **Objective**The goal is to develop a custom bid/ask imbalance indicator for NinjaTrader 8. The indicator will calculate and visualize bid/ask imbalances in real-time and on historical tick data using Tick Replay. It will
Convert tradingview indicator into tradelocker ea
80 - 100 USD
I would to develop a trading bot with some confluences I use TradeLocker Settings must be adjustable…… I am based in uk and very keen to move my strategy to trade automatically 1. Market Structure Break And Order block. By EmreKb 2. Rainbow Adaptive RSI By LuxAlgo 3. Multiple Moving Average using only 1 indicator By Myfye13 4. Average True Range Trailing Stops By HPotter we have to combine this four indicator into a
Convert my tradingview pine script to mt4, Its a simple and straight code i need an expert programmer to convert my tradingview pine script to mt4, Thats All Thank you
hello there I need a copy trade for mt4 can ANYONE help me with and let discuss on how to go about it kindly send me message to signify and let discuss mind you i need this urgently let connect to discuss and conclude
I want you to make automated trading bot
30 - 50 USD
i have a JavaScript of a code which is a indicator of trading view, i want to convert into python script and make a mql5 automated trading bot which can take automatic trade and also exit when the signals come by the indicator
Project information
Budget
30+ USD
For the developer
27
USD
Deadline
from 1 to 2 day(s)