Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

PickingupFromBottom Strategy

A Pine Script v4 strategy built on EMA (close, 200), EMA or Highest (sourceForHighs,length1, 7) and EMA or Lowest (sourceForLows,length1, 7). It has 3 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 30% of equity and pays no commission. 9 settings; defaults include EMA 1 Length 200, EMA 2 Length 50 and EMA 3 Length 20.

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 PickingupFromBottom Strategy repaint?
Yes
At least one pattern in the source can repaint: higher-timeframe data.
How did PickingupFromBottom Strategy do on BTCUSDT 1D with default settings?
+14.32%
From 26 Jan 2024 to 21 Oct 2026, over 4 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can PickingupFromBottom Strategy be converted to Pine Script v5?
No
The automatic step from v4 to v5 gives a script that does not run in v5 (Pine Script v5 Error at @L87:C18: No value assigned to the `transp` parameter in color.new()), so no v5 download is offered; the edits are shown below.
Does PickingupFromBottom Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does PickingupFromBottom Strategy run in Zeal Terminal?
Yes
It compiles in 23 ms and runs 1,000 bars in 87 ms, in the browser.

BTCUSDT · 1D · default settings

  • Camariall R4 Resistance EMA 9
  • Camarilla S3 support EMA 9
  • Camarilla Center Point EMA 9
  • HULL 200
  • EMA 200
  • EMA 200 Lows
  • ATR Trailing Stop Loss
  • 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 (9)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$11,434$20,253Equity from $10,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. Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 90) so the engine trades the way the script says.
Net profit
+14.32%
$1,432.36
Buy and hold
+102.5%
same period
Closed trades
4
2 won · 2 lost
Profitable
50.0%
of closed trades
Profit factor
1.17
gross profit ÷ gross loss
Max drawdown
104.25%
−$10,424.80

One run with the author's default settings, $10,000 starting capital, commission as the script sets it. 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.

  • Likely bug

    ema(l3, 9) ignores the settings line 64

    Line 64 hard-codes 9 where line 20 uses “EMA 1 Length”. Changing those settings moves one band but not this one.

    ema(l3, 9)ema(l3, length1)
  • Likely bug

    ema(l3, 50) ignores the settings line 65

    Line 65 hard-codes 50 where line 20 uses “EMA 1 Length”. Changing those settings moves one band but not this one.

    ema(l3, 50)ema(l3, length1)
  • Likely bug

    ema(h4, 9) ignores the settings line 66

    Line 66 hard-codes 9 where line 20 uses “EMA 1 Length”. Changing those settings moves one band but not this one.

    ema(h4, 9)ema(h4, length1)
  • Likely bug

    ema(center, 9) ignores the settings line 67

    Line 67 hard-codes 9 where line 20 uses “EMA 1 Length”. Changing those settings moves one band but not this one.

    ema(center, 9)ema(center, length1)
  • 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 90, 104, 105. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 72

    transp = on line 72, 81, 87, 100. v5 folds the transparency into the colour with color.new(c, transp).

  • Note

    Uses long =, which v5 renamed line 90

    long = on line 90. v5 writes it as direction = strategy.long or strategy.short.

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 wma → ta.wma, round → math.round, sqrt → math.sqrt, ema → ta.ema, security → request.security, highest → ta.highest, lowest → ta.lowest, crossover → ta.crossover, atr → ta.atr, max → math.max, tostring → str.tostring, abs → math.abs, crossunder → ta.crossunder.
  • 3 strategy calls use the when = argument (line 90, 104, 105). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Differs

The v5 version does not run in Zeal Terminal's engine: Pine Script v5 Error at @L87:C18: No value assigned to the `transp` parameter in color.new()

  • Line 6: //@version=4 → //@version=5
  • Line 9: wma → ta.wma
  • Line 9: wma → ta.wma
  • Line 9: wma → ta.wma
  • Line 9: round → math.round
  • Line 9: sqrt → math.sqrt
38 more edits
  • Line 14: input(type = input.source) → input.source()
  • Line 15: input(type = input.source) → input.source()
  • Line 20: ema → ta.ema
  • Line 26: security → request.security
  • Line 27: security → request.security
  • Line 28: security → request.security
  • Line 29: security → request.security
  • Line 64: ema → ta.ema
  • Line 65: ema → ta.ema
  • Line 66: ema → ta.ema
  • Line 67: ema → ta.ema
  • Line 72: transp = 25 → color.new(color.yellow, 25)
  • Line 74: ema → ta.ema
  • Line 74: highest → ta.highest
  • Line 75: ema → ta.ema
  • Line 75: lowest → ta.lowest
  • Line 76: ema → ta.ema
  • Line 76: highest → ta.highest
  • Line 77: ema → ta.ema
  • Line 77: lowest → ta.lowest
  • Line 78: ema → ta.ema
  • Line 78: highest → ta.highest
  • Line 79: ema → ta.ema
  • Line 79: lowest → ta.lowest
  • Line 81: transp = 30 → color.new(color.green, 30)
  • Line 87: transp = 50 removed: the call sets no colour to fold it into, so its default colour loses the transparency
  • Line 88: crossover → ta.crossover
  • Line 90: long = true → direction = strategy.long
  • Line 90: crossover → ta.crossover
  • Line 94: atr → ta.atr
  • Line 97: max → math.max
  • Line 100: transp = 30 → color.new(color.red, 30)
  • Line 104: tostring → str.tostring
  • Line 104: abs → math.abs
  • Line 104: crossunder → ta.crossunder
  • Line 105: tostring → str.tostring
  • Line 105: abs → math.abs
  • Line 105: crossunder → ta.crossunder
⋯//when pivot-//@version=4+//@version=5strategy(title="PickingupFromBottom Strategy", overlay=true, pyramiding=2,     default_qty_type=strategy.percent_of_equity, default_qty_value=30, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed, //HMA-HMA(src1, length1) =>  wma(2 * wma(src1, length1/2) - wma(src1, length1), round(sqrt(length1)))+HMA(src1, length1) =>  ta.wma(2 * ta.wma(src1, length1/2) - ta.wma(src1, length1), math.round(math.sqrt(length1)))//variables BEGIN⋯length3=input(20,title="EMA 3 Length")   -sourceForHighs= input(hlc3, title="Source for Highs", type=input.source)+sourceForHighs= input.source(hlc3, title="Source for Highs")-sourceForLows = input(hlc3, title="Source for Lows" , type=input.source)+sourceForLows = input.source(hlc3, title="Source for Lows" )hiLoLength=input(7, title="HiLo Band Length")⋯//takePartialProfits = input(true, title="Take Partial Profits (if this selected, RSI 13 higher reading over 80 is considered for partial closing ) ")-ema200=ema(close,length1)+ema200=ta.ema(close,length1)hma200=HMA(close,length1)⋯//Get previous day/week bar and avoiding realtime calculation by taking the previous to current bar-sopen = security(syminfo.tickerid, t, open[1], barmerge.gaps_off, barmerge.lookahead_on)+sopen = request.security(syminfo.tickerid, t, open[1], barmerge.gaps_off, barmerge.lookahead_on)-shigh = security(syminfo.tickerid, t, high[1], barmerge.gaps_off, barmerge.lookahead_on)+shigh = request.security(syminfo.tickerid, t, high[1], barmerge.gaps_off, barmerge.lookahead_on)-slow = security(syminfo.tickerid, t, low[1], barmerge.gaps_off, barmerge.lookahead_on)+slow = request.security(syminfo.tickerid, t, low[1], barmerge.gaps_off, barmerge.lookahead_on)-sclose = security(syminfo.tickerid, t, close[1], barmerge.gaps_off, barmerge.lookahead_on)+sclose = request.security(syminfo.tickerid, t, close[1], barmerge.gaps_off, barmerge.lookahead_on)r = shigh-slow⋯//plot(l5, title="L5",color=c5, linewidth=1)////Camarilla pivot points-ema_s3_9=ema(l3, 9)+ema_s3_9=ta.ema(l3, 9)-ema_s3_50=ema(l3, 50)+ema_s3_50=ta.ema(l3, 50)-ema_h4_9=ema(h4, 9)+ema_h4_9=ta.ema(h4, 9)-ema_center_9=ema(center, 9)+ema_center_9=ta.ema(center, 9)plot(ema_h4_9, title="Camariall R4 Resistance EMA 9", color=color.fuchsia)⋯plot(ema_center_9, title="Camarilla Center Point EMA 9", color=color.blue)-plot(hma200, title="HULL 200", color=color.yellow,  transp=25)+plot(hma200, title="HULL 200", color=color.new(color.yellow, 25))plotEma200=plot(ema200, title="EMA 200",  style=plot.style_linebr, linewidth=2 , color=color.orange)-ema200High = ema(highest(sourceForHighs,length1), hiLoLength)+ema200High = ta.ema(ta.highest(sourceForHighs,length1), hiLoLength)-ema200Low= ema(lowest(sourceForLows,length1), hiLoLength)+ema200Low= ta.ema(ta.lowest(sourceForLows,length1), hiLoLength)-ema50High = ema(highest(sourceForHighs,length2), hiLoLength)+ema50High = ta.ema(ta.highest(sourceForHighs,length2), hiLoLength)-ema50Low= ema(lowest(sourceForLows,length2), hiLoLength)+ema50Low= ta.ema(ta.lowest(sourceForLows,length2), hiLoLength)-ema20High = ema(highest(sourceForHighs,length3), hiLoLength)+ema20High = ta.ema(ta.highest(sourceForHighs,length3), hiLoLength)-ema20Low= ema(lowest(sourceForLows,length3), hiLoLength)+ema20Low= ta.ema(ta.lowest(sourceForLows,length3), hiLoLength)//plot(ema200High, title="EMA 200 Highs", linewidth=2, color=color.orange, transp=30)-plotEma200Low=plot(ema200Low, title="EMA 200 Lows", linewidth=2, color=color.green, transp=30, style=plot.style_linebr)+plotEma200Low=plot(ema200Low, title="EMA 200 Lows", linewidth=2, color=color.new(color.green, 30), style=plot.style_linebr)//plot(ema50High, title="EMA 50 Highs", linewidth=2, color=color.blue, transp=30)⋯//Highlight when centerpont crossing up ema200Low a-ema200LowBuyColor=color.new(color.green, transp=50)+ema200LowBuyColor=color.new(color.green)-bgcolor(crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)? ema200LowBuyColor : na)+bgcolor(ta.crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)? ema200LowBuyColor : na)//ema200LowBuyCondition= (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)-strategy.entry(id="ema200Low Buy", comment="LE2", qty=2, long=true,  when= crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low) )  //or (close>open and low<ema20Low and close>ema20Low) ) )     //  // aroonOsc<0+strategy.entry(id="ema200Low Buy", comment="LE2", qty=2, direction = strategy.long,  when= ta.crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low) )  //or (close>open and low<ema20Low and close>ema20Low) ) )     //  // aroonOsc<0//Trailing StopLoss⋯/////////////////////////////////////////////////////-sl_val = atrMultiplier * atr(atrLength)+sl_val = atrMultiplier * ta.atr(atrLength)trailing_sl = 0.0//trailing_sl :=   max(low[1]  - sl_val, nz(trailing_sl[1])) -trailing_sl :=   strategy.position_size>=1 ?  max(low  - sl_val, nz(trailing_sl[1])) :  na+trailing_sl :=   strategy.position_size>=1 ?  math.max(low  - sl_val, nz(trailing_sl[1])) :  na//draw initil stop loss//plot(strategy.position_size>=1 ? trailing_sl : na, color = color.blue , style=plot.style_linebr,  linewidth = 2, title = "stop loss")-plot(trailing_sl, title="ATR Trailing Stop Loss", style=plot.style_linebr, linewidth=1, color=color.red, transp=30)+plot(trailing_sl, title="ATR Trailing Stop Loss", style=plot.style_linebr, linewidth=1, color=color.new(color.red, 30))//Trailing StopLoss⋯/////////////////////////////////////////////////////-strategy.close(id="ema200Low Buy", comment="TP1="+tostring(close - strategy.position_avg_price, "####.##"), qty=1, when=abs(strategy.position_size)>=1 and crossunder(close, ema_h4_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89+strategy.close(id="ema200Low Buy", comment="TP1="+str.tostring(close - strategy.position_avg_price, "####.##"), qty=1, when=math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_h4_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89-strategy.close(id="ema200Low Buy", comment="TP2="+tostring(close - strategy.position_avg_price, "####.##"),  qty=1, when=abs(strategy.position_size)>=1 and crossunder(close, ema_s3_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89+strategy.close(id="ema200Low Buy", comment="TP2="+str.tostring(close - strategy.position_avg_price, "####.##"),  qty=1, when=math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_s3_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89

Clean v5

Not verified

The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L87:C18: No value assigned to the `transp` parameter in color.new()), so this step could not be checked.

  • Line 11: input() → input.int()
  • Line 12: input() → input.int()
  • Line 13: input() → input.int()
  • Line 16: input() → input.int()
  • Line 17: input() → input.int()
  • Line 18: input() → input.float()
4 more edits
  • Line 24: input() → input.string()
  • Line 90: when = ta.crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low) → if block
  • Line 104: when = math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_h4_9) → if block
  • Line 105: when = math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_s3_9) → if block
⋯//variables BEGIN-length1=input(200,title="EMA 1 Length")   +length1=input.int(200,title="EMA 1 Length")   -length2=input(50,title="EMA 2 Length")   +length2=input.int(50,title="EMA 2 Length")   -length3=input(20,title="EMA 3 Length")   +length3=input.int(20,title="EMA 3 Length")   sourceForHighs= input.source(hlc3, title="Source for Highs")sourceForLows = input.source(hlc3, title="Source for Lows" )-hiLoLength=input(7, title="HiLo Band Length")+hiLoLength=input.int(7, title="HiLo Band Length")-atrLength=input(14, title="ATR Length")+atrLength=input.int(14, title="ATR Length")-atrMultiplier=input(3.5, title="ATR Multiplier")+atrMultiplier=input.float(3.5, title="ATR Multiplier")//takePartialProfits = input(true, title="Take Partial Profits (if this selected, RSI 13 higher reading over 80 is considered for partial closing ) ")⋯//study(title="Camarilla Pivots", shorttitle="Camarilla", overlay=true)-t = input(title = "Pivot Resolution", defval="D", options=["D","W","M"])+t = input.string(title = "Pivot Resolution", defval="D", options=["D","W","M"])//Get previous day/week bar and avoiding realtime calculation by taking the previous to current bar⋯//ema200LowBuyCondition= (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)-strategy.entry(id="ema200Low Buy", comment="LE2", qty=2, direction = strategy.long,  when= ta.crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low) )  //or (close>open and low<ema20Low and close>ema20Low) ) )     //  // aroonOsc<0+if ta.crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)+    strategy.entry(id="ema200Low Buy", comment="LE2", qty=2, direction = strategy.long )  //or (close>open and low<ema20Low and close>ema20Low) ) )     //  // aroonOsc<0//Trailing StopLoss⋯/////////////////////////////////////////////////////-strategy.close(id="ema200Low Buy", comment="TP1="+str.tostring(close - strategy.position_avg_price, "####.##"), qty=1, when=math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_h4_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89+if math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_h4_9)+    strategy.close(id="ema200Low Buy", comment="TP1="+str.tostring(close - strategy.position_avg_price, "####.##"), qty=1  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89-strategy.close(id="ema200Low Buy", comment="TP2="+str.tostring(close - strategy.position_avg_price, "####.##"),  qty=1, when=math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_s3_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89+if math.abs(strategy.position_size)>=1 and ta.crossunder(close, ema_s3_9)+    strategy.close(id="ema200Low Buy", comment="TP2="+str.tostring(close - strategy.position_avg_price, "####.##"),  qty=1  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89

Does it run in Pine Script v6?

Not tested

The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L87:C18: No value assigned to the `transp` parameter in color.new()), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯//when pivot-//@version=5+//@version=6strategy(title="PickingupFromBottom Strategy", overlay=true, pyramiding=2,     default_qty_type=strategy.percent_of_equity, default_qty_value=30, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed, ⋯

Settings

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

SettingDefaultType and rangeFeeds
EMA 1 Length200intema200 hma200 ema200High ema200Low line 9
EMA 2 Length50intema50High ema50Low
EMA 3 Length20intema20High ema20Low
Source for Highshlc3sourceema200High ema50High ema20High
Source for Lowshlc3sourceema200Low ema50Low ema20Low
HiLo Band Length7intema200High ema200Low ema50High ema50Low ema20High ema20Low
ATR Length14intsl_val
ATR Multiplier3.5floatsl_val
Pivot ResolutionDstring · options ["D","W","M"]sopen shigh slow sclose

What it calculates

  • EMA (ema, ta.ema in v5)close, EMA 1 Length (200)ema200 · line 20
  • EMA (ema, ta.ema in v5)l3, 9ema_s3_9 · line 64
  • EMA (ema, ta.ema in v5)l3, 50ema_s3_50 · line 65
  • EMA (ema, ta.ema in v5)h4, 9ema_h4_9 · line 66
  • EMA (ema, ta.ema in v5)center, 9ema_center_9 · line 67
  • EMA / Highest (ema, ta.ema in v5)highest(sourceForHighs,length1), HiLo Band Length (7)ema200High · line 74
  • EMA / Lowest (ema, ta.ema in v5)lowest(sourceForLows,length1), HiLo Band Length (7)ema200Low · line 75
  • EMA / Highest (ema, ta.ema in v5)highest(sourceForHighs,length2), HiLo Band Length (7)ema50High · line 76
  • EMA / Lowest (ema, ta.ema in v5)lowest(sourceForLows,length2), HiLo Band Length (7)ema50Low · line 77
  • EMA / Highest (ema, ta.ema in v5)highest(sourceForHighs,length3), HiLo Band Length (7)ema20High · line 78
  • EMA / Lowest (ema, ta.ema in v5)lowest(sourceForLows,length3), HiLo Band Length (7)ema20Low · line 79
  • ATR (atr, ta.atr in v5)ATR Length (14)sl_val · line 94

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.

closecloseprice datalength1EMA 1 Lengthsetting · 200hlc3hlc3price datahiLoLengthHiLo Band Lengthsetting · 7length2EMA 2 Lengthsetting · 50length3EMA 3 Lengthsetting · 20high · low · closehigh · low · closeprice dataatrMultiplierATR Multipliersetting · 3.5atrLengthATR Lengthsetting · 14openopenprice datatPivot Resolutionsetting · Dhighhighprice datalowlowprice dataema200EMA→ ema200ema_s3_9EMA→ ema_s3_9ema_s3_50EMA→ ema_s3_50ema_h4_9EMA→ ema_h4_9ema_center_9EMA→ ema_center_9ema200HighEMA / Highest→ ema200Highema200LowEMA / Lowest→ ema200Lowema50HighEMA / Highest→ ema50Highema50LowEMA / Lowest→ ema50Lowema20HighEMA / Highest→ ema20Highema20LowEMA / Lowest→ ema20Lowsl_valATR→ sl_valhma200hma200valuesopensopenvalueshighshighvalueslowslowvaluesclosesclosevaluerrvaluecenter, h1, h2, h3, h4, l1, l2, l3, l4center · h1 +79 valuesh5h5valuel5l5valuetrailing_sltrailing_slvaluec5, c4, c3, c2, c1, cc, ema200LowBuyColorColourc5 · c4 +5entry:ema200Low BuyOpen ema200Low Buystrategy.entryclose:ema200Low BuyClose ema200Low Buystrategy.closeplot:68Camariall R4 Resistance…plotplot:69Camarilla S3 support EM…plotplot:71Camarilla Center Point …plotplot:72HULL 200plotplot:73EMA 200plotplot:81EMA 200 Lowsplotfill:84Fillfillbgcolor:88bgcolorbgcolorplot:100ATR Trailing Stop Lossplot

Order rules

OrderFires whenBy defaultLine
Open ema200Low Buy longcrossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)On90
Close ema200Low Buyabs(strategy.position_size)>=1 and crossunder(close, ema_h4_9)On104
Close ema200Low Buyabs(strategy.position_size)>=1 and crossunder(close, ema_s3_9)On105

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

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

4/4trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • CheckHigher-timeframe data4 security call(s) use lookahead_on (line 26, 27, 28, 29). Without a [1] offset this reads future bars in history.
  • 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+14.3%+102.5%450%1.17104.2%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+43.3%+5.5%2100%—16.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−7.2%+9.8%617%0.069.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.2%+16.7%40%0.000.3%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.3%+148.3%2100%—0.5%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%1100%—0.0%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 market2100%$9,933.59
Falling market20%−$8,501.23

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

How bad could the drawdown be?

69.0%

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

0%79%
All 4 trades
SideEntryExitBarsP&L
long9 Feb 2026 70,330.4018 Feb 2026 67,503.509−$2,826.86
long9 Feb 2026 70,330.4024 Feb 2026 64,656.0015−$5,674.37
long1 Jul 2026 58,624.708 Jul 2026 63,364.007$4,739.29
long1 Jul 2026 58,624.7012 Jul 2026 63,819.0011$5,194.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
PickingupFromBottom Strategy this page—v4 strategy+14.3%4104.2%
Richard's Strategy by Deepak8369highest lowest atr emav4 strategy+34.6%7026.3%
Classic Long Term Trend Following System by Robrecht99ema highest lowest atrv5 strategy+2.9%51.1%
Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN] by myncryptoatr ema lowest highestv5 strategy−30.7%1063.5%
Strategy for UT Bot Alerts indicator by StrategiesForEveryoneema atr highest lowestv5 strategy−4.5%4215.7%
Simple and Profitable Scalping Strategy (ForexSignals TV) by kevinmck100ema atr highest lowestv5 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 23 msWith a workaround 1,000 bars in 87 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 90) so the engine trades the way the script says.

“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.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © mohanee//Using the lowest of low of ema200, you can find the bottom//wait for price to close below ema200Lows line//when pivot//@version=4strategy(title="PickingupFromBottom Strategy", overlay=true, pyramiding=2,     default_qty_type=strategy.percent_of_equity, default_qty_value=30, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed, //HMAHMA(src1, length1) =>  wma(2 * wma(src1, length1/2) - wma(src1, length1), round(sqrt(length1)))//variables BEGINlength1=input(200,title="EMA 1 Length")   length2=input(50,title="EMA 2 Length")   length3=input(20,title="EMA 3 Length")   sourceForHighs= input(hlc3, title="Source for Highs", type=input.source)sourceForLows = input(hlc3, title="Source for Lows" , type=input.source)hiLoLength=input(7, title="HiLo Band Length")atrLength=input(14, title="ATR Length")atrMultiplier=input(3.5, title="ATR Multiplier")//takePartialProfits = input(true, title="Take Partial Profits (if this selected, RSI 13 higher reading over 80 is considered for partial closing ) ")ema200=ema(close,length1)hma200=HMA(close,length1)////Camarilla pivot points//study(title="Camarilla Pivots", shorttitle="Camarilla", overlay=true)t = input(title = "Pivot Resolution", defval="D", options=["D","W","M"])//Get previous day/week bar and avoiding realtime calculation by taking the previous to current barsopen = security(syminfo.tickerid, t, open[1], barmerge.gaps_off, barmerge.lookahead_on)shigh = security(syminfo.tickerid, t, high[1], barmerge.gaps_off, barmerge.lookahead_on)slow = security(syminfo.tickerid, t, low[1], barmerge.gaps_off, barmerge.lookahead_on)sclose = security(syminfo.tickerid, t, close[1], barmerge.gaps_off, barmerge.lookahead_on)r = shigh-slow//Calculate pivots//center=(sclose)//center=(close[1] + high[1] + low[1])/3center=sclose - r*(0.618)h1=sclose + r*(1.1/12)h2=sclose + r*(1.1/6)h3=sclose + r*(1.1/4)h4=sclose + r*(1.1/2)h5=(shigh/slow)*sclosel1=sclose - r*(1.1/12)l2=sclose - r*(1.1/6)l3=sclose - r*(1.1/4)l4=sclose - r*(1.1/2)l5=sclose - (h5-sclose)//Colors (<ternary conditional operator> expression prevents continuous lines on history)c5=sopen != sopen[1] ? na : color.redc4=sopen != sopen[1] ? na : color.purplec3=sopen != sopen[1] ? na : color.fuchsiac2=sopen != sopen[1] ? na : color.bluec1=sopen != sopen[1] ? na : color.graycc=sopen != sopen[1] ? na : color.blue//Plotting//plot(center, title="Central",color=color.blue, linewidth=2)//plot(h5, title="H5",color=c5, linewidth=1)//plot(h4, title="H4",color=c4, linewidth=2)//plot(h3, title="H3",color=c3, linewidth=1)//plot(h2, title="H2",color=c2, linewidth=1)//plot(h1, title="H1",color=c1, linewidth=1)//plot(l1, title="L1",color=c1, linewidth=1)//plot(l2, title="L2",color=c2, linewidth=1)//plot(l3, title="L3",color=c3, linewidth=1)//plot(l4, title="L4",color=c4, linewidth=2)//plot(l5, title="L5",color=c5, linewidth=1)////Camarilla pivot pointsema_s3_9=ema(l3, 9)ema_s3_50=ema(l3, 50)ema_h4_9=ema(h4, 9)ema_center_9=ema(center, 9)plot(ema_h4_9, title="Camariall R4 Resistance EMA 9", color=color.fuchsia)plot(ema_s3_9, title="Camarilla S3 support EMA 9", color=color.gray, linewidth=1)//plot(ema_s3_50, title="Camarilla S3 support EMA 50", color=color.green, linewidth=2)plot(ema_center_9, title="Camarilla Center Point EMA 9", color=color.blue)plot(hma200, title="HULL 200", color=color.yellow,  transp=25)plotEma200=plot(ema200, title="EMA 200",  style=plot.style_linebr, linewidth=2 , color=color.orange)ema200High = ema(highest(sourceForHighs,length1), hiLoLength)ema200Low= ema(lowest(sourceForLows,length1), hiLoLength)ema50High = ema(highest(sourceForHighs,length2), hiLoLength)ema50Low= ema(lowest(sourceForLows,length2), hiLoLength)ema20High = ema(highest(sourceForHighs,length3), hiLoLength)ema20Low= ema(lowest(sourceForLows,length3), hiLoLength)//plot(ema200High, title="EMA 200 Highs", linewidth=2, color=color.orange, transp=30)plotEma200Low=plot(ema200Low, title="EMA 200 Lows", linewidth=2, color=color.green, transp=30, style=plot.style_linebr)//plot(ema50High, title="EMA 50 Highs", linewidth=2, color=color.blue, transp=30)//plotEma50Low=plot(ema50Low, title="EMA 50 Lows", linewidth=2, color=color.blue, transp=30)fill(plotEma200, plotEma200Low, color=color.green )// Drawings ///////////////////////////////////////////Highlight when centerpont crossing up ema200Low aema200LowBuyColor=color.new(color.green, transp=50)bgcolor(crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)? ema200LowBuyColor : na)//ema200LowBuyCondition= (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low)strategy.entry(id="ema200Low Buy", comment="LE2", qty=2, long=true,  when= crossover(ema_center_9,ema200Low) and (close[1]<ema200Low or close[2]<ema200Low or close[3]<ema200Low) )  //or (close>open and low<ema20Low and close>ema20Low) ) )     //  // aroonOsc<0//Trailing StopLoss////// Calculate trailing SL/////////////////////////////////////////////////////sl_val = atrMultiplier * atr(atrLength)trailing_sl = 0.0//trailing_sl :=   max(low[1]  - sl_val, nz(trailing_sl[1])) trailing_sl :=   strategy.position_size>=1 ?  max(low  - sl_val, nz(trailing_sl[1])) :  na//draw initil stop loss//plot(strategy.position_size>=1 ? trailing_sl : na, color = color.blue , style=plot.style_linebr,  linewidth = 2, title = "stop loss")plot(trailing_sl, title="ATR Trailing Stop Loss", style=plot.style_linebr, linewidth=1, color=color.red, transp=30)//Trailing StopLoss////// Calculate trailing SL/////////////////////////////////////////////////////strategy.close(id="ema200Low Buy", comment="TP1="+tostring(close - strategy.position_avg_price, "####.##"), qty=1, when=abs(strategy.position_size)>=1 and crossunder(close, ema_h4_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89strategy.close(id="ema200Low Buy", comment="TP2="+tostring(close - strategy.position_avg_price, "####.##"),  qty=1, when=abs(strategy.position_size)>=1 and crossunder(close, ema_s3_9)  )  //close<ema55 and rsi5Val<20 //ema34<ema55  //close<ema89