code

 avatar
unknown
plain_text
2 years ago
1.0 kB
11
Indexable
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Thedoc

//@version=5
strategy("JHMT's Strategy", overlay=true, margin_long=100, margin_short=100)

// Top 3 Indicators for Scalp Trading
// 1. Moving Average Convergence Divergence (MACD)
// 2. Relative Strength Index (RSI)
// 3. Bollinger Bands

// MACD
macd = MACD(close, 12, 26, 9)
macd_hist = macd.hist

// RSI
rsi = RSI(close, 14)

// Bollinger Bands
bb_upper = BollingerBands(close, 20, 2).upperband
bb_lower = BollingerBands(close, 20, 2).lowerband

// Buy Signal
if macd_hist > 0 and rsi < 70 and close > bb_lower
    strategy.entry("Long", strategy.long)

// Sell Signal
if macd_hist < 0 and rsi > 30 and close < bb_upper
    strategy.entry("Short", strategy.short)

// Exit Signal
if macd_hist.crossunder(0)  or rsi.crossesover(70) or rsi.crossesunder(30) or close.crossesover (bb_upper) or close.crossesunder(bb_lower)
    strategy.close("All")
Editor is loading...