OPEN-SOURCE SCRIPT
SMA25 vs SMA150 – Reentry nur bei Gap-Expansion version 1

📈 Strategy: SMA25 vs. SMA150 – Reentry with Gap Expansion
This trend-following strategy trades long positions only during strong uptrends.
It combines mid-term trend confirmation (SMA150) with short-term momentum (SMA25), and includes strict entry, reentry, and exit conditions to capture sustained bullish phases while cutting weak setups early.
🟢 Entry Rules
A long position is opened only if all of the following conditions are met:
Trend filter: The closing price is above SMA150 → confirms an uptrend.
Bullish candle: Current candle closes higher than it opens.
SMA range: SMA25 is 8% to 60% above SMA150.
Momentum slope: SMA25 has increased more strongly than SMA150 over the last 5 candles and is rising.
Trend confirmation: SMA25 has remained above SMA150 for at least 5 candles.
Price distance: The close is at least 0.5% above SMA25.
Stability: The previous two candles also closed above SMA25.
Short-term breakout: Current close is higher than the last 3 closes.
Reentry condition: Allowed only after 20 candles since the last exit and only if a gap expansion occurs above the previous high.
🔴 Exit Rules
A trade is closed as soon as any of the following conditions is triggered:
Dynamic trailing exit:
Close falls 3% below the highest SMA25 value since entry.
Hard stop-loss:
The low of the candle falls 5% or more below the entry price (intrabar trigger).
Early weakness filter:
If any of the first 3 candles after entry closes below the entry price, the trade is exited immediately.
⚙️ Additional Details
Long trades only (no shorts)
No pyramiding – only one position open at a time
Chart background color:
Green = position open
Red = no position
This system targets clean, established uptrends, avoids premature entries, and exits quickly when momentum fades.
It’s designed for swing and position traders who prefer systematic, trend-based setups with tight risk control and clear structure.
This trend-following strategy trades long positions only during strong uptrends.
It combines mid-term trend confirmation (SMA150) with short-term momentum (SMA25), and includes strict entry, reentry, and exit conditions to capture sustained bullish phases while cutting weak setups early.
🟢 Entry Rules
A long position is opened only if all of the following conditions are met:
Trend filter: The closing price is above SMA150 → confirms an uptrend.
Bullish candle: Current candle closes higher than it opens.
SMA range: SMA25 is 8% to 60% above SMA150.
Momentum slope: SMA25 has increased more strongly than SMA150 over the last 5 candles and is rising.
Trend confirmation: SMA25 has remained above SMA150 for at least 5 candles.
Price distance: The close is at least 0.5% above SMA25.
Stability: The previous two candles also closed above SMA25.
Short-term breakout: Current close is higher than the last 3 closes.
Reentry condition: Allowed only after 20 candles since the last exit and only if a gap expansion occurs above the previous high.
🔴 Exit Rules
A trade is closed as soon as any of the following conditions is triggered:
Dynamic trailing exit:
Close falls 3% below the highest SMA25 value since entry.
Hard stop-loss:
The low of the candle falls 5% or more below the entry price (intrabar trigger).
Early weakness filter:
If any of the first 3 candles after entry closes below the entry price, the trade is exited immediately.
⚙️ Additional Details
Long trades only (no shorts)
No pyramiding – only one position open at a time
Chart background color:
Green = position open
Red = no position
This system targets clean, established uptrends, avoids premature entries, and exits quickly when momentum fades.
It’s designed for swing and position traders who prefer systematic, trend-based setups with tight risk control and clear structure.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน