Ara
Ürünler
Topluluk
Piyasalar
Haberler
Aracı kurum
Daha Fazla
TR
Şimdi başlat
Topluluk
/
Fikirler
/
ReversalBreakout Strategy
Bitcoin
ReversalBreakout Strategy
passaro.mail tarafından
Takip Et
Takip Et
4 Eyl 2018
1
4 Eyl 2018
//
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
Takip Et
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez.
Kullanım Şartları
'nda daha fazlasını okuyun.