Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Stochastic Optimized Trend Tracker -Strategy-

A Pine Script v4 strategy built on Stoch (close, high), Crossover (src, OTT[2]) and Crossunder (src, OTT[2]). It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 14 settings; defaults include %K Length 250, %K Smoothing 50 and Source close.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does Stochastic Optimized Trend Tracker -Strategy- repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Stochastic Optimized Trend Tracker -Strategy- do on BTCUSDT 1D with default settings?
+24.42%
From 26 Jan 2024 to 21 Oct 2026, over 1 closed trade, against +102.5% for buy and hold. A backtest, not investment advice.
Can Stochastic Optimized Trend Tracker -Strategy- be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
What alerts does Stochastic Optimized Trend Tracker -Strategy- have?
3
Price Cross Alert; Price Crossover Alarm; Price Crossunder Alarm.
Does Stochastic Optimized Trend Tracker -Strategy- use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Upper Band
  • Lower Band
  • %K
  • OTT
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (14)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctUpper Band$132,054$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
+24.42%
$24,422.30
Buy and hold
+102.5%
same period
Closed trades
1
1 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
6.00%
−$6,002.77

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A long position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    1 setting does nothing

    “=Backtest Inputs=” is declared but never read.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    Uses an argument v6 removed

    when = on line 76, 78. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 39

    transp = on line 39, 56, 61, 63. v5 folds the transparency into the colour with color.new(c, transp).

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames sum → math.sum, abs → math.abs, stoch → ta.stoch, max → math.max, min → math.min, cross → ta.cross, crossover → ta.crossover, crossunder → ta.crossunder.
  • 2 strategy calls use the when = argument (line 76, 78). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 1 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 1: //@version=4 → //@version=5
  • Line 12: input(type = input.float) → input.float()
  • Line 13: input(type = input.bool) → input.bool()
  • Line 14: input(type = input.bool) → input.bool()
  • Line 19: sum → math.sum
  • Line 20: sum → math.sum
18 more edits
  • Line 23: abs → math.abs
  • Line 23: abs → math.abs
  • Line 25: stoch → ta.stoch
  • Line 31: sum → math.sum
  • Line 32: sum → math.sum
  • Line 35: abs → math.abs
  • Line 35: abs → math.abs
  • Line 39: transp = 80 → color.new(#9915FF, 80)
  • Line 45: max → math.max
  • Line 48: min → math.min
  • Line 56: transp = 0 → color.new(OTTC, 0)
  • Line 57: cross → ta.cross
  • Line 58: crossover → ta.crossover
  • Line 59: crossunder → ta.crossunder
  • Line 60: crossover → ta.crossover
  • Line 61: transp = 0 → color.new(color.green, 0)
  • Line 62: crossunder → ta.crossunder
  • Line 63: transp = 0 → color.new(color.red, 0)
-//@version=4+//@version=5// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯length=input(3, "OTT Period", minval=1)-percent=input(0.618, "OTT Percent", type=input.float, step=0.1, minval=0)+percent=input.float(0.618, "OTT Percent", step=0.1, minval=0)-showsupport = input(title="Show Support Line?", type=input.bool, defval=false)+showsupport = input.bool(title="Show Support Line?", defval=false)-showsignalsc = input(title="Show Stochastic/OTT Crossing Signals?", type=input.bool, defval=false)+showsignalsc = input.bool(title="Show Stochastic/OTT Crossing Signals?", defval=false)Var_Func1(src1,length)=>⋯    vdd11=src1<src1[1] ? src1[1]-src1 : 0-    vUD1=sum(vud11,9)+    vUD1=math.sum(vud11,9)-    vDD1=sum(vdd11,9)+    vDD1=math.sum(vdd11,9)    vCMO1=nz((vUD1-vDD1)/(vUD1+vDD1))    VAR1=0.0-    VAR1:=nz(valpha1*abs(vCMO1)*src1)+(1-valpha1*abs(vCMO1))*nz(VAR1[1])+    VAR1:=nz(valpha1*math.abs(vCMO1)*src1)+(1-valpha1*math.abs(vCMO1))*nz(VAR1[1])VAR1=Var_Func1(src1,length)-k = Var_Func1(stoch(close, high, low, periodK), smoothK)+k = Var_Func1(ta.stoch(close, high, low, periodK), smoothK)src=k+1000⋯    vdd1=src<src[1] ? src[1]-src : 0-    vUD=sum(vud1,9)+    vUD=math.sum(vud1,9)-    vDD=sum(vdd1,9)+    vDD=math.sum(vdd1,9)    vCMO=nz((vUD-vDD)/(vUD+vDD))    VAR=0.0-    VAR:=nz(valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*nz(VAR[1])+    VAR:=nz(valpha*math.abs(vCMO)*src)+(1-valpha*math.abs(vCMO))*nz(VAR[1])VAR=Var_Func(src,length)⋯h1 = hline(1020, "Lower Band", color=#606060)-fill(h0, h1, color=#9915FF, transp=80, title="Background")+fill(h0, h1, color=color.new(#9915FF, 80), title="Background")plot(k+1000, title="%K", color=#0094FF)⋯longStopPrev = nz(longStop[1], longStop)-longStop := MAvg > longStopPrev ? max(longStop, longStopPrev) : longStop+longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStopshortStop =  MAvg + farkshortStopPrev = nz(shortStop[1], shortStop)-shortStop := MAvg < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop+shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStopdir = 1⋯OTTC = #B800D9 -pALL=plot(nz(OTT[2]), color=OTTC, linewidth=2, title="OTT", transp=0)+pALL=plot(nz(OTT[2]), color=color.new(OTTC, 0), linewidth=2, title="OTT")-alertcondition(cross(src, OTT[2]), title="Price Cross Alert", message="OTT - Price Crossing!")+alertcondition(ta.cross(src, OTT[2]), title="Price Cross Alert", message="OTT - Price Crossing!")-alertcondition(crossover(src, OTT[2]), title="Price Crossover Alarm", message="PRICE OVER OTT - BUY SIGNAL!")+alertcondition(ta.crossover(src, OTT[2]), title="Price Crossover Alarm", message="PRICE OVER OTT - BUY SIGNAL!")-alertcondition(crossunder(src, OTT[2]), title="Price Crossunder Alarm", message="PRICE UNDER OTT - SELL SIGNAL!")+alertcondition(ta.crossunder(src, OTT[2]), title="Price Crossunder Alarm", message="PRICE UNDER OTT - SELL SIGNAL!")-buySignalc = crossover(src, OTT[2])+buySignalc = ta.crossover(src, OTT[2])-plotshape(buySignalc and showsignalsc ? OTT*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)+plotshape(buySignalc and showsignalsc ? OTT*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.white)-sellSignallc = crossunder(src, OTT[2])+sellSignallc = ta.crossunder(src, OTT[2])-plotshape(sellSignallc and showsignalsc ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)+plotshape(sellSignallc and showsignalsc ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.white)dummy0 = input(true, title = "=Backtest Inputs=")⋯

Clean v5

VerifiedDownload the v5 script

Same 1 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.source()
  • Line 11: input() → input.int()
  • Line 64: input() → input.bool()
  • Line 65: input() → input.int()
7 more edits
  • Line 66: input() → input.int()
  • Line 67: input() → input.int()
  • Line 68: input() → input.int()
  • Line 69: input() → input.int()
  • Line 70: input() → input.int()
  • Line 76: when = Timerange() → if block
  • Line 78: when = Timerange() → if block
⋯strategy(title="Stochastic Optimized Trend Tracker", shorttitle="SOTT", format=format.price, precision=2)-periodK = input(250, title="%K Length", minval=1)+periodK = input.int(250, title="%K Length", minval=1)-smoothK = input(50, title="%K Smoothing", minval=1)+smoothK = input.int(50, title="%K Smoothing", minval=1)-src1 = input(close, title="Source")+src1 = input.source(close, title="Source")-length=input(3, "OTT Period", minval=1)+length=input.int(3, "OTT Period", minval=1)percent=input.float(0.618, "OTT Percent", step=0.1, minval=0)⋯plotshape(sellSignallc and showsignalsc ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.white)-dummy0 = input(true, title = "=Backtest Inputs=")+dummy0 = input.bool(true, title = "=Backtest Inputs=")-FromDay    = input(defval = 1, title = "From Day", minval = 1, maxval = 31)+FromDay    = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31)-FromMonth  = input(defval = 1, title = "From Month", minval = 1, maxval = 12)+FromMonth  = input.int(defval = 1, title = "From Month", minval = 1, maxval = 12)-FromYear   = input(defval = 2005, title = "From Year", minval = 2005)+FromYear   = input.int(defval = 2005, title = "From Year", minval = 2005)-ToDay      = input(defval = 1, title = "To Day", minval = 1, maxval = 31)+ToDay      = input.int(defval = 1, title = "To Day", minval = 1, maxval = 31)-ToMonth    = input(defval = 1, title = "To Month", minval = 1, maxval = 12)+ToMonth    = input.int(defval = 1, title = "To Month", minval = 1, maxval = 12)-ToYear     = input(defval = 9999, title = "To Year", minval = 2006)+ToYear     = input.int(defval = 9999, title = "To Year", minval = 2006)Start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)⋯if buySignalc-    strategy.entry("Long", strategy.long,when=Timerange())+    if Timerange()+        strategy.entry("Long", strategy.long)if sellSignallc-    strategy.entry("Short", strategy.short,when=Timerange())+    if Timerange()+        strategy.entry("Short", strategy.short)

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 1 before, 0 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

-//@version=5+//@version=6// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
%K Length250int · min 1k
%K Smoothing50int · min 1k
Sourceclosesourcevud11 vdd11 VAR1
OTT Period3int · min 1valpha1 VAR1 valpha VAR MAvg
OTT Percent0.618float · min 0 · step 0.1fark OTT
Show Support Line?falseboolSupport Line
Show Stochastic/OTT Crossing Signals?falseboolBuy Sell
=Backtest Inputs=trueboolunused
From Day1int · min 1 · max 31Start
From Month1int · min 1 · max 12Start
From Year2005int · min 2005Start
To Day1int · min 1 · max 31Finish
To Month1int · min 1 · max 12Finish
To Year9999int · min 2006Finish

What it calculates

  • Stoch (stoch, ta.stoch in v5)close, high, low, %K Length (250)k · line 25
  • Crossover (crossover, ta.crossover in v5)src, OTT[2]buySignalc · line 60
  • Crossunder (crossunder, ta.crossunder in v5)src, OTT[2]sellSignallc · line 62

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

lowlowprice datahighhighprice dataclosecloseprice dataperiodK%K Lengthsetting · 250smoothK%K Smoothingsetting · 50lengthOTT Periodsetting · 3percentOTT Percentsetting · 0.618FromYearFrom Yearsetting · 2005FromMonthFrom Monthsetting · 1FromDayFrom Daysetting · 1ToYearTo Yearsetting · 9999ToMonthTo Monthsetting · 1ToDayTo Daysetting · 1kStoch→ kbuySignalcCrossover→ buySignalcsellSignallcCrossunder→ sellSignallcvalpha1, valphavalpha1 · valpha2 valuesvud11, vdd11vud11 · vdd112 valuesvUD1vUD1valuevDD1vDD1valuevCMO1vCMO1valueVAR1VAR1valuesrcsrcvaluevud1, vdd1vud1 · vdd12 valuesvUDvUDvaluevDDvDDvaluevCMOvCMOvalueVAR, MAvgVAR · MAvg2 valuesfarkfarkvaluelongStoplongStopvaluelongStopPrevlongStopPrevvalueshortStopshortStopvalueshortStopPrevshortStopPrevvaluedirdirvalueMTMTvalueOTTOTTvalueStartStartvalueFinishFinishvalueOTTCColourOTTCentry:LongOpen Longstrategy.entryentry:ShortOpen Shortstrategy.entryhline:37hlinehlinehline:38hlinehlinefill:BackgroundBackgroundfillplot:40%Kplotplot:54Support Lineplotplot:56OTTplotalertcondition:57Price Cross Alertalertconditionalertcondition:58Price Crossover Alarmalertconditionalertcondition:59Price Crossunder Alarmalertconditionplotshape:61Buyplotshapeplotshape:63Sellplotshape

Order rules

OrderFires whenBy defaultLine
Open Long longTimerange()On76
Open Short shortTimerange()On78

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
Price Cross AlertalertconditionOTT - Price Crossing!57
Price Crossover AlarmalertconditionPRICE OVER OTT - BUY SIGNAL!58
Price Crossunder AlarmalertconditionPRICE UNDER OTT - SELL SIGNAL!59

Does it repaint?

No

No repainting patterns in the source.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+24.4%+102.5%1100%—6.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+6.8%+5.5%250%2.066.6%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+1.1%+9.8%367%157.300.5%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.4%+8.4%425%0.270.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%333%0.520.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%250%11.160.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.5%+148.3%367%12.060.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.1%+17.1%20%0.000.1%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market0—$0.00
Sideways market1100%$24,422.30
Falling market0—$0.00

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

0.0%

The 95th percentile of the worst drawdown when the same 1 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.0% to 0.0%; the tick is what actually happened, 0.0%. Order luck alone moves it this much.

0%1%
All 1 trades
SideEntryExitBarsP&L
short5 Nov 2025 101,497.0023 Aug 2026 77,074.90291$24,422.30

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Stochastic Optimized Trend Tracker -Strategy- this page—v4 strategy+24.4%16.0%
VWAP Stoch Long Trailing Stop without wednesday and thursday by Drflexfunkstochv4 strategyNo trades on this market
(IK) Stoch-60-15 by tapRoot_codingstochv4 strategyNo trades on this market
2x take profit, move stop loss to entry by fpsd4vestochv5 strategy−0.5%661.7%
Stochastic Oscillator by Zeal Terminalstochv5 indicatorindicator

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 26 msYes 1,000 bars in 99 msNot measured
PineTSNo v5 and v6 only—Not measured

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report. PineTS runs Pine Script v5 and v6 only.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

//@version=4// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © KivancOzbilgic//created by: @Anil_Ozeksi//developer: ANIL ÖZEKŞİ//author: @kivancozbilgicstrategy(title="Stochastic Optimized Trend Tracker", shorttitle="SOTT", format=format.price, precision=2)periodK = input(250, title="%K Length", minval=1)smoothK = input(50, title="%K Smoothing", minval=1)src1 = input(close, title="Source")length=input(3, "OTT Period", minval=1)percent=input(0.618, "OTT Percent", type=input.float, step=0.1, minval=0)showsupport = input(title="Show Support Line?", type=input.bool, defval=false)showsignalsc = input(title="Show Stochastic/OTT Crossing Signals?", type=input.bool, defval=false)Var_Func1(src1,length)=>    valpha1=2/(length+1)    vud11=src1>src1[1] ? src1-src1[1] : 0    vdd11=src1<src1[1] ? src1[1]-src1 : 0    vUD1=sum(vud11,9)    vDD1=sum(vdd11,9)    vCMO1=nz((vUD1-vDD1)/(vUD1+vDD1))    VAR1=0.0    VAR1:=nz(valpha1*abs(vCMO1)*src1)+(1-valpha1*abs(vCMO1))*nz(VAR1[1])VAR1=Var_Func1(src1,length)k = Var_Func1(stoch(close, high, low, periodK), smoothK)src=k+1000Var_Func(src,length)=>    valpha=2/(length+1)    vud1=src>src[1] ? src-src[1] : 0    vdd1=src<src[1] ? src[1]-src : 0    vUD=sum(vud1,9)    vDD=sum(vdd1,9)    vCMO=nz((vUD-vDD)/(vUD+vDD))    VAR=0.0    VAR:=nz(valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*nz(VAR[1])VAR=Var_Func(src,length)h0 = hline(1080, "Upper Band", color=#606060)h1 = hline(1020, "Lower Band", color=#606060)fill(h0, h1, color=#9915FF, transp=80, title="Background")plot(k+1000, title="%K", color=#0094FF)MAvg=Var_Func(src, length)fark=MAvg*percent*0.01longStop = MAvg - farklongStopPrev = nz(longStop[1], longStop)longStop := MAvg > longStopPrev ? max(longStop, longStopPrev) : longStopshortStop =  MAvg + farkshortStopPrev = nz(shortStop[1], shortStop)shortStop := MAvg < shortStopPrev ? min(shortStop, shortStopPrev) : shortStopdir = 1dir := nz(dir[1], dir)dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dirMT = dir==1 ? longStop: shortStopOTT=MAvg>MT ? MT*(200+percent)/200 : MT*(200-percent)/200 plot(showsupport ? MAvg : na, color=#0585E1, linewidth=2, title="Support Line")OTTC = #B800D9 pALL=plot(nz(OTT[2]), color=OTTC, linewidth=2, title="OTT", transp=0)alertcondition(cross(src, OTT[2]), title="Price Cross Alert", message="OTT - Price Crossing!")alertcondition(crossover(src, OTT[2]), title="Price Crossover Alarm", message="PRICE OVER OTT - BUY SIGNAL!")alertcondition(crossunder(src, OTT[2]), title="Price Crossunder Alarm", message="PRICE UNDER OTT - SELL SIGNAL!")buySignalc = crossover(src, OTT[2])plotshape(buySignalc and showsignalsc ? OTT*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)sellSignallc = crossunder(src, OTT[2])plotshape(sellSignallc and showsignalsc ? OTT*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)dummy0 = input(true, title = "=Backtest Inputs=")FromDay    = input(defval = 1, title = "From Day", minval = 1, maxval = 31)FromMonth  = input(defval = 1, title = "From Month", minval = 1, maxval = 12)FromYear   = input(defval = 2005, title = "From Year", minval = 2005)ToDay      = input(defval = 1, title = "To Day", minval = 1, maxval = 31)ToMonth    = input(defval = 1, title = "To Month", minval = 1, maxval = 12)ToYear     = input(defval = 9999, title = "To Year", minval = 2006)Start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)Finish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)Timerange() =>    time >= Start and time <= Finish ? true : falseif buySignalc    strategy.entry("Long", strategy.long,when=Timerange())if sellSignallc    strategy.entry("Short", strategy.short,when=Timerange())