Summary of the EMA Trend & Trigger Strategy (Pine Script) This Pine Script strategy is designed to trade based on Exponential Moving Averages (EMAs) on two different timeframes:
1D (Daily) → Identifies the overall trend. 1H (Hourly) → Generates trade signals based on shorter-term movements. How It Works 1. Define EMA Lengths Daily (1D) EMAs: Short EMA: 5-period Long EMA: 30-period Hourly (1H) EMAs: Short EMA: 12-period Long EMA: 26-period 2. Calculate EMA Values Uses request.security to fetch EMA values from both the daily (1D) and hourly (1H) timeframes. 3. Determine Trend Based on 1D EMAs Uptrend: Short EMA (5) > Long EMA (30). Downtrend: Short EMA (5) < Long EMA (30). 4. Generate Trade Signals (1H Crossover) Buy Signal: Short EMA (12) crosses above Long EMA (26) AND the daily trend is up. Sell Signal: Short EMA (12) crosses below Long EMA (26) AND the daily trend is down. 5. Volatility-Based Trade Triggers High Volatility Uptrend: If the price rises by more than 5%, enter a long trade. High Volatility Downtrend: If the price drops by more than 5%, enter a short trade. 6. Stop Loss Calculation Long Trades: Stop loss at the lowest price in the last 10 bars. Short Trades: Stop loss at the highest price in the last 10 bars. 7. Execute Trades Enter Long: When a buy signal or high volatility uptrend occurs. Exit Long: When the stop loss (localBottom) is hit. Enter Short: When a sell signal or high volatility downtrend occurs. Exit Short: When the stop loss (localPeak) is hit. 8. Plot EMAs on Chart Blue: 1D Short EMA (5). Red: 1D Long EMA (30). Green: 1H Short EMA (12). Orange: 1H Long EMA (26). Key Takeaways Combines trend-following and short-term crossovers for trade signals. Filters trades based on volatility (5% price moves). Uses stop-loss levels based on local highs/lows (last 10 bars). Can trade both long and short positions. This strategy is useful for momentum traders looking to follow trends while using a lower timeframe for precision entries. 🚀
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
לגישה מהירה לגרף, הוסף את הסקריפט הזה למועדפים שלך - למד עוד כאן.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
לגישה מהירה לגרף, הוסף את הסקריפט הזה למועדפים שלך - למד עוד כאן.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.