How This Script Works 1. Trend Filter Using 5-Minute Data: The 200‑period EMA is calculated on a 5‑minute timeframe via the request.security() function. Long trades are allowed only if the current close (on the 1‑minute chart) is above this EMA; short trades are allowed only if below it. 2. 1-Minute Entry Conditions: On the local (1‑minute) chart, a 20‑period EMA is used. A long entry is triggered when the price crosses above the 20‑EMA, while a short entry is triggered when it crosses below. 3. Risk Management: The risk per trade is set to 0.5% (riskPerc = 0.005) of the entry price. The stop loss is placed 0.5% away from the entry, and the take profit is set at twice that distance (1:2 risk–reward). 4. Debug Visuals: Small shape markers (green for longs, red for shorts) are plotted on the chart so you can verify when conditions are met.
Next Steps • Backtesting: Run this strategy on historical 1‑minute data while ensuring your chart is set to 1‑minute. Confirm that the 5‑minute trend filter (ema200_5) is working correctly. • Optimization: You may adjust the EMA lengths, risk percentage, or even the entry conditions (for example, using additional confirmation like volume or other indicators) to further optimize profitability for scalping. • Real-Time Considerations: Scalping strategies can be sensitive to execution delays and spread. When forward-testing, consider the fill conditions and the effect of recalculation on every tick.
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının yazarı komut dosyasını açık kaynak olarak yayınlamıştır, böylece yatırımcılar betiği anlayabilir ve doğrulayabilir. Yazar çok yaşa! Ücretsiz olarak kullanabilirsiniz, ancak bu kodun yayında yeniden kullanımı Ev kurallarına tabidir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.
Bu komut dosyasını bir grafikte kullanmak ister misiniz?
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.