//version=4
strategy("Breakout Strategy", overlay=true)
// Define the inputs
atr_length = input(14, title="ATR Length")
multiplier = input(2.5, title="Multiplier")
// Calculate the ATR
atr = atr(atr_length)
// Calculate the long and short entry levels
long_entry_level = high + atr * multiplier
short_entry_level = low - atr * multiplier
// Plot the entry levels on the chart
plot(long_entry_level, color=color.green)
plot(short_entry_level, color=color.red)
// Set up long and short entry conditions
long_entry_condition = crossover(close, long_entry_level)
short_entry_condition = crossunder(close, short_entry_level)
// Enter long and short trades when the conditions are met
if (long_entry_condition)
strategy.entry(id="Long", long=true, comment="Long")
if (short_entry_condition)
strategy.entry(id="Short", long=false, comment="Short")
Type your question...
strategy("Breakout Strategy", overlay=true)
// Define the inputs
atr_length = input(14, title="ATR Length")
multiplier = input(2.5, title="Multiplier")
// Calculate the ATR
atr = atr(atr_length)
// Calculate the long and short entry levels
long_entry_level = high + atr * multiplier
short_entry_level = low - atr * multiplier
// Plot the entry levels on the chart
plot(long_entry_level, color=color.green)
plot(short_entry_level, color=color.red)
// Set up long and short entry conditions
long_entry_condition = crossover(close, long_entry_level)
short_entry_condition = crossunder(close, short_entry_level)
// Enter long and short trades when the conditions are met
if (long_entry_condition)
strategy.entry(id="Long", long=true, comment="Long")
if (short_entry_condition)
strategy.entry(id="Short", long=false, comment="Short")
Type your question...
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.