This script performs a comprehensive analysis of different trading strategies using various technical indicators and optimizes the best entry and exit signals for trading the USD/TRY currency pair.
Make sure to install the required libraries before running the script
pip install yfinance vectorbt ta pandas numpy
The script downloads historical data for the USD/TRY currency pair, calculates various technical indicators, and evaluates the performance of different trading strategies. It optimizes the strategies by testing different combinations of stop-loss and take-profit values.
The script starts by downloading historical data for the USD/TRY currency pair using the yfinance library.
import yfinance as yf
import pandas as pd
symbol = 'USDTRY=X'
data = yf.download(symbol)
close = data['Close']
The script calculates several moving averages (MA) with different window sizes.
Various technical indicators are calculated using the ta library:
- Relative Strength Index (RSI)
- Moving Average Convergence Divergence (MACD)
- Bollinger Bands
- Ichimoku Cloud
- Stochastic Oscillator
- Parabolic SAR
The script defines several entry and exit conditions based on the calculated technical indicators.
The script tests different combinations of stop-loss and take-profit values to find the best performing strategy.
This script helps in identifying the best trading strategy for the USD/TRY currency pair by testing various technical indicators and optimizing stop-loss and take-profit values. The final output provides detailed statistics of the best performing strategy.