Pine Script v4 · Strategy
Aroon Oscillator Strategy
A Pine Script v4 strategy built on RSI (close, 13), EMA (close, 5) and Highestbars (high, aroonLength+1). It has 5 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 is one contract and pays no commission. 4 settings; defaults include Aroon Length 169, RSI Length 13 and Stop Loss% 5.
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 Aroon Oscillator 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 Aroon Oscillator Strategy do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings; it opened a long position that was still open on the last bar, so there is no result to report. On ETHUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
- Can Aroon Oscillator 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.
- Does Aroon Oscillator Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Aroon Oscillator Strategy run in Zeal Terminal?
- Yes
- It compiles in 22 ms and runs 1,000 bars in 45 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 6.78%
- −$678.18
One run with the author's default settings, $10,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
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 37, 49, 53, 56. The upgraded version below moves each call inside an if block.
-
Note
Uses transp =, which v5 removed line 27
transp = on line 27, 29. v5 folds the transparency into the colour with color.new(c, transp).
-
Note
Uses long =, which v5 renamed line 37
long = on line 37, 43. 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 rsi → ta.rsi, ema → ta.ema, highestbars → ta.highestbars, lowestbars → ta.lowestbars, crossover → ta.crossover, abs → math.abs, tostring → str.tostring, crossunder → ta.crossunder.
- 4 strategy calls use the when = argument (line 37, 49, 53, 56). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 1 trades and the same P&L on ETHUSDT 4h, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 12: rsi → ta.rsi
- Line 13: ema → ta.ema
- Line 14: ema → ta.ema
- Line 15: ema → ta.ema
- Line 19: highestbars → ta.highestbars
16 more edits
- Line 20: lowestbars → ta.lowestbars
- Line 27: transp = 50 → color.new(aroonOsc>0?color.green:color.red, 50)
- Line 29: transp = 25 → color.new(aroonOsc>90?color.purple:na, 25)
- Line 37: long = true → direction = strategy.long
- Line 37: crossover → ta.crossover
- Line 39: crossover → ta.crossover
- Line 41: abs → math.abs
- Line 43: tostring → str.tostring
- Line 43: long = true → direction = strategy.long
- Line 45: abs → math.abs
- Line 49: tostring → str.tostring
- Line 49: abs → math.abs
- Line 49: crossunder → ta.crossunder
- Line 53: abs → math.abs
- Line 53: crossunder → ta.crossunder
- Line 56: abs → math.abs
⋯// © mohanee-//@version=4+//@version=5strategy(title="Aroon Oscillator Strategy", overlay=false, pyramiding=2, initial_capital=10000, currency=currency.USD) //default_qty_value=10, default_qty_type=strategy.fixed, ⋯//RSI -rsi13=rsi(close,rsiLength)+rsi13=ta.rsi(close,rsiLength)-fastEma1=ema(close,5)+fastEma1=ta.ema(close,5)-ema13=ema(close,13)+ema13=ta.ema(close,13)-ema169=ema(close,169)+ema169=ta.ema(close,169)exitOnAroonOscCrossingDown = input(true, title="Exit when Aroon Osc cross down zero ")⋯//Aroon oscillator-arronUpper = 100 * (highestbars(high, aroonLength+1) + aroonLength)/aroonLength+arronUpper = 100 * (ta.highestbars(high, aroonLength+1) + aroonLength)/aroonLength-aroonLower = 100 * (lowestbars(low, aroonLength+1) + aroonLength)/aroonLength+aroonLower = 100 * (ta.lowestbars(low, aroonLength+1) + aroonLength)/aroonLengtharoonOsc = arronUpper - aroonLower⋯bottomLine = plot(-90,style=plot.style_circles, color=color.red)-fill(oscPlot, midLine, color=aroonOsc>0?color.green:color.red, transp=50)+fill(oscPlot, midLine, color=color.new(aroonOsc>0?color.green:color.red, 50))fill(topLine,bottomLine, color=color.blue)-fill(topLine,oscPlot, color=aroonOsc>90?color.purple:na, transp=25)+fill(topLine,oscPlot, color=color.new(aroonOsc>90?color.purple:na, 25))// RSI ⋯//Entry---strategy.entry(id="Long Entry", comment="LE", qty=(strategy.initial_capital * 0.10)/close, long=true, when= crossover(aroonOsc,0) ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine)+strategy.entry(id="Long Entry", comment="LE", qty=(strategy.initial_capital * 0.10)/close, direction = strategy.long, when= ta.crossover(aroonOsc,0) ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine)//Add-if(strategy.position_size>=1 and aroonOsc>0 and close < strategy.position_avg_price and crossover(rsi13,30))+if(strategy.position_size>=1 and aroonOsc>0 and close < strategy.position_avg_price and ta.crossover(rsi13,30)) qty1=(strategy.initial_capital * 0.30)/close- stopLossVal:= abs(strategy.position_size)>1 ? ( (close > close[1] and close > open and close>strategy.position_avg_price) ? close[1]*(1-stopLoss*0.01) : stopLossVal ) : 0.00 + stopLossVal:= math.abs(strategy.position_size)>1 ? ( (close > close[1] and close > open and close>strategy.position_avg_price) ? close[1]*(1-stopLoss*0.01) : stopLossVal ) : 0.00 //stopLossVal:= abs(strategy.position_size)>1 ? strategy.position_avg_price*(1-stopLoss*0.01) : 0.00 - strategy.order(id="Long Entry", comment="Add SL="+tostring(stopLossVal, "####.##"), qty=qty1, long=true ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine) --+ strategy.order(id="Long Entry", comment="Add SL="+str.tostring(stopLossVal, "####.##"), qty=qty1, direction = strategy.long ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine) --//stopLossVal:= abs(strategy.position_size)>1 ? strategy.position_avg_price*(1-0.5) : 0.00 -stopLossVal:= abs(strategy.position_size)>1 ? ( (close > close[1] and close > open and close>strategy.position_avg_price) ? close[1]*(1-stopLoss*0.01) : stopLossVal ) : 0.00 +stopLossVal:= math.abs(strategy.position_size)>1 ? ( (close > close[1] and close > open and close>strategy.position_avg_price) ? close[1]*(1-stopLoss*0.01) : stopLossVal ) : 0.00 //stopLossVal:= abs(strategy.position_size)>1 ? strategy.position_avg_price*(1-stopLoss*0.01) : 0.00⋯//close partial-strategy.close(id="Long Entry", comment="Partial X SL="+tostring(stopLossVal, "####.##"), qty=strategy.position_size/5, when=abs(strategy.position_size)>=1 and crossunder(aroonOsc, 90) ) //close<ema55 and rsi5Val<20 //ema34<ema55+strategy.close(id="Long Entry", comment="Partial X SL="+str.tostring(stopLossVal, "####.##"), qty=strategy.position_size/5, when=math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 90) ) //close<ema55 and rsi5Val<20 //ema34<ema55//strategy.close(id="Long Entry", comment="Partial X SL="+tostring(stopLossVal, "####.##"), qty=strategy.position_size/3, when=abs(strategy.position_size)>=1 and ( (close - ema169) > ema169*0.10 ) and crossunder(close,ema13)) //close<ema55 and rsi5Val<20 //ema34<ema55 ⋯if(exitOnAroonOscCrossingDown)- strategy.close(id="Long Entry", comment="Exit All", when=abs(strategy.position_size)>=1 and crossunder(aroonOsc, 0) ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89+ strategy.close(id="Long Entry", comment="Exit All", when=math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 0) ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89//close All on stop lossif(not exitOnAroonOscCrossingDown)- strategy.close(id="Long Entry", comment="Stoploss X", when=abs(strategy.position_size)>=1 and close < stopLossVal ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89+ strategy.close(id="Long Entry", comment="Stoploss X", when=math.abs(strategy.position_size)>=1 and close < stopLossVal ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89Same 1 trades and the same P&L on ETHUSDT 4h, 1,000 bars, in Zeal Terminal's engine.
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
- Line 16: input() → input.bool()
- Line 37: when = ta.crossover(aroonOsc,0) → if block
- Line 49: when = math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 90) → if block
- Line 53: when = math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 0) → if block
- Line 56: when = math.abs(strategy.position_size)>=1 and close < stopLossVal → if block
⋯//variables BEGIN-aroonLength=input(169,title="Aroon Length") //square root of 13+aroonLength=input.int(169,title="Aroon Length") //square root of 13-rsiLength=input(13, title="RSI Length")+rsiLength=input.int(13, title="RSI Length")-stopLoss = input(title="Stop Loss%", defval=5, minval=1)+stopLoss = input.int(title="Stop Loss%", defval=5, minval=1)//variables END⋯ema169=ta.ema(close,169)-exitOnAroonOscCrossingDown = input(true, title="Exit when Aroon Osc cross down zero ")+exitOnAroonOscCrossingDown = input.bool(true, title="Exit when Aroon Osc cross down zero ")// Drawings⋯//Entry---strategy.entry(id="Long Entry", comment="LE", qty=(strategy.initial_capital * 0.10)/close, direction = strategy.long, when= ta.crossover(aroonOsc,0) ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine)+if ta.crossover(aroonOsc,0)+ strategy.entry(id="Long Entry", comment="LE", qty=(strategy.initial_capital * 0.10)/close, direction = strategy.long ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine)//Add⋯//close partial-strategy.close(id="Long Entry", comment="Partial X SL="+str.tostring(stopLossVal, "####.##"), qty=strategy.position_size/5, when=math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 90) ) //close<ema55 and rsi5Val<20 //ema34<ema55+if math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 90)+ strategy.close(id="Long Entry", comment="Partial X SL="+str.tostring(stopLossVal, "####.##"), qty=strategy.position_size/5 ) //close<ema55 and rsi5Val<20 //ema34<ema55//strategy.close(id="Long Entry", comment="Partial X SL="+tostring(stopLossVal, "####.##"), qty=strategy.position_size/3, when=abs(strategy.position_size)>=1 and ( (close - ema169) > ema169*0.10 ) and crossunder(close,ema13)) //close<ema55 and rsi5Val<20 //ema34<ema55 ⋯if(exitOnAroonOscCrossingDown)- strategy.close(id="Long Entry", comment="Exit All", when=math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 0) ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89+ if math.abs(strategy.position_size)>=1 and ta.crossunder(aroonOsc, 0)+ strategy.close(id="Long Entry", comment="Exit All" ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89//close All on stop lossif(not exitOnAroonOscCrossingDown)- strategy.close(id="Long Entry", comment="Stoploss X", when=math.abs(strategy.position_size)>=1 and close < stopLossVal ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89+ if math.abs(strategy.position_size)>=1 and close < stopLossVal+ strategy.close(id="Long Entry", comment="Stoploss X" ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89Does it run in Pine Script v6?
Yes
Same 1 trades and the same P&L on ETHUSDT 4h, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.
⋯// © mohanee-//@version=5+//@version=6strategy(title="Aroon Oscillator Strategy", overlay=false, pyramiding=2, 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Aroon Length | 169 | int | arronUpper aroonLower |
| RSI Length | 13 | int | rsi13 |
| Stop Loss% | 5 | int · min 1 | stopLossVal |
| Exit when Aroon Osc cross down zero | true | bool | close Long Entry close Long Entry line 52 line 55 |
What it calculates
- RSI (
rsi,ta.rsiin v5)close, RSI Length (13)rsi13 · line 12 - EMA (
ema,ta.emain v5)close, 5fastEma1 · line 13 - EMA (
ema,ta.emain v5)close, 13ema13 · line 14 - EMA (
ema,ta.emain v5)close, 169ema169 · line 15 - Highestbars (
highestbars,ta.highestbarsin v5)high, aroonLength+1arronUpper · line 19 - Lowestbars (
lowestbars,ta.lowestbarsin v5)low, aroonLength+1aroonLower · line 20
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long Entry long | crossover(aroonOsc,0) | On | 37 |
| order Long Entry long | (strategy.position_size>=1 and aroonOsc>0 and close < strategy.position_avg_price and crossover(rsi13,30)) | On | 43 |
| Close Long Entry | abs(strategy.position_size)>=1 and crossunder(aroonOsc, 90) | On | 49 |
| Close Long Entry | abs(strategy.position_size)>=1 and crossunder(aroonOsc, 0) | On | 53 |
| Close Long Entry | abs(strategy.position_size)>=1 and close < stopLossVal | On | 56 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | 0.0% | +102.5% | 0 | 0% | — | 6.8% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.5% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 11.5% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.6% | +8.4% | 1 | 100% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −22.0% | +16.7% | 9 | 22% | 0.13 | 28.4% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +3.0% | +21.5% | 8 | 75% | 13.98 | 1.7% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +1.3% | +148.3% | 4 | 75% | 7.72 | 2.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.9% | +17.1% | 3 | 100% | — | 0.3% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Aroon Oscillator Strategy this page | — | v4 strategy | 0.0% | 0 | 6.8% |
| EMA_HMA_RSI_Strategy by mohanee | rsi ema highestbars lowestbars | v4 strategy | No trades on this market | ||
| RSI Cross [xaurr] by livetrend | rsi ema | v4 strategy | +24.4% | 53 | 35.3% |
| Bitpanda Coinrule Template by joshuajcoop01 | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrule | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI of VWAP by mohanee | rsi ema | v4 strategy | No trades on this market | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 22 ms | With a workaround 1,000 bars in 45 ms | Not measured |
| PineTS | No 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 (lines 37, 43) 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//@version=4strategy(title="Aroon Oscillator Strategy", overlay=false, pyramiding=2, initial_capital=10000, currency=currency.USD) //default_qty_value=10, default_qty_type=strategy.fixed, var stopLossVal=0.00//variables BEGINaroonLength=input(169,title="Aroon Length") //square root of 13rsiLength=input(13, title="RSI Length")stopLoss = input(title="Stop Loss%", defval=5, minval=1)//variables END//RSI rsi13=rsi(close,rsiLength)fastEma1=ema(close,5)ema13=ema(close,13)ema169=ema(close,169)exitOnAroonOscCrossingDown = input(true, title="Exit when Aroon Osc cross down zero ")// Drawings//Aroon oscillatorarronUpper = 100 * (highestbars(high, aroonLength+1) + aroonLength)/aroonLengtharoonLower = 100 * (lowestbars(low, aroonLength+1) + aroonLength)/aroonLengtharoonOsc = arronUpper - aroonLoweraroonMidpoint = 0oscPlot = plot(aroonOsc, color=color.green)midLine= plot(aroonMidpoint, color=color.green)topLine = plot(90,style=plot.style_circles, color=color.green)bottomLine = plot(-90,style=plot.style_circles, color=color.red)fill(oscPlot, midLine, color=aroonOsc>0?color.green:color.red, transp=50)fill(topLine,bottomLine, color=color.blue)fill(topLine,oscPlot, color=aroonOsc>90?color.purple:na, transp=25)// RSI //plot(rsi13, title="RSI", linewidth=2, color=color.purple)//hline(50, title="Middle Line", linestyle=hline.style_dotted)//obLevel = hline(80, title="Overbought", linestyle=hline.style_dotted)//osLevel = hline(30, title="Oversold", linestyle=hline.style_dotted)//fill(obLevel, osLevel, title="Background", color=rsi13 >=30 ? color.green:color.purple, transp=65) // longTermRSI >=50//Entry--strategy.entry(id="Long Entry", comment="LE", qty=(strategy.initial_capital * 0.10)/close, long=true, when= crossover(aroonOsc,0) ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine)//Addif(strategy.position_size>=1 and aroonOsc>0 and close < strategy.position_avg_price and crossover(rsi13,30)) qty1=(strategy.initial_capital * 0.30)/close stopLossVal:= abs(strategy.position_size)>1 ? ( (close > close[1] and close > open and close>strategy.position_avg_price) ? close[1]*(1-stopLoss*0.01) : stopLossVal ) : 0.00 //stopLossVal:= abs(strategy.position_size)>1 ? strategy.position_avg_price*(1-stopLoss*0.01) : 0.00 strategy.order(id="Long Entry", comment="Add SL="+tostring(stopLossVal, "####.##"), qty=qty1, long=true ) //crossover(close,ema34) //and close>ema34 //crossover(rsi5Val,rsiBuyLine) --//stopLossVal:= abs(strategy.position_size)>1 ? strategy.position_avg_price*(1-0.5) : 0.00 stopLossVal:= abs(strategy.position_size)>1 ? ( (close > close[1] and close > open and close>strategy.position_avg_price) ? close[1]*(1-stopLoss*0.01) : stopLossVal ) : 0.00 //stopLossVal:= abs(strategy.position_size)>1 ? strategy.position_avg_price*(1-stopLoss*0.01) : 0.00barcolor(color=strategy.position_size>=1? aroonOsc>90 ? color.purple: color.blue:na)//close partialstrategy.close(id="Long Entry", comment="Partial X SL="+tostring(stopLossVal, "####.##"), qty=strategy.position_size/5, when=abs(strategy.position_size)>=1 and crossunder(aroonOsc, 90) ) //close<ema55 and rsi5Val<20 //ema34<ema55//strategy.close(id="Long Entry", comment="Partial X SL="+tostring(stopLossVal, "####.##"), qty=strategy.position_size/3, when=abs(strategy.position_size)>=1 and ( (close - ema169) > ema169*0.10 ) and crossunder(close,ema13)) //close<ema55 and rsi5Val<20 //ema34<ema55 //close Allif(exitOnAroonOscCrossingDown) strategy.close(id="Long Entry", comment="Exit All", when=abs(strategy.position_size)>=1 and crossunder(aroonOsc, 0) ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89//close All on stop lossif(not exitOnAroonOscCrossingDown) strategy.close(id="Long Entry", comment="Stoploss X", when=abs(strategy.position_size)>=1 and close < stopLossVal ) //close<ema55 and rsi5Val<20 //ema34<ema55 //close<ema89