// === CALCULATIONS === // EMAs emaS = ta.ema(close, emaS_value) emaB = ta.ema(close, emaB_value)
// RSI rsi = ta.rsi(rsi_source, rsi_length)
// IME-Band Cross Conditions isGreenCrossover = emaS > emaB // Green band isRedCrossover = emaS < emaB // Red band
// Track Green Cross Confirmation var bool isGreenConfirmed = false if (isGreenCrossover and not isGreenCrossover[1]) // First green crossover isGreenConfirmed := true
if (not isGreenCrossover) isGreenConfirmed := false
// Entry Condition: RSI above 70 on second green candle entryCondition = isGreenConfirmed and rsi > rsi_overbought and isGreenCrossover
// Exit Condition: Red band confirmed exitCondition = isRedCrossover
// === STRATEGY RULES === // Stop Loss: Lowest point of crossover var float stopLoss = na if (isGreenCrossover and not isGreenCrossover[1]) stopLoss := emaB // Set stop loss to EMA Big (crossover point)
// Entry and Exit Trades if (entryCondition) strategy.entry("Buy", strategy.long) stopLoss := na // Reset stop loss after entry
if (exitCondition) strategy.close("Buy")
// Stop Loss logic if (strategy.position_size > 0 and not na(stopLoss)) strategy.exit("Stop Loss", from_entry="Buy", stop=stopLoss)
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.