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
291 changes: 291 additions & 0 deletions README_Prometheus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
# VSVTrend: Adaptive TradingView Strategy with Intelligent Trend Analysis

## Project Overview

VSVTrend is an advanced trading strategy developed for TradingView using Pine Script, aimed at creating a sophisticated, adaptable trading indicator for financial markets. The strategy focuses on maximizing trade accuracy through a combination of innovative technical analysis techniques and adaptive risk management.

### Core Purpose
The primary objective of VSVTrend is to develop a robust, flexible trading strategy that can:
- Provide accurate entry and exit signals across various financial instruments
- Minimize false signals through intelligent filtering
- Offer customizable risk management parameters

### Key Features
- **Adaptive Indicator**: Utilizes Supertrend filter with configurable parameters to identify market trends
- **Flexible Strategy Control**:
- On/off toggle for the entire strategy
- Optional Supertrend filter
- Configurable ATR (Average True Range) period and factor
- **Risk Management**:
- Customizable Stop Loss (SL) percentage
- Customizable Take Profit (TP) percentage
- Percentage-based equity allocation
- **Versatility**: Compatible with multiple timeframes and financial instruments

### Unique Advantages
- Open-source approach allowing community-driven improvements
- Designed to be a foundational "alpha indicator" for traders
- Combines technical analysis with potential for AI/ML enhancement

## Getting Started, Installation, and Setup

### Prerequisites
- TradingView Pro or Pro+ account (required for custom strategies)
- Basic understanding of Pine Script and trading strategies

### Installation
1. Open TradingView and navigate to the Pine Editor
2. Create a new script or open an existing strategy
3. Copy and paste the entire contents of `VSVTrend.pine` into the editor

### Configuration Options
The strategy provides several configurable inputs to customize its behavior:

- `Strategy ON/OFF`: Toggle the entire strategy on or off
- `Supertrend filter`: Enable or disable the Supertrend filter
- `ATR period`: Adjust the Average True Range period (default: 10)
- `Factor`: Modify the Supertrend sensitivity (default: 3.0)
- `Stop Loss`: Set the stop loss percentage (default: 1.5%)
- `Take Profit`: Set the take profit percentage (default: 3.0%)

### Quick Start
1. In TradingView, go to the Pine Editor
2. Paste the `VSVTrend.pine` script
3. Apply the strategy to your desired chart
4. Adjust input parameters as needed
5. Enable/disable the strategy using the visual toggle

### Compatibility
- Compatible with all TradingView chart timeframes
- Supports both long and short trading positions
- Designed for equity trading with default 10% position sizing

## Dataset

The VSVTrend strategy utilizes financial market data for trading strategy development and backtesting.

### Data Source
The strategy is designed to work with TradingView's financial market price data across multiple timeframes. It does not rely on a fixed external dataset but rather uses real-time or historical price data from trading platforms.

### Data Characteristics
- **Types of Data**: Financial price data (Open, High, Low, Close prices)
- **Supported Timeframes**: All TradingView chart timeframes
- **Key Indicators Used**:
- Supertrend indicator
- ATR (Average True Range)

### Sample Data
A sample trade log is included in the repository to demonstrate potential model training data. The file `sample_tradelog.csv` provides insights into trade logging and potential machine learning model training.

### Data Processing
The strategy employs several key data processing techniques:
- Dynamic ATR calculation (period configurable)
- Supertrend filter with adjustable factor
- Percentage-based Stop Loss and Take Profit mechanisms

## Model Architecture and Training

The project implements a trading strategy using TradingView's Pine Script language, focusing on trend-following methodology with Supertrend indicator and configurable risk management.

#### Model Architecture
The strategy is built around the Supertrend technical indicator, which is a trend-following algorithm that helps identify market trends and potential entry/exit points. Key components include:

- Supertrend Indicator
- Calculates trend direction using Average True Range (ATR)
- Configurable ATR period (default: 10)
- Configurable factor for trend sensitivity (default: 3.0)

#### Strategy Parameters
- Strategy Toggle: Enable/disable the entire trading strategy
- Supertrend Filter: Option to apply Supertrend trend filter
- Risk Management
- Stop Loss: Configurable percentage (default: 1.5%)
- Take Profit: Configurable percentage (default: 3.0%)

#### Trading Logic
- Long Entry Condition: When Supertrend indicates an upward trend
- Short Entry Condition: When Supertrend indicates a downward trend
- Position Sizing: Percent of equity (default: 10%)

#### Training and Optimization
This is a rule-based strategy implemented in Pine Script, which does not involve traditional machine learning training. Instead, optimization occurs through parameter tuning:
- Adjust ATR period to match market characteristics
- Modify factor to control trend sensitivity
- Fine-tune stop loss and take profit percentages

Traders can customize parameters directly in the TradingView Pine Script editor to adapt the strategy to different financial instruments and market conditions.

## Inference / How to Use the Model

The VSVTrend strategy is a trading strategy script designed for TradingView, providing automated entry and exit signals based on the Supertrend indicator.

### Configuration Options

Users can customize the strategy through several input parameters:

- `show_strategy`: A boolean toggle to turn the strategy on or off (default: `true`)
- `use_supertrend`: A boolean to enable/disable the Supertrend filter (default: `true`)
- `atrPeriod`: The period for Average True Range (ATR) calculation (default: `10`)
- `factor`: The multiplier used in Supertrend calculation (default: `3.0`)
- `sl`: Stop Loss percentage (default: `1.5%`)
- `tp`: Take Profit percentage (default: `3.0%`)

### Trading Signals

The strategy generates the following signals:
- Long Entry: When the Supertrend direction is positive (green)
- Short Entry: When the Supertrend direction is negative (red)

### How to Use

1. Open TradingView Pine Editor
2. Create a new strategy script
3. Copy and paste the entire `VSVTrend.pine` script
4. Apply the script to a chart
5. Adjust input parameters as desired

#### Example Customization

```pine
// Disable Supertrend filter
use_supertrend = false

// Adjust ATR period and factor
atrPeriod = 14
factor = 2.5

// Set custom Stop Loss and Take Profit
sl = 2.0 / 100 // 2% Stop Loss
tp = 4.0 / 100 // 4% Take Profit
```

### Considerations

- The strategy is designed for educational and research purposes
- Always backtest and validate the strategy before real-world trading
- Performance may vary across different markets and timeframes

## Project Structure

The project has a straightforward structure focused on a single Pine Script trading strategy:

#### Root Directory
- `VSVTrend.pine`: The core Pine Script implementation of the trading strategy for TradingView
- `README.md`: Project documentation and overview
- `LICENSE`: Project licensing information

#### Key Files
- `VSVTrend.pine`: Contains the complete trading strategy implementation, including:
- Strategy configuration
- Input parameters
- Supertrend indicator logic
- Entry and exit conditions
- Stop loss and take profit mechanisms

#### Notable Implementation Details
- Strategy is built using Pine Script v5
- Uses technical analysis (TA) functions for trend detection
- Supports configurable parameters like ATR period, factor, and risk management settings

The project is compact and focused, with all core functionality contained within the single `VSVTrend.pine` script.

## Additional Notes

#### Strategy Customization and Flexibility

The VSVTrend strategy provides several key customization options to adapt to different trading scenarios:

- **Strategy Toggle**: Users can turn the strategy on or off using the `show_strategy` input
- **Supertrend Filter**: The Supertrend filter can be enabled or disabled via `use_supertrend` input
- **Risk Management**:
- Configurable ATR period (default: 10)
- Adjustable Supertrend factor (default: 3.0)
- Flexible Stop Loss percentage (default: 1.5%)
- Flexible Take Profit percentage (default: 3.0%)

#### Trading Mechanics

The strategy operates on the following core principles:
- Generates long and short entry signals based on Supertrend direction
- Implements percentage-based equity allocation (default: 10%)
- Provides exit strategies with predefined Take Profit and Stop Loss levels

#### Compatibility

- Compatible with TradingView Pine Script version 5
- Supports trading across multiple timeframes
- Can be overlaid directly on price charts

#### Limitations and Considerations

- The strategy is experimental and part of an ongoing community-driven development
- Performance may vary across different markets and trading conditions
- Requires thorough backtesting and validation before live trading

#### Future Development

The project is open to community contributions and continuous improvement, with a focus on:
- Refining signal accuracy
- Enhancing false signal detection
- Expanding AI/ML integration for trade signal optimization

## Contributing

The VSVTrend project welcomes contributions from the community to help improve and enhance the trading strategy. We appreciate your interest in making this project better.

### How to Contribute

1. **Fork the Repository**: Create a fork of the main repository to your GitHub account.

2. **Create a Branch**:
- Create a new branch for your contribution
- Use a clear and descriptive branch name
- Example: `feature/improve-supertrend-filter` or `bugfix/stop-loss-calculation`

3. **Code Guidelines**
- Follow Pine Script best practices and TradingView coding standards
- Ensure code is clean, well-commented, and readable
- Maintain the existing code structure and style

4. **Testing**
- Test your changes thoroughly on different timeframes and market conditions
- Verify that new modifications do not break existing functionality
- If possible, include sample trade logs or backtesting results demonstrating the improvement

5. **Documentation**
- Update the README.md if your changes introduce new features or modify existing ones
- Provide clear descriptions of any modifications or enhancements

6. **Pull Request Process**
- Submit a pull request with a clear title and description
- Explain the purpose and impact of your changes
- Be prepared to discuss and refine your contribution

### Reporting Issues

If you find a bug or have a suggestion:
- Check existing issues to avoid duplicates
- Use the GitHub Issues section to report problems
- Include detailed information: strategy version, Pine Script version, specific circumstances of the issue

### Code of Conduct

Contributions are expected to be respectful, constructive, and aligned with the project's goal of creating an improved trading strategy. Collaboration and constructive feedback are key to the project's success.

## License

This project is licensed under the [MIT License](LICENSE).

#### Key Permissions
- Commercial use
- Modification
- Distribution
- Private use

#### License Terms
The MIT License is a permissive open-source 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.

#### Disclaimer
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.