Pine Script v4 · Strategy
Aphrodite
A Pine Script v4 strategy built on SMA (ohlc4, 27) and Stdev (ohlc4, 27). It has 8 order rules, 4 entries among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 1% of equity and pays 0.075% commission. 3 settings; defaults include Day of Month 3, Month 10 and Rng 1.0.
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 Aphrodite repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
- How did Aphrodite do on BTCUSDT 1D with default settings?
- +0.02%
- From 26 Jan 2024 to 21 Oct 2026, over 6 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Aphrodite be converted to Pine Script v5?
- No
- The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
- Does Aphrodite use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Aphrodite run in Zeal Terminal?
- Yes
- It compiles in 93 ms and runs 1,000 bars in 872 ms, in the browser.
BTCUSDT · 1D · default settings
- BLACK DOT
- BLACK DOT
- Normally Distributed Pseudo Random Value
- Shape
- Winning trade
- Losing trade
- Equity
- Buy and hold
| Open is 83028.14 | Close is 84704 |
| High is 84898 | Low is 82635.32 |
| Volume higher than 22.2916666667% of recent data | Reds 47 |
| HOPE THIS HELPS! ELIZA x | Greens 53 |
- Net profit
- +0.02%
- $23.88
- Buy and hold
- +102.5%
- same period
- Closed trades
- 6
- 4 won · 2 lost
- Profitable
- 66.7%
- of closed trades
- Profit factor
- 4.12
- gross profit ÷ gross loss
- Max drawdown
- 0.02%
- −$23.35
One run with the author's default settings, $100,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.
-
Check
1 setting does nothing
“Day of Month” 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.
-
Note
1 setting has no label
In the settings dialog rng (line 176) shows an empty name. The labels on this page come from the variable names.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
Uses transp =, which v5 removed line 221
transp = on line 221, 222, 223, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243. v5 folds the transparency into the colour with color.new(c, transp).
-
Note
Uses long =, which v5 renamed line 260
long = on line 260, 269, 277, 285. 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 floor → math.floor, random → math.random, sqrt → math.sqrt, log → math.log, cos → math.cos, sma → ta.sma, stdev → ta.stdev, abs → math.abs, tostring → str.tostring.
v4 → v5
DiffersTrades differ: 6 before, 6 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 24: input(type = input.integer) → input.int()
- Line 25: input(type = input.integer) → input.int()
- Line 26: floor → math.floor
- Line 26: random → math.random
- Line 171: sqrt → math.sqrt
47 more edits
- Line 171: log → math.log
- Line 171: cos → math.cos
- Line 174: sma → ta.sma
- Line 175: stdev → ta.stdev
- Line 177: abs → math.abs
- Line 178: abs → math.abs
- Line 180: abs → math.abs
- Line 180: abs → math.abs
- Line 180: abs → math.abs
- Line 184: abs → math.abs
- Line 184: abs → math.abs
- Line 184: abs → math.abs
- Line 191: abs → math.abs
- Line 194: abs → math.abs
- Line 221: transp = 0 → color.new(trd == 1 ? #000000 : na, 0)
- Line 222: transp = 0 → color.new(tgd == 1 ? #000000 : na, 0)
- Line 223: abs → math.abs
- Line 223: transp = 0 → color.new(abs(rng) > high ? #fa0000 : #0efa00, 0)
- Line 224: abs → math.abs
- Line 226: abs → math.abs
- Line 228: abs → math.abs
- Line 230: transp = 99 → color.new(flagc == 0 ? color.yellow : na, 99)
- Line 231: transp = 99 → color.new(flagl == 0 ? color.yellow : na, 99)
- Line 232: transp = 99 → color.new(flagh == 0 ? color.yellow : na, 99)
- Line 233: transp = 99 → color.new(flago == 0 ? color.yellow : na, 99)
- Line 234: transp = 98 → color.new(flago == 0 and flagh == 0 ? color.purple : na, 98)
- Line 235: transp = 98 → color.new(flago == 0 and flagl == 0 ? color.purple : na, 98)
- Line 236: transp = 98 → color.new(flago == 0 and flagc == 0 ? color.purple : na, 98)
- Line 237: transp = 98 → color.new(flagl == 0 and flagc == 0 ? color.purple : na, 98)
- Line 238: transp = 98 → color.new(flagl == 0 and flagh == 0 ? color.purple : na, 98)
- Line 239: transp = 98 → color.new(flagc == 0 and flagh == 0 ? color.purple : na, 98)
- Line 240: transp = 97 → color.new(flagc == 0 and flagh == 0 and flago == 0 ? color.fuchsia : na, 97)
- Line 241: transp = 97 → color.new(flagc == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, 97)
- Line 242: transp = 97 → color.new(flago == 0 and flagc == 0 and flagl == 0 ? color.fuchsia : na, 97)
- Line 243: transp = 97 → color.new(flago == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, 97)
- Line 246: tostring → str.tostring
- Line 247: tostring → str.tostring
- Line 248: tostring → str.tostring
- Line 249: tostring → str.tostring
- Line 250: tostring → str.tostring
- Line 251: tostring → str.tostring
- Line 253: tostring → str.tostring
- Line 259: abs → math.abs
- Line 260: long = strategy.long → direction = strategy.long
- Line 269: long = strategy.long → direction = strategy.long
- Line 277: long = strategy.long → direction = strategy.long
- Line 285: long = strategy.long → direction = strategy.long
⋯// © Eliza123123-//@version=4+//@version=5strategy("Aphrodite", default_qty_type = strategy.percent_of_equity, default_qty_value = 1, overlay=true, commission_type = strategy.commission.percent, commission_value=0.075, calc_on_every_tick=false, pyramiding = 999)⋯//==================================================================================================================================================================================================================-day_of_month = input(3, "Day of Month", input.integer)+day_of_month = input.int(3, "Day of Month")-this_month = input(10, "Month", input.integer)+this_month = input.int(10, "Month")-randomhour1 = floor(random(0,271))+randomhour1 = math.floor(math.random(0,271))// randomflip = round(random(0,1))⋯ _random_2 = f_pseudo_random_number(1.0, -_seed)- _return = sqrt(-2 * log(_random_1)) * cos(2 * _pi * _random_2) * _dev + _mean+ _return = math.sqrt(-2 * math.log(_random_1)) * math.cos(2 * _pi * _random_2) * _dev + _mean _return//My added code:-mean = sma(ohlc4, 27)+mean = ta.sma(ohlc4, 27)-dev = stdev(ohlc4, 27)+dev = ta.stdev(ohlc4, 27)rng = f_nd_pseudo_random(mean, dev, input(1.0))-absrng = abs(rng)+absrng = math.abs(rng)-normalDistributionDots = abs(rng)+normalDistributionDots = math.abs(rng)trd = 0, tgd = 0-if(abs(rng) > high) and (abs(rng)[1] > high[1]) and (abs(rng)[2] > high[2]) and bar_index+if(math.abs(rng) > high) and (math.abs(rng)[1] > high[1]) and (math.abs(rng)[2] > high[2]) and bar_index trd := 1⋯ -if (abs(rng) < low) and (abs(rng)[1] < low[1]) and (abs(rng)[2] < low[2]) and bar_index+if (math.abs(rng) < low) and (math.abs(rng)[1] < low[1]) and (math.abs(rng)[2] < low[2]) and bar_index tgd := 1⋯piBear=0-if abs(rng) > high+if math.abs(rng) > high piBear := 1piBull=0-if abs(rng) < low+if math.abs(rng) < low piBull := 1⋯ -plot(series = normalDistributionDots, title="BLACK DOT", color = trd == 1 ? #000000 : na, linewidth=4, style=plot.style_circles, transp=0)+plot(series = normalDistributionDots, title="BLACK DOT", color = color.new(trd == 1 ? #000000 : na, 0), linewidth=4, style=plot.style_circles)-plot(series = normalDistributionDots, title="BLACK DOT", color = tgd == 1 ? #000000 : na, linewidth=4, style=plot.style_circles, transp=0)+plot(series = normalDistributionDots, title="BLACK DOT", color = color.new(tgd == 1 ? #000000 : na, 0), linewidth=4, style=plot.style_circles)-plot(series = normalDistributionDots, title="Normally Distributed Pseudo Random Value", color = abs(rng) > high ? #fa0000 : #0efa00, linewidth=1, style=plot.style_circles, transp=0)+plot(series = normalDistributionDots, title="Normally Distributed Pseudo Random Value", color = color.new(math.abs(rng) > high ? #fa0000 : #0efa00, 0), linewidth=1, style=plot.style_circles)-plotcandle(open, high, low, close, color = abs(rng) > high ? #fa0000 : #0efa00, wickcolor= color.white)+plotcandle(open, high, low, close, color = math.abs(rng) > high ? #fa0000 : #0efa00, wickcolor= color.white) -bgcolor(color = abs(rng) > high ? #fa0000 : na)+bgcolor(color = math.abs(rng) > high ? #fa0000 : na)bgcolor(color = trd == 1 ? #fa0000 : na)-bgcolor(color = abs(rng) < low ? #0efa00 : na)+bgcolor(color = math.abs(rng) < low ? #0efa00 : na)bgcolor(color = tgd == 1 ? #0efa00 : na)-bgcolor(color = flagc == 0 ? color.yellow : na, transp = 99)+bgcolor(color = color.new(flagc == 0 ? color.yellow : na, 99))-bgcolor(color = flagl == 0 ? color.yellow : na, transp = 99)+bgcolor(color = color.new(flagl == 0 ? color.yellow : na, 99))-bgcolor(color = flagh == 0 ? color.yellow : na, transp = 99)+bgcolor(color = color.new(flagh == 0 ? color.yellow : na, 99))-bgcolor(color = flago == 0 ? color.yellow : na, transp = 99)+bgcolor(color = color.new(flago == 0 ? color.yellow : na, 99))-bgcolor(color = flago == 0 and flagh == 0 ? color.purple : na, transp = 98)+bgcolor(color = color.new(flago == 0 and flagh == 0 ? color.purple : na, 98))-bgcolor(color = flago == 0 and flagl == 0 ? color.purple : na, transp = 98)+bgcolor(color = color.new(flago == 0 and flagl == 0 ? color.purple : na, 98))-bgcolor(color = flago == 0 and flagc == 0 ? color.purple : na, transp = 98)+bgcolor(color = color.new(flago == 0 and flagc == 0 ? color.purple : na, 98))-bgcolor(color = flagl == 0 and flagc == 0 ? color.purple : na, transp = 98)+bgcolor(color = color.new(flagl == 0 and flagc == 0 ? color.purple : na, 98))-bgcolor(color = flagl == 0 and flagh == 0 ? color.purple : na, transp = 98)+bgcolor(color = color.new(flagl == 0 and flagh == 0 ? color.purple : na, 98))-bgcolor(color = flagc == 0 and flagh == 0 ? color.purple : na, transp = 98)+bgcolor(color = color.new(flagc == 0 and flagh == 0 ? color.purple : na, 98))-bgcolor(color = flagc == 0 and flagh == 0 and flago == 0 ? color.fuchsia : na, transp = 97)+bgcolor(color = color.new(flagc == 0 and flagh == 0 and flago == 0 ? color.fuchsia : na, 97))-bgcolor(color = flagc == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, transp = 97)+bgcolor(color = color.new(flagc == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, 97))-bgcolor(color = flago == 0 and flagc == 0 and flagl == 0 ? color.fuchsia : na, transp = 97)+bgcolor(color = color.new(flago == 0 and flagc == 0 and flagl == 0 ? color.fuchsia : na, 97))-bgcolor(color = flago == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, transp = 97)+bgcolor(color = color.new(flago == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, 97))var testTable = table.new(position = position.bottom_right, columns = 2, rows = 4, bgcolor = color.white, border_width = 1)if barstate.islast- table.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + tostring(open), bgcolor = flago == 0 ? color.fuchsia : na, text_color = #000000)+ table.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + str.tostring(open), bgcolor = flago == 0 ? color.fuchsia : na, text_color = #000000)- table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + tostring(close), bgcolor = flagc == 0 ? color.fuchsia : na, text_color = #000000)+ table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + str.tostring(close), bgcolor = flagc == 0 ? color.fuchsia : na, text_color = #000000)- table.cell(table_id = testTable, column = 0, row = 1, text = "High is " + tostring(high), bgcolor = flagh == 0 ? color.fuchsia : na, text_color = #000000)+ table.cell(table_id = testTable, column = 0, row = 1, text = "High is " + str.tostring(high), bgcolor = flagh == 0 ? color.fuchsia : na, text_color = #000000)- table.cell(table_id = testTable, column = 1, row = 1, text = "Low is " + tostring(low), bgcolor = flagl == 0 ? color.fuchsia : na, text_color = #000000)+ table.cell(table_id = testTable, column = 1, row = 1, text = "Low is " + str.tostring(low), bgcolor = flagl == 0 ? color.fuchsia : na, text_color = #000000)- table.cell(table_id = testTable, column = 0, row = 2, text = " Volume higher than " + tostring(volume_percent_class) + "% of recent data", bgcolor = #000000, text_color = color.white)+ table.cell(table_id = testTable, column = 0, row = 2, text = " Volume higher than " + str.tostring(volume_percent_class) + "% of recent data", bgcolor = #000000, text_color = color.white)- table.cell(table_id = testTable, column = 1, row = 2, text = "Reds " + tostring(howManyreds), bgcolor = #9f0000, text_color = color.white)+ table.cell(table_id = testTable, column = 1, row = 2, text = "Reds " + str.tostring(howManyreds), bgcolor = #9f0000, text_color = color.white) table.cell(table_id = testTable, column = 0, row = 3, text = "HOPE THIS HELPS! ELIZA x", bgcolor = #fc03a5, text_color = #d5ff03)- table.cell(table_id = testTable, column = 1, row = 3, text = "Greens " + tostring(howManygreens), bgcolor = #1e9f00, text_color = color.white)+ table.cell(table_id = testTable, column = 1, row = 3, text = "Greens " + str.tostring(howManygreens), bgcolor = #1e9f00, text_color = color.white)plotshape(flagc == 0 and flagh == 0 and flago == 0 and flagl == 0, location = location.belowbar, color = color.purple, text = "Piv", textcolor = color.white)⋯//1st order Buy Entries-if abs(rng) < low and (month == (this_month) and dayofmonth == 3)+if math.abs(rng) < low and (month == (this_month) and dayofmonth == 3) strategy.entry(id = "buy",- long = strategy.long,+ direction = strategy.long, comment = "buy",⋯ strategy.entry(id = "buy2",- long = strategy.long,+ direction = strategy.long, comment = "buy",⋯ strategy.entry(id = "buy3",- long = strategy.long,+ direction = strategy.long, comment = "buy",⋯ strategy.entry(id = "buy4",- long = strategy.long,+ direction = strategy.long, comment = "buy",⋯Clean v5
VerifiedSame 6 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 176: input() → input.float()
⋯dev = ta.stdev(ohlc4, 27)-rng = f_nd_pseudo_random(mean, dev, input(1.0))+rng = f_nd_pseudo_random(mean, dev, input.float(1.0))absrng = math.abs(rng)⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L180:C95: cannot use 'int' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © Eliza123123-//@version=5+//@version=6strategy("Aphrodite", default_qty_type = strategy.percent_of_equity, default_qty_value = 1, overlay=true, commission_type = strategy.commission.percent, commission_value=0.075, calc_on_every_tick=false, pyramiding = 999)⋯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 |
|---|---|---|---|
| Day of Month | 3 | int | unused |
| Month | 10 | int | entry buy entry buy2 entry buy3 entry buy4 line 259 line 268 line 276 line 284 |
| Rng (no label in the script) | 1.0 | float | absrng normalDistributionDots entry buy line 180 line 184 line 191 line 194 Normally Distributed Pseudo Random Value plotcandle bgcolor line 259 |
What it calculates
- SMA (
sma,ta.smain v5)ohlc4, 27mean · line 174 - Stdev (
stdev,ta.stdevin v5)ohlc4, 27dev · line 175
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 buy long | abs(rng) < low and (month == (this_month) and dayofmonth == 3) | On | 260 |
| Close | flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 | On | 266 |
| Open buy2 long | tgd == 1 and (month == (this_month) and dayofmonth == 3) | On | 269 |
| Close | flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 | On | 275 |
| Open buy3 long | tgd == 1 and (month == (this_month) and dayofmonth == 3) | On | 277 |
| Close | flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 | On | 283 |
| Open buy4 long | tgd == 1 and (month == (this_month) and dayofmonth == 3) | On | 285 |
| Close | flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 | On | 291 |
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, and the live replay matched history.
- 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% | 6 | 67% | 4.12 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +0.0% | +5.5% | 2 | 100% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.0% | +9.8% | 4 | 100% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 1 | 100% | 16.12 | 0.6% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.1% | +21.5% | 1 | 0% | 0.00 | 0.2% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.1% | +148.3% | 5 | 100% | 166.81 | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.0% | +17.1% | 0 | 0% | 0.00 | 0.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 4 | 100% | $31.53 |
| Sideways market | 2 | 0% | −$7.65 |
| Falling market | 0 | — | $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 6 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.
All 6 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 4 Oct 2024 60,752.70 | 4 Oct 2024 60,752.70 | 0 | −$1.50 |
| long | 4 Oct 2025 122,232.00 | 10 Oct 2025 121,662.00 | 6 | −$6.15 |
| long | 4 Oct 2026 84,753.60 | 7 Oct 2026 85,549.90 | 3 | $7.88 |
| long | 4 Oct 2026 84,753.60 | 7 Oct 2026 85,549.90 | 3 | $7.88 |
| long | 4 Oct 2026 84,753.60 | 7 Oct 2026 85,549.90 | 3 | $7.88 |
| long | 4 Oct 2026 84,753.60 | 7 Oct 2026 85,549.90 | 3 | $7.88 |
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 |
|---|---|---|---|---|---|
| Aphrodite this page | — | v4 strategy | +0.0% | 6 | 0.0% |
| Double Bollinger Binary Options by Trade_by_DB | sma stdev | v5 strategy | No trades on this market | ||
| Improved Bollinger Swing Strategy Stock Nasdaq by exlux99 | sma stdev | v4 strategy | −20.4% | 7 | 22.3% |
| I11L Long Put-Call Ratio Inversion by I11L | sma stdev | v5 strategy | No trades on this market | ||
| P-Signal Strategy by Kharevsky | stdev sma | v4 strategy | −9.7% | 29 | 34.6% |
| P-Signal Strategy & Alert by Kharevsky | stdev sma | v4 strategy | −9.7% | 29 | 34.6% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 93 ms | With a workaround 1,000 bars in 872 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as long = strategy.long as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 260, 269, 277, 285) 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/// © Eliza123123//@version=4strategy("Aphrodite", default_qty_type = strategy.percent_of_equity, default_qty_value = 1, overlay=true, commission_type = strategy.commission.percent, commission_value=0.075, calc_on_every_tick=false, pyramiding = 999)// v4//pump/dump trend following strategy idea added.//Pseudo Random Number Generator Box Muller Normal Distribution Method - code from [RS]Function - Functions to generate Random values by RicardoSantos. Dots are calculated by an adaptation of the ideas//in this script.// volume accumulates when dots are green for buys, red for sells. This setup is just looking for buys but this is very easy to change //just go to trading day and swap all strategy.long commands for strategy.short commands// Exits on minutes where OHLC all return 'primeness'//Reinforced dots (with black) when last three dots are all of same colour//==================================================================================================================================================================================================================//UPDATE HISTORY:// v2// more workable version of yesterdays script. please still only use on assets $10 to $100 as scalability hasn't been added for all assets yet. BG colors are theres to show historic prevalence of "primeness".// The table in the top right will flash purple when the open high low or close encounters "primeness". // When they all light up thats when you can potentially expect a reversal. Use on lower time frame to see the effect quickly. Note this still isn't a foolproof method for finding primes but I will be improving it in later editions// v3// added scaling for pairs from $0.10 up to $1000. May still be slight different in indicator performance betwwen the two extremes of that scale.// Clear OHLC prime pivot points have been added// Introducing the volumeometer. Pretty self explanatory.//==================================================================================================================================================================================================================day_of_month = input(3, "Day of Month", input.integer)this_month = input(10, "Month", input.integer)randomhour1 = floor(random(0,271))// randomflip = round(random(0,1))// randomflip2 = round(random(0,1))// randomflip3 = round(random(0,1))// day_before1 = day_of_month - 1// day_before2 = day_of_month - 2// day_before3 = day_of_month - 3// day_before4 = day_of_month - 4// day_before5 = day_of_month - 5// day_before6 = day_of_month - 6// day_before7 = day_of_month - 7// day_before8 = day_of_month - 8// day_before9 = day_of_month - 9// day_before10 = day_of_month - 10f_close = close, f_low = low, f_high = high, f_open = openflagc = 0, flagl = 0, flagh = 0, flago = 0//SCALING (JUST USE ASSETS $10 to $1000 as this needs more work still)////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Assets $0.10-1if close >= 0.100 and close < 0.9999 f_close := f_close * 100000if low >= 0.100 and low < 0.9999 f_low := f_low * 100000if high >= 0.100 and high < 0.9999 f_high := f_high * 100000if open >= 0.100 and open < 0.9999 f_open := f_open * 100000//Assets $1-10if close >= 1.000 and close < 9.999 f_close := f_close * 10000if low >= 1.000 and low < 9.999 f_low := f_low * 10000if high >= 1.000 and high < 9.999 f_high := f_high * 10000if open >= 1.000 and open < 9.999 f_open := f_open * 10000//Assets $10-100if close >= 10.000 and close < 99.999 f_close := f_close * 1000if low >= 10.000 and low < 99.999 f_low := f_low * 1000if high >= 10.000 and high < 99.999 f_high := f_high * 1000if open >= 10.000 and open < 99.999 f_open := f_open * 1000//Assets $100-1000if close >= 100.000 and close < 999.999 f_close := f_close * 100if low >= 100.000 and low < 999.999 f_low := f_low * 100if high >= 100.000 and high < 999.999 f_high := f_high * 100if open >= 100.000 and open < 999.999 f_open := f_open * 100 //Assets $1000-10000if close >= 1000.000 and close < 9999.999 f_close := f_close * 10if low >= 1000.000 and low < 9999.999 f_low := f_low * 10if high >= 1000.000 and high < 9999.999 f_high := f_high * 10if open >= 1000.000 and open < 9999.999 f_open := f_open * 10//Assets $10000-100000if close >= 10000.000 and close < 99999.999 f_close := f_closeif low >= 10000.000 and low < 99999.999 f_low := f_lowif high >= 10000.000 and high < 99999.999 f_high := f_highif open >= 10000.000 and open < 99999.999 f_open := f_open////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Prime Checking//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////if f_close > 1 for i = 2 to 3 if (f_close % i) == 0 flagc := 1 for i = 4 to 5 if (f_close % i) == 0 flagc := 1 for i = 6 to 7 if (f_close % i) == 0 flagc := 1 for i = 8 to 9 if (f_close % i) == 0 flagc := 1if f_low > 1 for i = 2 to 3 if (f_low % i) == 0 flagl := 1 for i = 4 to 5 if (f_low % i) == 0 flagl := 1 for i = 6 to 7 if (f_low % i) == 0 flagl := 1 for i = 8 to 9 if (f_low % i) == 0 flagl := 1if f_high > 1 for i = 2 to 3 if (f_high % i) == 0 flagh := 1 for i = 4 to 5 if (f_high % i) == 0 flagh := 1 for i = 6 to 7 if (f_high % i) == 0 flagh := 1 for i = 8 to 9 if (f_high % i) == 0 flagh := 1if f_open > 1 for i = 2 to 3 if (f_open % i) == 0 flago := 1 for i = 4 to 5 if (f_open % i) == 0 flago := 1 for i = 6 to 7 if (f_open % i) == 0 flago := 1 for i = 8 to 9 if (f_open % i) == 0 flago := 1////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Pseudo Random Number Generator Box Muller Normal Distribution Method - code from [RS]Function - Functions to generate Random values by RicardoSantos//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////f_pseudo_random_number(_range, _seed) => _return = 1.0 if na(_seed) _return := 3.14159 * nz(_return[1], 1) % bar_index _return else _return := 3.14159 * nz(_return[1], 1) % (bar_index + _seed) _return _return := _return % _range _returnf_nd_pseudo_random(_mean, _dev, _seed) => _pi = 3.14159265359 _random_1 = f_pseudo_random_number(1.0, _seed) _random_2 = f_pseudo_random_number(1.0, -_seed) _return = sqrt(-2 * log(_random_1)) * cos(2 * _pi * _random_2) * _dev + _mean _return//My added code:mean = sma(ohlc4, 27)dev = stdev(ohlc4, 27)rng = f_nd_pseudo_random(mean, dev, input(1.0))absrng = abs(rng)normalDistributionDots = abs(rng)trd = 0, tgd = 0if(abs(rng) > high) and (abs(rng)[1] > high[1]) and (abs(rng)[2] > high[2]) and bar_index trd := 1 tgd := 0 if (abs(rng) < low) and (abs(rng)[1] < low[1]) and (abs(rng)[2] < low[2]) and bar_index tgd := 1 trd := 0////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CONDITION////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////piBear=0if abs(rng) > high piBear := 1piBull=0if abs(rng) < low piBull := 1//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////MORE CALCS////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////volumesBeaten = 0for i = 1 to 1440 if volume > volume[i] volumesBeaten := volumesBeaten + 1volume_percent_class = (volumesBeaten / 1440) * 100howManyreds = 0for i = 1 to 100 if open[i] > close[i] howManyreds := howManyreds + 1 howManygreens = 0for i = 1 to 100 if open[i] < close[i] howManygreens := howManygreens + 1// howManygreendots = 0// for i = 1 to 100// if abs(rng)[i] < low[i]// howManygreendots := howManygreendots + 1//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////OUTPUTS//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// plot(series = normalDistributionDots, title="BLACK DOT", color = trd == 1 ? #000000 : na, linewidth=4, style=plot.style_circles, transp=0)plot(series = normalDistributionDots, title="BLACK DOT", color = tgd == 1 ? #000000 : na, linewidth=4, style=plot.style_circles, transp=0)plot(series = normalDistributionDots, title="Normally Distributed Pseudo Random Value", color = abs(rng) > high ? #fa0000 : #0efa00, linewidth=1, style=plot.style_circles, transp=0)plotcandle(open, high, low, close, color = abs(rng) > high ? #fa0000 : #0efa00, wickcolor= color.white) bgcolor(color = abs(rng) > high ? #fa0000 : na)bgcolor(color = trd == 1 ? #fa0000 : na)bgcolor(color = abs(rng) < low ? #0efa00 : na)bgcolor(color = tgd == 1 ? #0efa00 : na)bgcolor(color = flagc == 0 ? color.yellow : na, transp = 99)bgcolor(color = flagl == 0 ? color.yellow : na, transp = 99)bgcolor(color = flagh == 0 ? color.yellow : na, transp = 99)bgcolor(color = flago == 0 ? color.yellow : na, transp = 99)bgcolor(color = flago == 0 and flagh == 0 ? color.purple : na, transp = 98)bgcolor(color = flago == 0 and flagl == 0 ? color.purple : na, transp = 98)bgcolor(color = flago == 0 and flagc == 0 ? color.purple : na, transp = 98)bgcolor(color = flagl == 0 and flagc == 0 ? color.purple : na, transp = 98)bgcolor(color = flagl == 0 and flagh == 0 ? color.purple : na, transp = 98)bgcolor(color = flagc == 0 and flagh == 0 ? color.purple : na, transp = 98)bgcolor(color = flagc == 0 and flagh == 0 and flago == 0 ? color.fuchsia : na, transp = 97)bgcolor(color = flagc == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, transp = 97)bgcolor(color = flago == 0 and flagc == 0 and flagl == 0 ? color.fuchsia : na, transp = 97)bgcolor(color = flago == 0 and flagh == 0 and flagl == 0 ? color.fuchsia : na, transp = 97)var testTable = table.new(position = position.bottom_right, columns = 2, rows = 4, bgcolor = color.white, border_width = 1)if barstate.islast table.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + tostring(open), bgcolor = flago == 0 ? color.fuchsia : na, text_color = #000000) table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + tostring(close), bgcolor = flagc == 0 ? color.fuchsia : na, text_color = #000000) table.cell(table_id = testTable, column = 0, row = 1, text = "High is " + tostring(high), bgcolor = flagh == 0 ? color.fuchsia : na, text_color = #000000) table.cell(table_id = testTable, column = 1, row = 1, text = "Low is " + tostring(low), bgcolor = flagl == 0 ? color.fuchsia : na, text_color = #000000) table.cell(table_id = testTable, column = 0, row = 2, text = " Volume higher than " + tostring(volume_percent_class) + "% of recent data", bgcolor = #000000, text_color = color.white) table.cell(table_id = testTable, column = 1, row = 2, text = "Reds " + tostring(howManyreds), bgcolor = #9f0000, text_color = color.white) table.cell(table_id = testTable, column = 0, row = 3, text = "HOPE THIS HELPS! ELIZA x", bgcolor = #fc03a5, text_color = #d5ff03) table.cell(table_id = testTable, column = 1, row = 3, text = "Greens " + tostring(howManygreens), bgcolor = #1e9f00, text_color = color.white)plotshape(flagc == 0 and flagh == 0 and flago == 0 and flagl == 0, location = location.belowbar, color = color.purple, text = "Piv", textcolor = color.white)////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////TRADING DAY////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////1st order Buy Entriesif abs(rng) < low and (month == (this_month) and dayofmonth == 3) strategy.entry(id = "buy", long = strategy.long, comment = "buy", alert_message = "Long(" + syminfo.ticker + "): Started" )else if flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 strategy.close_all(comment = "close")//2nd order Buy entriesif tgd == 1 and (month == (this_month) and dayofmonth == 3) strategy.entry(id = "buy2", long = strategy.long, comment = "buy", alert_message = "Long(" + syminfo.ticker + "): Started" )else if flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 strategy.close_all(comment = "close")if tgd == 1 and (month == (this_month) and dayofmonth == 3) strategy.entry(id = "buy3", long = strategy.long, comment = "buy", alert_message = "Long(" + syminfo.ticker + "): Started" )else if flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 strategy.close_all(comment = "close")if tgd == 1 and (month == (this_month) and dayofmonth == 3) strategy.entry(id = "buy4", long = strategy.long, comment = "buy", alert_message = "Long(" + syminfo.ticker + "): Started" )else if flagc == 0 and flagh == 0 and flago == 0 and flagl == 0 strategy.close_all(comment = "close")//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////