https://github.com/efe-eroglu/usd-try-backtest
A backtest for the usd/try pair using different strategies.
https://github.com/efe-eroglu/usd-try-backtest
backtest backtesting fintech
Last synced: about 2 months ago
JSON representation
A backtest for the usd/try pair using different strategies.
- Host: GitHub
- URL: https://github.com/efe-eroglu/usd-try-backtest
- Owner: Efe-Eroglu
- Created: 2024-06-04T06:49:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-15T16:01:28.000Z (almost 2 years ago)
- Last Synced: 2025-03-11T14:24:03.416Z (over 1 year ago)
- Topics: backtest, backtesting, fintech
- Language: Jupyter Notebook
- Homepage:
- Size: 368 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#
Trading Strategy Analysis using Vectorbt
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.
## Requirements
Make sure to install the required libraries before running the script
```bash
pip install yfinance vectorbt ta pandas numpy
```
## Overview
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.
## Script Breakdown
## 1. Data Download
The script starts by downloading historical data for the USD/TRY currency pair using the yfinance library.
```python
import yfinance as yf
import pandas as pd
symbol = 'USDTRY=X'
data = yf.download(symbol)
close = data['Close']
```
## 2.Moving Averages
The script calculates several moving averages (MA) with different window sizes.
## 3. Technical Indicators
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
## 4. Entry and Exit Conditions
The script defines several entry and exit conditions based on the calculated technical indicators.
## 5. Strategy Optimization
The script tests different combinations of stop-loss and take-profit values to find the best performing strategy.
## Conclusion
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.