OPEN-SOURCE SCRIPT

Flexible Moving Average Strategy

已更新
This strategy offers flexibility to choose between SMA and EMA, and allows users to set the review frequency to Daily, Weekly, or Monthly. It adapts to different market conditions by providing full control over the length and timeframe of the Moving Average.

### Key Features:
- **Moving Average Method**: Select between SMA and EMA.
- **Review Frequency**: Choose Daily, Weekly, or Monthly review periods.
- **Customizable**: Set the Moving Average length and timeframe.
- **Entry/Exit Rules**:
- **Enter Long**: When the close price is above the Moving Average at the end of the period.
- **Exit**: When the close price falls below the Moving Average.

### Parameters:
- **Review Frequency**: Daily, Weekly, Monthly
- **Moving Average Method**: SMA or EMA
- **Length & Timeframe**: Fully adjustable

This strategy suits traders who prefer a flexible, trend-following approach based on long-term price movements.
版本注释
Added more types of Moving Averages
版本注释
Added input to specify the percentage of the portfolio to sell when MA is crossed below
版本注释
Immediate Full Investment: On the very first bar (is_first_bar), the strategy now opens a long position with 100% of the capital
版本注释
Add input "Allow Initial Buy Without MA Data"
Exponential Moving Average (EMA)Moving AveragesSimple Moving Average (SMA)

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明