Downloads · 30 days
16
25% of all-time downloads
semsankken/xauusd_smc_trading_classifier
xauusd_smc_trading_classifier is a machine learning model from semsankken. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This project processes hourly XAUUSD (Gold) price data to generate trading signals based on Smart Money Concepts (SMC) patterns, including Order Blocks (OB), Fair Value Gaps (FVG), and Change of Character (CHOCH). It…
Downloads · 30 days
16
25% of all-time downloads
All-time downloads
63
Public
Repo size
216 KB
Likes
1
Public
Click a slice to open those files.
.bin215 KB · 96%
From the Hugging Face model README
This project processes hourly XAUUSD (Gold) price data to generate trading signals based on Smart Money Concepts (SMC) patterns, including Order Blocks (OB), Fair Value Gaps (FVG), and Change of Character (CHOCH). It uses a Long Short-Term Memory (LSTM) neural network to predict trading signals (Buy=1, Sell=0, Hold=2) and includes take-profit (TP) and stop-loss (SL) calculations for trading strategies.
hh), lower lows (ll), trend, body size, and volume ratio.pandas==2.0.3
numpy==1.24.3
scikit-learn==1.2.2
datasets==2.14.4
torch==2.0.1
XAUUSD_H1.csv: Hourly OHLCV data with columns Time, Open, High, Low, Close, Volume (tab-separated).git clone <repository-url>
cd <repository-directory>
pip install -r requirements.txt
XAUUSD_H1.csv) is placed in the project directory.Preprocess Data:
Run the preprocessing script to generate SMC signals and create a Hugging Face Dataset:
python preprocess_smc_optimized.py
XAUUSD_H1.csv (~150,000 rows)/xauusd_smc_dataset (saved dataset with sequences and labels)Open, High, Low, Close, Volume, hh, ll, trend, body_size, volume_ratioTrain and Evaluate Model: Run the training script to train an LSTM model and generate a classification report:
python train_evaluate_lstm_smc.py
/xauusd_smc_dataset/best_lstm_model.pthExample Output:
Epoch 1/100, Train Loss: 0.571448, Test Loss: 0.568098, Test Accuracy: 0.9834
...
Epoch 100/100, Train Loss: 0.232735, Test Loss: 0.235532, Test Accuracy: 0.9650
Classification Report:
precision recall f1-score support
Sell 0.XX 0.XX 0.XX XXXX
Buy 0.XX 0.XX 0.XX XXXX
Hold 0.XX 0.XX 0.XX XXXXX
accuracy 0.XX 29988
macro avg 0.XX 0.XX 0.XX 29988
weighted avg 0.XX 0.XX 0.XX 29988
preprocess_smc_optimized.py: Generates SMC signals, creates sequences, and saves the dataset.train_evaluate_lstm_smc.py: Trains an LSTM model and evaluates performance with a classification report.XAUUSD_H1.csv: Input dataset (not included; provide your own)./xauusd_smc_dataset: Saved Hugging Face dataset./best_lstm_model.pth: Saved best model weights.[1.0, 1.0, 0.1]) to prioritize Buy/Sell signals over Hold.float32 for features, int64 for labels, and saves dataset to disk.dask for larger datasets.MIT License
For issues or contributions, please open a issue or contact semsankken.
Generated on September 8, 2025, 16:15 +07