// Entry and Exit Conditions using Simple Moving Averages longCondition = ta.crossover(fastMA, slowMA) shortCondition = ta.crossunder(fastMA, slowMA)
// Candlestick Patterns Functions isBullishEngulfing() => (open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1]) isBearishEngulfing() => (close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1]) isHammer() => (((high - low) > 3 * (open - close)) and ((close - low) / (.001 + high - low) > 0.6) and ((open - low) / (.001 + high - low) > 0.6)) isInvertedHammer() => (((high - low) > 3 * (open - close)) and ((high - close) / (.001 + high - low) > 0.6) and ((high - open) / (.001 + high - low) > 0.6)) isBullishHarami() => (open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and close - open < open[1] - close[1]) isBearishHarami() => (close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and open - close < close[1] - open[1])
// Calculate SMA for Visualization sma_22 = ta.sma(close, 22) lineColor = close > sma_22 ? color.black : color.black plot(show_sma ? sma_22 : na, color=lineColor, linewidth=1)
// Determine T and TT Labels based on Conditions candleCrossG = ta.crossover(close, sma_22) candleCrossR = ta.crossunder(close, sma_22)
// Place Trades Based on Conditions if (longCondition) strategy.entry("BUY ", strategy.long) strategy.exit("Take Profit", from_entry="Long", limit=close + takeProfitDistance, stop=close - stopLossDistance)
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.
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.