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
198 changes: 198 additions & 0 deletions README_Prometheus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# VSVTrend: Adaptive TradingView Strategy with Advanced Signal Filtering and Risk Management

## Project Overview

VSVTrend is an advanced trading strategy designed for TradingView, leveraging Pine Script to create a sophisticated, adaptive trading approach. The project aims to develop a robust "alpha indicator" strategy that maximizes trade accuracy through intelligent filtering and risk management.

### Core Purpose
The primary goal is to provide traders with a flexible, data-driven trading strategy that can:
- Minimize false trading signals
- Adapt to various market conditions
- Provide configurable risk management

### Key Features
- **Adaptive Trading Signals**: Utilizes Supertrend indicator for dynamic market trend identification
- **Flexible Configuration**:
- Toggleable strategy activation
- Optional Supertrend filter
- Customizable Stop Loss and Take Profit percentages
- **Risk Management**:
- Percentage-based equity allocation
- Configurable Stop Loss (default 1.5%)
- Configurable Take Profit (default 3%)
- **Universal Compatibility**: Works across multiple timeframes and financial instruments

### Technical Innovations
- Implements advanced Pine Script v5 strategy
- Incorporates technical analysis (TA) indicators
- Supports dynamic entry and exit conditions
- Provides visual chart indicators for easy interpretation

## Installation

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

### Installation Steps
1. Open TradingView and navigate to the Pine Editor
2. Create a new strategy script
3. Copy and paste the entire contents of `VSVTrend.pine` into the editor
4. Compile and save the script

### Strategy Configuration
- **Strategy ON/OFF**: Toggle the main strategy using the `show_strategy` input
- **Supertrend Filter**: Enable/disable with `use_supertrend` input
- **Customizable Parameters**:
- ATR Period: Adjust `atrPeriod` (default: 10)
- ATR Factor: Modify `factor` (default: 3.0)
- Stop Loss: Set `sl` percentage (default: 1.5%)
- Take Profit: Set `tp` percentage (default: 3.0%)

### Usage Notes
- Compatible with all TradingView timeframes
- Apply to any chart by selecting the strategy
- Recommended to backtest and optimize parameters for your specific trading instrument

## API Reference

## Inputs

### Strategy Configuration
- `show_strategy` (`bool`): Enables or disables the entire trading strategy.
- Default: `true`
- Usage: Control whether the strategy is active or paused

### Strategy Filters
- `use_supertrend` (`bool`): Toggles the Supertrend filter for trade entries.
- Default: `true`
- Usage: Determines if Supertrend indicator is used for entry conditions

### Technical Indicator Parameters
- `atrPeriod` (`int`): Period used for Average True Range (ATR) calculation in Supertrend.
- Default: `10`
- Range: Any positive integer
- Usage: Adjusts the sensitivity of the Supertrend indicator

- `factor` (`float`): Multiplier used in Supertrend calculation.
- Default: `3.0`
- Range: Typically between 1-5
- Usage: Controls the volatility band width of the Supertrend

### Risk Management
- `sl` (`float`): Stop Loss percentage.
- Default: `1.5%`
- Usage: Sets the maximum loss threshold for a trade

- `tp` (`float`): Take Profit percentage.
- Default: `3.0%`
- Usage: Sets the target profit level for a trade

## Trade Management Functions

### Entry Conditions
- `longCond`: Triggers long (buy) entry when:
- Strategy is enabled (`show_strategy`)
- Supertrend direction is positive

- `shortCond`: Triggers short (sell) entry when:
- Strategy is enabled (`show_strategy`)
- Supertrend direction is negative

### Strategy Execution
- `strategy.entry("Long", strategy.long)`: Enters a long trade
- `strategy.entry("Short", strategy.short)`: Enters a short trade
- `strategy.exit("TP/SL Long", from_entry="Long", profit=tp, loss=sl)`: Manages long trade exit with predefined take profit and stop loss
- `strategy.exit("TP/SL Short", from_entry="Short", profit=tp, loss=sl)`: Manages short trade exit with predefined take profit and stop loss

## Visualization
- `plot(supertrend)`: Displays the Supertrend indicator on the chart
- Color: Green when bullish, Red when bearish

## Repository Structure

The repository contains the core files for the VSVTrend trading strategy:

### Main Strategy File
- `VSVTrend.pine`: The primary Pine Script implementation of the VSVTrend trading strategy. This file contains the core trading logic, including:
- Strategy entry and exit conditions
- Supertrend filter
- Stop Loss and Take Profit mechanisms
- Configurable inputs for strategy customization

### Project Files
- `README.md`: Comprehensive documentation explaining the strategy, its features, and usage
- `LICENSE`: Legal terms governing the use and distribution of the project

### Notable Features in File Structure
- Single-file strategy implementation
- Modular design with configurable parameters
- Built for TradingView Pine Script environment

## Contributing

We welcome contributions from the trading and programming community! Here's how you can help improve the VSVTrend Strategy:

### Ways to Contribute
- Report bugs or suggest improvements by opening a GitHub Issue
- Submit pull requests with code enhancements
- Share your trading insights or strategy modifications
- Help improve documentation

### Development Setup
1. Clone the repository
2. Ensure you have Pine Script (TradingView) and Python environments set up
3. For machine learning model development, you'll need Python and relevant data science libraries

### Running Tests
As this is a TradingView Pine Script strategy, testing is primarily done through:
- TradingView's built-in strategy backtesting functionality
- Manually verifying signals in the TradingView Pine Editor
- Comparing results with the sample trade log in `data/sample_tradelog.csv`

### Contribution Guidelines
- Ensure code follows TradingView Pine Script best practices
- Add comments to explain complex logic
- Update documentation with any significant changes
- If modifying the ML model, provide reasoning and performance metrics

### Machine Learning Contributions
For those interested in the AI/ML false signal detection module:
- Improvements can be made to `ml/model_train.py`
- Provide additional training data if possible
- Document any changes to model training approach

### Reporting Issues
- Use GitHub Issues to report bugs
- Include detailed information:
- TradingView version
- Pine Script version
- Specific error or unexpected behavior
- Screenshots or trade log if applicable

### Pull Request Process
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Submit a pull request with a clear description of modifications

**Note:** By contributing, you agree to make your work available under the project's existing license.

## License

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

### License Details

The MIT License is a permissive free software license that allows you to:
- Use the software commercially
- Modify the software
- Distribute the software
- Use the software privately
- Place a warranty

Key conditions:
- Include the original license and copyright notice in any substantial portion of the software
- The software is provided "as is", without warranties of any kind

For the full license text, please refer to the [LICENSE](LICENSE) file in the repository.