搜尋
產品
社群
市場
新聞
經紀商
更多
TW
立即開始
社群
/
投資想法
/
ReversalBreakout Strategy
比特幣
ReversalBreakout Strategy
由passaro.mail提供
關注
關注
2018年9月4日
1
2018年9月4日
//
version
=2
strategy("ReversalBreakout Strategy", overlay=true)
testStartYear = input(2018, "Backtest Start Year")
testStartMonth = input(03, "Backtest Start Month")
testStartDay = input(01, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, 0, 0)
len = input(24,minval=1, title = "Periodo")
ShFL = input(true, type=bool, title = "Show Fractal lines?")
lowline = lowest(close, len)
plot(ShFL ? lowline[1] : na, style=line, linewidth=1, color=green)
highline=highest(close, len)
plot(ShFL ? highline[1] : na, style=line, linewidth=1, color=red)
MidLine = (highline+lowline)/2
plot(ShFL ? MidLine[1] : na, style=line, linewidth=1)
//----------------------------------------------------------------------------------
// === INPUTS RISK MANAGEMENT===
inpTakeProfit = input(defval = 1000, title = "Take Profit", minval = 0)
inpStopLoss = input(defval = 200, title = "Stop Loss", minval = 0)
inpTrailStop = input(defval = 200, title = "Trailing Stop Loss", minval = 0)
inpTrailOffset = input(defval = 0, title = "Trailing Stop Loss Offset", minval = 0)
// === RISK MANAGEMENT VALUE PREP ===
//Se l'input è <1 viene disabilitato
useTakeProfit = inpTakeProfit >= 1 ? inpTakeProfit : na
useStopLoss = inpStopLoss >= 1 ? inpStopLoss : na
useTrailStop = inpTrailStop >= 1 ? inpTrailStop : na
useTrailOffset = inpTrailOffset >= 1 ? inpTrailOffset : na
// === CONDIZIONI LOGICHE ===
aboveHLine = (close>highline[1] and time >= testPeriodStart) ? true : false
belowLLine = (close<lowline[1] and time >= testPeriodStart) ? true : false
// === STRATEGY - LONG POSITION===
strategy.entry(id = "Long", long = true, when = aboveHLine)
// === STRATEGY - SHORT POSITION===
strategy.entry(id = "Short", long = false, when = belowLLine)
// === STRATEGY RISK MANAGEMENT EXECUTION ===
strategy.exit("Exit Long", from_entry = "Long", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
strategy.exit("Exit Short", from_entry = "Short", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
Beyond Technical Analysis
breakout
Technical Indicators
LONG
short
stoploss
strategy
takeprofit
trailingstop
Trend Analysis
passaro.mail
關注
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在
使用條款
閱讀更多資訊。