Nick Rypock Trailing Reverse
"Nick Rypock Trailing Reverse (NRTR) [everget]" by everget, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Nick Rypock Trailing Reverse (NRTR) [everget] (v2.0), read 2026-11-15T18:28:55.911Z; source language v6.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
Nick Rypock Trailing Reverse (NRTR) [everget] by everget, ported from Pine v6. Overlay indicator with 3 plots, 4 marker series, 2 fills, alerts and 3 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2021-01-24; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// Copyright (c) 2021-present, Alex Orekhov (everget)
// Nick Rypock Trailing Reverse (NRTR) script may be freely distributed under the terms of the GPL-3.0 license.
// ------------------------------------------------------------------------------------------------
// Original author: everget
// Original title: Nick Rypock Trailing Reverse (NRTR) [everget]
// Licence: MPL-2.0 (the notice above was added by FloSignals; the original carries none)
// Pine version: 6
// Fetched: 2026-11-15
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=6
indicator('Nick Rypock Trailing Reverse', shorttitle='NRTR', overlay=true)
const string calcGroup = 'Calculation'
percentage = input.float(2, minval=0, maxval=100, step=0.1, title='Coefficient of Correction, %', group=calcGroup) / 100
const string visualGroup = 'Visuals'
showLabels = input.bool(true, title='Show Buy/Sell Labels', group=visualGroup)
highlightState = input.bool(true, title='Highlight State', group=visualGroup)
//---
var int trend = 0
var float hp = close
var float lp = close
nrtr = close
if trend >= 0
if close > hp
hp := close
hp
nrtr := hp * (1 - percentage)
if close <= nrtr
trend := -1
lp := close
nrtr := lp * (1 + percentage)
nrtr
else
if close < lp
lp := close
lp
nrtr := lp * (1 + percentage)
if close > nrtr
trend := 1
hp := close
nrtr := hp * (1 - percentage)
nrtr
const color textColor = color.white
const color longColor = color.green
const color shortColor = color.red
const color longFillColor = color.new(color.green, 85)
const color shortFillColor = color.new(color.red, 85)
longStopPlot = plot(trend == 1 ? nrtr : na, title='Long Stop', style=plot.style_linebr, linewidth=2, color=longColor)
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal ? nrtr : na, title='Long Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=longColor)
plotshape(buySignal and showLabels ? nrtr : na, title='Buy Label', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=longColor, textcolor=textColor)
shortStopPlot = plot(trend == 1 ? na : nrtr, title='Short Stop', style=plot.style_linebr, linewidth=2, color=shortColor)
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal ? nrtr : na, title='Short Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=shortColor)
plotshape(sellSignal and showLabels ? nrtr : na, title='Sell Label', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=shortColor, textcolor=textColor)
midPricePlot = plot(ohlc4, title='', display=display.none, editable=false)
fill(midPricePlot, longStopPlot, title='Long State Filling', color=highlightState and trend == 1 ? longFillColor : na)
fill(midPricePlot, shortStopPlot, title='Short State Filling', color=highlightState and trend == -1 ? shortFillColor : na)
alertcondition(trend != trend[1], title='NRTR Direction Change', message='NRTR has changed direction, {{exchange}}:{{ticker}}')
alertcondition(buySignal, title='NRTR Buy', message='NRTR Buy, {{exchange}}:{{ticker}}')
alertcondition(sellSignal, title='NRTR Sell', message='NRTR Sell, {{exchange}}:{{ticker}}')
This file is under the Mozilla Public License 2.0; it is a port of the original by everget, with the original licence header kept and the changes made for FloScript noted in the file.
- v1
Library refresh 2026-11-15
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.