Multi-SMA Strategy - Core SignalsTick-Precise Cross Detection:
Uses bar's high/low for real-time cross detection
Compares current price action with previous bar's position
Works across all timezones and trading sessions
Three-Layer Trend Filter:
Requires 50 > 100 > 200 SMA for uptrends
Requires 50 < 100 < 200 SMA for downtrends
Adds inherent market structure confirmation
Responsive Exit System:
Closes longs when price breaks below 20 SMA
Closes shorts when price breaks above 20 SMA
Uses same tick-precise logic as entries
Universal Time Application:
No fixed time references
Pure price-based calculations
Works on any chart timeframe (1m - monthly)
Signal Logic Summary:
+ Long Entry: Tick cross above 50 SMA + Uptrend hierarchy
- Long Exit: Price closes below 20 SMA
+ Short Entry: Tick cross below 50 SMA + Downtrend hierarchy
- Short Exit: Price closes above 20 SMA
Komut
//@version=5
strategy("Multi-SMA Strategy - Core Signals", overlay=true)
// ———— Universal Inputs ———— //
int smaPeriod1 = input(20, "Fast SMA")
int smaPeriod2 = input(50, "Medium SMA")
bool useTickCross = input(true, "Use Tick-Precise Crosses")
// ———— Timezone-Neutral Calculations ———— //
sma20 = ta.sma(close, smaPeriod1)
sma50 = ta.sma(close, smaPeriod2)
sma100 = ta.sma(close, 100)
sma200 = ta.sma(close, 200)
// ———— Tick-Precise Cross Detection ———— //
golden_cross = useTickCross ?
(high >= sma50 and low < sma50 ) :
ta.crossover(sma20, sma50)
death_cross = useTickCross ?
(low <= sma50 and high > sma50 ) :
ta.crossunder(sma20, sma50)
// ———— Trend Filter ———— //
uptrend = sma50 > sma100 and sma100 > sma200
downtrend = sma50 < sma100 and sma100 < sma200
// ———— Entry Conditions ———— //
longCondition = golden_cross and uptrend
shortCondition = death_cross and downtrend
// ———— Exit Conditions ———— //
exitLong = ta.crossunder(low, sma20)
exitShort = ta.crossover(high, sma20)
// ———— Strategy Execution ———— //
strategy.entry("Long", strategy.long, when=longCondition)
strategy.entry("Short", strategy.short, when=shortCondition)
strategy.close("Long", when=exitLong)
strategy.close("Short", when=exitShort)
// ———— Clean Visualization ———— //
plot(sma20, "20 SMA", color.new(color.blue, 0))
plot(sma50, "50 SMA", color.new(color.red, 0))
plot(sma100, "100 SMA", color.new(#B000B0, 0), linewidth=2)
plot(sma200, "200 SMA", color.new(color.green, 0), linewidth=2)
// ———— Signal Markers ———— //
plotshape(longCondition, "Long Entry", shape.triangleup, location.belowbar, color.green, 0)
plotshape(shortCondition, "Short Entry", shape.triangledown, location.abovebar, color.red, 0)
plotshape(exitLong, "Long Exit", shape.xcross, location.abovebar, color.blue, 0)
plotshape(exitShort, "Short Exit", shape.xcross, location.belowbar, color.orange, 0)
Longposition
RSI + MA StrategyHello, everyone!
We have just released an innovative strategy for TradingView. It allows you to facilitate the trading process when you have to use both indicators.
This strategy is:
User-friendly
Configurable
Equipped with the combination of Relative Strength Index (RSI) and Moving Average (MA) indicators
Designed with all required functions to manage positions
Features
The RSI+MA strategy can:
Identify entry points for Long and Short positions.
Depict RSI and MA values concerning each other.
Reduce visual congestion and import usability thanks to using a combo of 2 indicators.
Allow using pivot trading. The RSI+MA strategy will enter a Long position according to the Short position conditions. And vice versa.
Note! If you want to open a Long position, the RSI line should cross MA from top to bottom. If you want to open a Short position, RSI has to cross MA from bottom to top.
Parameters
We have equipped our strategy with more than 14 additional parameters. So, you can configure the EA according to your needs!
Inputs :
Use Reverse Trade — allows swapping Long and Short positions opening conditions.
Resolution — allows you to view an indicator with data on a higher or lower timeframe on the current chart.
RSI Length
RSI Source: Open, High, Low, Close, HL2, HLC3, OHLC4
Show MA — allows you to enable or disable MA displaying.
MA Length
MA Offset
Style:
RSI — RSI indicator line color and style settings.
MA — MA indicator line color and style configuration.
Upper Band — allows customizing line style, color, and RSI upper bound value.
Lower Band — allows you to customize line style, color, and RSI lower bound value.
Background — background color setting within the RSI upper and lower borders.
Precision — number of decimals for RSI values.
Note! Try RSI+MA on your demo account first before going live.
Bollinger Band BreakoutIt is a long only strategy.
1. Buy when price breaks out of the upper band.
2. Exit has two options. Option 1 allows you to exit using lower band. Option 2 allows you to exit using moving average.
3. Option 1 preferred over option 2 if the instrument is highly volatile.
4. Slippage and commissions are not considered in the return calculation.
LFH/ Long positions using MACD histogram, long EMA and short EMADisclaimer: I'm a noob.
Hey there!
I'm trying to implement a script which enter market long position when long EMA crossover short EMA and MACD histogram is positive and histogram at T time is lesser than histogram at T-1.
And when short EMA crossover long EMA, plus MACD histogram is negative and histogram at T is greater than histogram at T-1, I want the script to exit market long position.
Now, I have something pretty close to what I am looking for. What I am missing and can't figure out yet is:
How to moderate entries, ie. I would like it to enter positions when trends are really interesting not just every time the conditions are fulfilled (same for exits) as there is way too much positions
I need to find a way to exit appropriated positions.