GNGTrader08

Multi-Timeframe Trend Following with 200 EMA Filter - Longs Only

Overview

This strategy is designed to trade long positions based on multiple timeframe Exponential Moving Averages (EMAs) and a 200 EMA filter. The strategy ensures that trades are only entered in strong uptrends and aims to capitalize on sustained upward movements while minimizing risk with a defined stop-loss and take-profit mechanism.

Key Components

Initial Capital and Position Sizing

Initial Capital: $1000.
Lot Size: 1 unit per trade.
Inputs

Fast EMA Length (fast_length): The period for the fast EMA.
Slow EMA Length (slow_length): The period for the slow EMA.
200 EMA Length (filter_length_200): Set to 200 periods for the primary trend filter.
Stop Loss Percentage (stop_loss_perc): Set to 1% of the entry price.
Take Profit Percentage (take_profit_perc): Set to 3% of the entry price.
Timeframes and EMAs

EMAs are calculated for the following timeframes using the request.security function:
5-minute: Short-term trend detection.
15-minute: Intermediate-term trend detection.
30-minute: Long-term trend detection.
The strategy also calculates a 200-period EMA on the 5-minute timeframe to serve as a primary trend filter.
Trend Calculation

The strategy determines the trend for each timeframe by comparing the fast and slow EMAs:
If the fast EMA is above the slow EMA, the trend is considered positive (1).
If the fast EMA is below the slow EMA, the trend is considered negative (-1).
Combined Trend Signal

The combined trend signal is derived by summing the individual trends from the 5-minute, 15-minute, and 30-minute timeframes.
A combined trend value of 3 indicates a strong uptrend across all timeframes.
Any combined trend value less than 3 indicates a weakening or negative trend.
Entry and Exit Conditions

Entry Condition:
A long position is entered if:
The combined trend signal is 3 (indicating a strong uptrend across all timeframes).
The current close price is above the 200 EMA on the 5-minute timeframe.
Exit Condition:
The long position is exited if:
The combined trend signal is less than 3 (indicating a weakening trend).
The current close price falls below the 200 EMA on the 5-minute timeframe.
Stop Loss and Take Profit

Stop Loss: Set at 1% below the entry price.
Take Profit: Set at 3% above the entry price.
These levels are automatically set when entering a trade using the strategy.entry function with stop and limit parameters.
Plotting

The strategy plots the fast and slow EMAs for the 5-minute timeframe and the 200 EMA for visual reference on the chart:
Fast EMA (5-min): Plotted in blue.
Slow EMA (5-min): Plotted in red.
200 EMA (5-min): Plotted in green.
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?