Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 306 additions & 0 deletions README_Prometheus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
## Project Overview

### Project Goal
VSVTrend is an advanced trading strategy designed to create a highly accurate and adaptable trading indicator for TradingView. The primary objectives of this project are:
- Develop a sophisticated trading strategy that maximizes trade accuracy
- Create an open-source, community-driven trading tool
- Implement advanced features like adaptive risk management and AI-powered signal validation

### Key Features and Innovations
- **Adaptive Trading Mechanism**: Utilizes Supertrend indicator with customizable parameters
- **Risk Management**:
- Configurable Stop Loss and Take Profit percentages
- Percent of equity-based position sizing
- **Flexibility**:
- Works across multiple timeframes
- Toggleable strategy and Supertrend filter
- **Machine Learning Integration**: Includes an AI module to detect and filter potential false trading signals

### Technical Approach
The strategy combines multiple technical analysis techniques:
- Supertrend indicator for trend direction
- Configurable ATR (Average True Range) for volatility assessment
- Automated entry and exit conditions
- Flexible risk management parameters

### Project Purpose
The ultimate goal is to create an "alpha indicator" strategy that is:
- Freely available to the trading community
- Open to continuous improvement through collaborative feedback
- Applicable across different markets and trading instruments

By combining advanced technical analysis with potential machine learning enhancements, VSVTrend aims to provide traders with a robust, adaptive trading strategy tool.

## Dataset

### Data Overview
The VSVTrend strategy utilizes financial market time series data, primarily designed for use with TradingView's Pine Script environment.

### Data Sources
- **Primary Source**: Real-time or historical price data from TradingView
- **Sample Data**:
- Location: `data/sample_tradelog.csv`
- Purpose: Trade log for machine learning model training

### Dataset Characteristics
- **Data Type**: Financial time series (price and trading data)
- **Supported Timeframes**: All timeframes (minute, hourly, daily, etc.)
- **Key Features Captured**:
- Price movement
- Trend direction
- Supertrend indicator values
- Entry/exit conditions

### Data Schema
The strategy uses the following key data inputs:
- `atrPeriod`: Integer representing the Average True Range period (default: 10)
- `factor`: Float for Supertrend calculation (default: 3.0)
- `sl`: Stop Loss percentage (default: 1.5%)
- `tp`: Take Profit percentage (default: 3.0%)

### Machine Learning Integration
- A separate Python script (`ml/model_train.py`) is used for training an ML model to detect potential false signals
- Additional training data can be added to `data/sample_tradelog.csv`

### Notes
- The dataset is dynamically generated from live or historical market data
- No fixed dataset is bundled; the strategy works with real-time trading data

## Installation and Setup

### Prerequisites
- TradingView Account
- Pine Script Editor access

### Installation Steps
1. Open TradingView Platform
2. Navigate to the Pine Editor
3. Create a New Strategy or Open an Existing Chart
4. Copy and Paste the `VSVTrend.pine` Script

### Configuration Options
The strategy provides several customizable inputs:

- `show_strategy`: Toggle strategy on/off (default: true)
- `use_supertrend`: Enable/disable Supertrend filter (default: true)
- `atrPeriod`: ATR (Average True Range) period (default: 10)
- `factor`: Supertrend calculation factor (default: 3.0)
- `sl`: Stop Loss percentage (default: 1.5%)
- `tp`: Take Profit percentage (default: 3.0%)

### Strategy Parameters
- **Strategy Type**: Trading Strategy
- **Overlay**: Yes
- **Default Quantity**: 10% of equity

### Notes
- Ensure you understand the risks associated with automated trading strategies
- Backtest the strategy thoroughly before live trading
- Adjust input parameters based on your risk tolerance and market conditions

## Project Structure

### Repository Layout
```
.
├── VSVTrend.pine # Main TradingView strategy script
├── ml/
│ └── model_train.py # Machine learning model training script
├── data/
│ └── sample_tradelog.csv # Sample trade log for model training
└── README.md # Project documentation
```

### Key Components

1. **Main Strategy Script (`VSVTrend.pine`)**
- Core TradingView Pine Script strategy implementation
- Includes key features:
* Strategy on/off toggle
* Supertrend filter
* Adaptive Stop Loss / Take Profit system
- Supports entry and exit conditions for long and short trades

2. **Machine Learning Support**
- `ml/model_train.py`: Python script for training ML models to detect false signals
- `data/sample_tradelog.csv`: Sample trade log used for model training and validation

### Entry Points

1. **TradingView Strategy**
- Open `VSVTrend.pine` in TradingView Pine Editor
- Apply to any chart on any timeframe
- Configure strategy parameters:
* Enable/disable strategy
* Toggle Supertrend filter
* Adjust ATR period and factor
* Set Stop Loss and Take Profit percentages

2. **Machine Learning Model**
- Run `ml/model_train.py` to retrain or fine-tune the signal detection model
- Input trade log data in `data/sample_tradelog.csv`

### Configuration Options
- Strategy on/off toggle
- Supertrend filter activation
- ATR period (default: 10)
- Supertrend factor (default: 3.0)
- Stop Loss percentage (default: 1.5%)
- Take Profit percentage (default: 3.0%)

## Model Architecture and Training

### Model Overview
The VSVTrend strategy incorporates an AI/ML module designed to enhance trade signal accuracy by identifying potential false signals. The model is built with a focus on adaptive and intelligent trade decision-making.

### Model Architecture
The AI/ML component of the VSVTrend strategy is developed to:
- Detect and filter out potential false trading signals
- Provide an additional layer of validation for trade entries and exits
- Improve overall trading strategy robustness

### Training Data
- Training data is sourced from `data/sample_tradelog.csv`
- The dataset contains historical trade logs used to train the ML model
- Focuses on learning patterns that distinguish between valid and false trading signals

### Training Process
While specific training scripts are not fully detailed in the current repository, the strategy includes an ML module for signal validation.

### Training Recommendations
To train or fine-tune the model:
1. Prepare a comprehensive trade log with detailed trade information
2. Use the sample trade log as a template
3. Ensure data includes key parameters like entry/exit points, market conditions, and trade outcomes

### Usage Notes
- The AI/ML module is integrated directly into the TradingView Pine Script strategy
- Designed to work across multiple timeframes
- Adaptable to different market conditions

### Potential Improvements
- Expand training dataset
- Implement more sophisticated machine learning techniques
- Add more granular false signal detection mechanisms

**Note:** Further development of the ML training process is encouraged through community contributions.

## Evaluation and Results

### Model Evaluation Methodology
The VSVTrend strategy employs a multi-faceted approach to model evaluation and performance assessment:

#### Performance Metrics
1. **Accuracy**: Measures the strategy's ability to generate correct trading signals
2. **False Signal Detection**: Utilizes AI/ML techniques to identify and filter out potential false signals
3. **Risk Management**: Evaluated through adaptive Stop Loss and Take Profit mechanisms

#### Evaluation Techniques
- **Backtesting**: Full backtesting functionality implemented to assess strategy performance across different market conditions
- **Timeframe Flexibility**: Tested and validated across multiple timeframes to ensure robustness

### Training and Optimization
- The strategy incorporates an AI/ML module for continuous signal refinement
- Uses sample trade log data for model training and validation (`data/sample_tradelog.csv`)

### Key Advantages
- Adaptive indicators that adjust to changing market dynamics
- Supertrend filter for additional signal confirmation
- Visual toggle for easy strategy visualization and analysis

### Recommended Evaluation Process
1. Use the TradingView Pine Script editor
2. Load the `VSVTrend.pine` strategy
3. Conduct comprehensive backtesting on various instruments and timeframes
4. Analyze performance metrics and adjust parameters as needed

**Note**: While the current implementation shows promising results, continuous community feedback and improvement are encouraged.

## Inference and Usage

### Prerequisites
- TradingView Pine Script v5 compatible platform
- Basic understanding of trading strategies and Pine Script

### Running the Strategy

1. **Open TradingView**
- Navigate to the Pine Editor
- Create a new Pine Script strategy

2. **Copy and Paste the Code**
Copy the entire contents of `VSVTrend.pine` into the Pine Editor.

3. **Strategy Configuration**
The strategy provides several configurable inputs:
- `Strategy ON/OFF`: Toggle the entire strategy on/off
- `Supertrend filter`: Enable/disable the Supertrend filter
- `ATR period`: Adjust the Average True Range period (default: 10)
- `Factor`: Supertrend factor (default: 3.0)
- `Stop Loss`: Set stop loss percentage (default: 1.5%)
- `Take Profit`: Set take profit percentage (default: 3.0%)

4. **Applying to a Chart**
- Select any financial instrument and timeframe
- Add the strategy to your chart
- Adjust parameters as needed

### Example Inputs
```pine
// Example configuration
show_strategy = true // Turn strategy on
use_supertrend = true // Use Supertrend filter
atrPeriod = 14 // Adjust ATR period
factor = 2.5 // Modify Supertrend factor
sl = 1.0 / 100 // 1% Stop Loss
tp = 2.5 / 100 // 2.5% Take Profit
```

### Strategy Mechanics
- Entry Conditions:
- Long: Supertrend indicates upward direction
- Short: Supertrend indicates downward direction
- Adaptive position sizing (10% of equity per trade)
- Automatic Take Profit and Stop Loss management

### Notes
- Backtest thoroughly before live trading
- Performance may vary across different markets and timeframes
- Recommended to combine with additional risk management techniques

## Technologies Used

### Programming Languages
- Pine Script (v5): Primary language for TradingView strategy development
- Python: Used for machine learning model training

### Technical Analysis Libraries
- TradingView Technical Analysis (built-in):
- Supertrend Indicator
- ATR (Average True Range)

### Machine Learning and Data Science
- Python ML Libraries (referenced in project structure):
- scikit-learn (implied for AI/ML-based false signal detection)
- pandas (for data manipulation and trade log processing)

### Development and Visualization Tools
- TradingView Pine Editor: Primary development environment
- Backtesting frameworks built into TradingView platform

### Key Features Enabled by Technologies
- Adaptive strategy parameters
- Machine learning-enhanced signal filtering
- Flexible strategy toggling
- Comprehensive backtesting support

## License

This project is licensed under the MIT License. For the full license details, please see the [LICENSE](LICENSE) file in the repository.

The MIT License is a permissive free software license that allows you to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, subject to the following conditions:

- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

For more information, refer to the [LICENSE](LICENSE) file.