Iván González

Renaissance Mean Reversion

Category: Indicators By: Iván González Created: November 13, 2026, 11:42 AM
November 13, 2026, 11:42 AM
Indicators
0 Comments
Renaissance Mean Reversion

Introduction

 

Most mean reversion tools answer one question: how far is price from its average? The Renaissance Mean Reversion indicator by officialjackofalltrades adds a second one, which is the one that matters for the trade: does this distance actually close, and how fast?

The indicator treats price and its own slow EMA as a synthetic pair, measures how stretched the spread between them is with a Z-score, and estimates the half-life of that spread with an AR(1) regression. A signal is only allowed when the spread is stretched and the half-life is short. The result is an engine that says no more often than yes: it refuses a reversion trade until the spread has shown that it reverts.

Theory Behind the Indicator

 

The spread. The spread is price minus its slow EMA (50 bars by default). With the log option it is the difference of the logarithms, which removes the price scale and is the better choice on long histories.

The Z-score. The spread is standardised with its rolling mean and standard deviation over 100 bars. A Z of -2 means the spread is two deviations below its own average.

The half-life. Over the last 120 bars the indicator fits the regression

change of the spread (t) = beta x spread (t-1) + noise

If beta is between -1 and 0, the spread is pulled back towards zero. The persistence is rho = 1 + beta and the half-life, in bars, is -ln(2) / ln(rho): the number of bars the spread needs, on average, to close half of its distance. When rho is not between 0 and 1 the spread is not mean reverting and there is no half-life.

The tradeable regime. The regime is tradeable when the half-life exists and is below the maximum (20 bars by default) and, at the same time, the absolute Z is above the entry threshold (2).

The trades. From a flat position the indicator goes long when Z is below -2 and short when Z is above 2, always inside a tradeable regime and after a cooldown of 3 bars from the last exit. It exits when the absolute Z falls below 0.25 (the spread has closed) or after 40 bars. Each trade is scored in R: the price move in favour divided by the size of the stretch at entry (the entry Z times the deviation of the spread).

Key Features at a Glance

 

  • Spread between price and its slow EMA, in price units or in logarithms.
  • Rolling Z-score of the spread.
  • Half-life of the mean reversion from an AR(1) regression, with a floor and a maximum.
  • Long, short and exit marks from a state machine with cooldown and maximum holding time.
  • Ribbon between price and the slow EMA, coloured by the side price is on.
  • Read-out of half-life, Z and spread next to the last bar.
  • Dashboard with the current state and the statistics of the last trades: win rate, average holding time and average R.
  • Optional background tint while the regime is tradeable.

How to Read the Indicator

 

  • Grey line: the slow EMA, the second leg of the pair. Ribbon: green while price is above it, grey while it is below.
  • R-LONG with a triangle below the bar: the spread is more than two deviations below its average and it has been reverting fast. R-SHORT with a triangle above the bar: the opposite.
  • R-EXIT with a cross at the close: the spread has come back to its average, or the trade has reached the maximum number of bars.
  • Half-Life (bars) in the dashboard: green when it is below the maximum, grey when it is above. With “n/a” the spread is not mean reverting at the moment and no entry is allowed.
  • Tradeable?: YES only when the half-life is short and the Z is stretched. Most of the time it reads “no”.
  • Unrealized R: the result of the open trade so far. Win Rate (roll), Avg Hold and Avg R / Trade: statistics of the last 200 closed trades, with the number of trades in brackets.
  • On the bar that is still forming, a mark can appear and disappear until the close. Read the signals on closed bars.

Practical Applications

 

  • Filter for your own reversion setups. The half-life row tells you whether stretched readings have been closing quickly in this instrument and timeframe. If it is long or missing, an oversold reading is more likely the start of a trend than an opportunity.
  • Choice of instrument and timeframe. Scroll through several markets and compare the average R and the win rate of the dashboard: the engine is the same, so the numbers tell you where mean reversion has been working.
  • Time stop. The half-life is a natural horizon for the trade: if the spread has not moved back after two or three half-lives, the premise is gone. The maximum holding time enforces that idea.

Indicator Configuration

 

  • longLen (default: 50): length of the slow EMA, the second leg of the pair.
  • zLookback (default: 100): window of the rolling mean and deviation of the spread.
  • useLogSpr (default: 0): 1 uses the difference of logarithms instead of the price difference.
  • entryZ (default: 2.0): absolute Z needed for an entry.
  • exitZ (default: 0.25): absolute Z below which the trade is closed.
  • maxHold (default: 40): maximum number of bars in a trade.
  • sigCooldown (default: 3): bars to wait after an exit before a new entry.
  • regWin (default: 120): window of the half-life regression. Longer is more stable and slower to react.
  • maxHalfLife (default: 20): entries are only allowed when the half-life is below this number of bars.
  • minHalfLife (default: 0.5): floor of the half-life estimate.
  • showLabels, showTradeMarks (default: 1): texts and symbols of entries and exits.
  • showHLLabel (default: 1): read-out next to the last bar.
  • showBandFill (default: 1) and ribbonAlpha (default: 85): ribbon and its transparency, from 50 to 99.
  • showRegimeTint (default: 0) and tintAlpha (default: 94): background tint while the regime is tradeable.
  • showDash (default: 1), dashPos (default: 2) and txtSize (default: 2): dashboard, its corner (1 top left, 2 top right, 3 bottom left, 4 bottom right) and its text size (1 to 3).
  • trackStats (default: 1) and maxTrades (default: 200): statistics over the last maxTrades trades; with 0, over all the trades in the chart.
  • bullR / bullG / bullB, bearR / bearG / bearB, mutR / mutG / mutB: the three colours of the indicator.

Code

 

//---------------------------------------------------------------
// PRC_Renaissance Mean Rev
// version = 0
// 13.11.2026
// Iván González @ www.prorealcode.com
// Author: officialjackofalltrades
// Sharing ProRealTime knowledge
//--------------------------------------------------------------------//
defparam drawonlastbaronly = true

// ===================== INPUTS
// --- Spread construction
longLen = 50          // Long EMA (slow leg of the synthetic pair)
zLookback = 100       // Z-Score lookback (rolling mean and deviation of the spread)
useLogSpr = 0         // 1 = log-spread: ln(price) - ln(EMA), removes the price scale
// --- Entry / exit regime
entryZ = 2.0          // Entry when |Z| is above this
exitZ = 0.25          // Exit when |Z| falls below this
maxHold = 40          // Maximum bars in a trade
sigCooldown = 3       // Bars to wait after an exit before a new entry
// --- Half-life regression
regWin = 120          // Window of the AR(1) regression
maxHalfLife = 20.0    // Only tradeable when the half-life (bars) is below this
minHalfLife = 0.5     // Floor of the half-life estimate
// --- Visuals
showLabels = 1        // R-LONG / R-SHORT / R-EXIT texts
showTradeMarks = 1    // Entry triangles and exit cross
showHLLabel = 1       // Half-life read-out to the right of the last bar
showBandFill = 1      // Ribbon between price and the slow EMA
ribbonAlpha = 85      // Ribbon transparency, 50-99 (99 = almost invisible)
showRegimeTint = 0    // Background tint while the regime is tradeable
tintAlpha = 94        // Tint transparency, 80-99
// --- Dashboard
showDash = 1
dashPos = 2           // 1 = top left, 2 = top right, 3 = bottom left, 4 = bottom right
txtSize = 2           // 1 = small, 2 = normal, 3 = large
// --- Backtest tracker
trackStats = 1        // 1 = statistics over the last maxTrades trades, 0 = over all of them
maxTrades = 200
// --- Colours (medium tones: readable on a light and on a dark background)
bullR = 8
bullG = 153
bullB = 129
bearR = 92
bearG = 92
bearB = 92
mutR = 119
mutG = 119
mutB = 119

src = customclose

// ===================== SLOW LEG: EMA seeded with the simple average of its first window
alphaE = 2 / (longLen + 1)
IF barindex < longLen - 1 THEN
   slowEma = src
   slowOk = 0
ELSIF barindex = longLen - 1 THEN
   slowEma = average[longLen](src)
   slowOk = 1
ELSE
   slowEma = alphaE * src + (1 - alphaE) * slowEma[1]
   slowOk = 1
ENDIF

// ===================== SPREAD AND ITS ROLLING Z-SCORE
IF useLogSpr = 1 THEN
   priceLeg = log(max(src, 0.0000000001))
   slowLeg = log(max(slowEma, 0.0000000001))
ELSE
   priceLeg = src
   slowLeg = slowEma
ENDIF
sprd = priceLeg - slowLeg

sprMean = average[zLookback](sprd)
sprDev = std[zLookback](sprd)
zSc = 0
sprStd = 0
// The window must hold only bars where the slow leg already exists
IF barindex >= longLen + zLookback - 2 THEN
   sprStd = sprDev
   IF sprStd > 0 THEN
      zSc = (sprd - sprMean) / sprStd
   ENDIF
ENDIF

// ===================== AR(1) HALF-LIFE
// Regression  dSpread(t) = beta * spread(t-1) + e  over regWin bars:
// beta = covariance(dSpread, spread(t-1)) / variance(spread(t-1))
// persistence rho = 1 + beta, half-life = -ln(2) / ln(rho) for 0 < rho < 1
IF barindex = 0 THEN
   dSpr = 0
   pSpr = 0
ELSE
   dSpr = sprd - sprd[1]
   pSpr = sprd[1]
ENDIF
mDS = average[regWin](dSpr)
mPS = average[regWin](pSpr)
mDP = average[regWin](dSpr * pSpr)
sdDS = std[regWin](dSpr)
sdPS = std[regWin](pSpr)
hlOk = 0
halfLife = 0
IF barindex >= longLen + regWin - 1 AND sdPS > 0 AND sdDS > 0 THEN
   arBeta = (mDP - mDS * mPS) / (sdPS * sdPS)
   arRho = 1 + arBeta
   IF arRho > 0 AND arRho < 1 THEN
      halfLife = max(minHalfLife, 0 - log(2) / log(arRho))
      hlOk = 1
   ENDIF
ENDIF

// ===================== TRADEABLE REGIME: fast mean reversion and a stretched spread
tradeable = 0
IF hlOk = 1 AND halfLife > 0 AND halfLife < maxHalfLife AND abs(zSc) > entryZ THEN
   tradeable = 1
ENDIF

// ===================== STATE MACHINE (-1 short, 0 flat, 1 long)
ONCE posState = 0
ONCE entryBar = 0
ONCE entryPx = 0
ONCE entryZv = 0
ONCE lastExitBar = 0 - 100000
ONCE tradeCount = 0
ONCE winCount = 0
ONCE sumR = 0
ONCE sumHold = 0
ONCE nEv = 0

atrV = averagetruerange[14](close)

IF posState = 0 THEN
   barsInPos = 0
ELSE
   barsInPos = barindex - entryBar
ENDIF

goLong = 0
goShort = 0
goExit = 0
exitDir = 0
IF posState = 0 THEN
   IF barindex - lastExitBar >= sigCooldown AND tradeable = 1 THEN
      IF zSc < 0 - entryZ THEN
         posState = 1
         entryBar = barindex
         entryPx = close
         entryZv = zSc
         goLong = 1
      ELSIF zSc > entryZ THEN
         posState = 0 - 1
         entryBar = barindex
         entryPx = close
         entryZv = zSc
         goShort = 1
      ENDIF
   ENDIF
ELSE
   IF abs(zSc) < exitZ OR barsInPos >= maxHold THEN
      // Result in R: price move in favour, divided by the stretch of the spread at entry
      IF posState = 1 THEN
         rawPnl = close - entryPx
      ELSE
         rawPnl = entryPx - close
      ENDIF
      stretchAbs = abs(entryZv * sprStd)
      IF stretchAbs > 0 THEN
         rVal = rawPnl / stretchAbs
      ELSE
         rVal = 0
      ENDIF
      // Trade log: plain writes indexed by a counter, so a tick of the live bar cannot add twice
      $trR[tradeCount] = rVal
      $trH[tradeCount] = barsInPos
      tradeCount = tradeCount + 1
      sumR = sumR + rVal
      sumHold = sumHold + barsInPos
      IF rVal > 0 THEN
         winCount = winCount + 1
      ENDIF
      exitDir = posState
      posState = 0
      lastExitBar = barindex
      goExit = 1
   ENDIF
ENDIF

// Event log for the marks: 1 long entry, -1 short entry, 2 exit of a long, -2 exit of a short
IF goLong = 1 OR goShort = 1 OR goExit = 1 THEN
   IF goLong = 1 THEN
      $evT[nEv] = 1
   ELSIF goShort = 1 THEN
      $evT[nEv] = 0 - 1
   ELSE
      $evT[nEv] = 2 * exitDir
   ENDIF
   $evX[nEv] = barindex
   $evHi[nEv] = high
   $evLo[nEv] = low
   $evCl[nEv] = close
   $evA[nEv] = atrV
   nEv = nEv + 1
ENDIF

// ===================== RIBBON AND REGIME TINT
IF close >= slowEma THEN
   rbR = bullR
   rbG = bullG
   rbB = bullB
ELSE
   rbR = bearR
   rbG = bearG
   rbB = bearB
ENDIF
rbA = 0
emaA = 0
IF slowOk = 1 THEN
   emaA = 153
   IF showBandFill = 1 THEN
      rbA = round(255 * (100 - ribbonAlpha) / 100)
   ENDIF
ENDIF
COLORBETWEEN(close, slowEma, rbR, rbG, rbB, rbA)

tintA = round(255 * (100 - tintAlpha) / 100)
IF showRegimeTint = 1 AND tradeable = 1 THEN
   BACKGROUNDCOLOR(bullR, bullG, bullB, tintA)
ENDIF

// ===================== DRAWING (everything is redrawn on the last bar)
IF islastbarupdate THEN
   // --- Entry / exit marks: the 500 most recent events
   IF nEv > 0 THEN
      FOR i = max(0, nEv - 500) TO nEv - 1 DO
         evType = $evT[i]
         evBar = $evX[i]
         evOff = $evA[i]
         IF evType = 1 THEN
            IF showTradeMarks = 1 THEN
               DRAWTEXT("▲", evBar, $evLo[i] - 0.3 * evOff, sansserif, bold, 10) COLOURED(bullR, bullG, bullB, 255)
            ENDIF
            IF showLabels = 1 THEN
               DRAWTEXT("R-LONG", evBar, $evLo[i] - 0.9 * evOff, sansserif, bold, 10) COLOURED(bullR, bullG, bullB, 255)
            ENDIF
         ELSIF evType = 0 - 1 THEN
            IF showTradeMarks = 1 THEN
               DRAWTEXT("▼", evBar, $evHi[i] + 0.3 * evOff, sansserif, bold, 10) COLOURED(bearR, bearG, bearB, 255)
            ENDIF
            IF showLabels = 1 THEN
               DRAWTEXT("R-SHORT", evBar, $evHi[i] + 0.9 * evOff, sansserif, bold, 10) COLOURED(bearR, bearG, bearB, 255)
            ENDIF
         ELSE
            IF showTradeMarks = 1 THEN
               DRAWTEXT("✕", evBar, $evCl[i], sansserif, bold, 10) COLOURED(mutR, mutG, mutB, 255)
            ENDIF
            IF showLabels = 1 THEN
               // Exit of a long: text above the bar. Exit of a short: below it
               IF evType = 2 THEN
                  DRAWTEXT("R-EXIT", evBar, $evHi[i] + 0.6 * evOff, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
               ELSE
                  DRAWTEXT("R-EXIT", evBar, $evLo[i] - 0.6 * evOff, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
               ENDIF
            ENDIF
         ENDIF
      NEXT
   ENDIF

   // --- Rounded values for the texts
   hlR1 = round(halfLife * 10) / 10
   hlR2 = round(halfLife * 100) / 100
   zR2 = round(zSc * 100) / 100
   spR3 = round(sprd * 1000) / 1000
   spR4 = round(sprd * 10000) / 10000

   // --- Half-life read-out to the right of the last bar
   IF showHLLabel = 1 AND barindex > 14 THEN
      xLb = barindex + 8
      IF hlOk = 1 THEN
         DRAWTEXT("HL = #hlR1# bars", xLb, close + 0.75 * atrV, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
      ELSE
         DRAWTEXT("HL = n/a bars", xLb, close + 0.75 * atrV, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
      ENDIF
      DRAWTEXT("Z = #zR2#", xLb, close + 0.25 * atrV, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
      DRAWTEXT("Spread = #spR3#", xLb, close - 0.25 * atrV, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
      IF tradeable = 1 THEN
         DRAWTEXT("TRADEABLE", xLb, close - 0.75 * atrV, sansserif, bold, 10) COLOURED(bullR, bullG, bullB, 255)
      ELSE
         DRAWTEXT("n/a", xLb, close - 0.75 * atrV, sansserif, standard, 10) COLOURED(mutR, mutG, mutB, 255)
      ENDIF
   ENDIF
ENDIF

// ===================== DASHBOARD
IF islastbarupdate AND showDash = 1 THEN
   // --- Unrealized R of the open trade
   liveOk = 0
   liveR = 0
   IF posState <> 0 THEN
      IF posState = 1 THEN
         liveRaw = close - entryPx
      ELSE
         liveRaw = entryPx - close
      ENDIF
      entryAbs = abs(entryZv * sprStd)
      IF entryAbs > 0 THEN
         liveR = liveRaw / entryAbs
      ENDIF
      liveOk = 1
   ENDIF
   lvR2 = round(liveR * 100) / 100

   // --- Rolling statistics
   rollWins = 0
   rollSumR = 0
   rollSumH = 0
   IF trackStats = 1 THEN
      rollTrades = min(tradeCount, maxTrades)
      IF rollTrades > 0 THEN
         FOR i = tradeCount - rollTrades TO tradeCount - 1 DO
            IF $trR[i] > 0 THEN
               rollWins = rollWins + 1
            ENDIF
            rollSumR = rollSumR + $trR[i]
            rollSumH = rollSumH + $trH[i]
         NEXT
      ENDIF
   ELSE
      rollTrades = tradeCount
      rollWins = winCount
      rollSumR = sumR
      rollSumH = sumHold
   ENDIF
   rollWinRate = 0
   rollAvgR = 0
   rollAvgHold = 0
   IF rollTrades > 0 THEN
      rollWinRate = 100 * rollWins / rollTrades
      rollAvgR = rollSumR / rollTrades
      rollAvgHold = rollSumH / rollTrades
   ENDIF
   wrR1 = round(rollWinRate * 10) / 10
   avR2 = round(rollAvgR * 100) / 100
   ahR1 = round(rollAvgHold * 10) / 10

   // --- Colours of the values
   IF zSc > 0 THEN
      zcR = bullR
      zcG = bullG
      zcB = bullB
   ELSIF zSc < 0 THEN
      zcR = bearR
      zcG = bearG
      zcB = bearB
   ELSE
      zcR = mutR
      zcG = mutG
      zcB = mutB
   ENDIF
   IF hlOk = 0 THEN
      hcR = mutR
      hcG = mutG
      hcB = mutB
   ELSIF halfLife < maxHalfLife THEN
      hcR = bullR
      hcG = bullG
      hcB = bullB
   ELSE
      hcR = bearR
      hcG = bearG
      hcB = bearB
   ENDIF
   IF posState = 1 THEN
      pcR = bullR
      pcG = bullG
      pcB = bullB
   ELSIF posState = 0 - 1 THEN
      pcR = bearR
      pcG = bearG
      pcB = bearB
   ELSE
      pcR = mutR
      pcG = mutG
      pcB = mutB
   ENDIF
   IF liveOk = 0 THEN
      ucR = mutR
      ucG = mutG
      ucB = mutB
   ELSIF liveR >= 0 THEN
      ucR = bullR
      ucG = bullG
      ucB = bullB
   ELSE
      ucR = bearR
      ucG = bearG
      ucB = bearB
   ENDIF
   IF rollWinRate >= 55 THEN
      wcR = bullR
      wcG = bullG
      wcB = bullB
   ELSIF rollWinRate >= 45 THEN
      wcR = 0
      wcG = 0
      wcB = 0
   ELSE
      wcR = bearR
      wcG = bearG
      wcB = bearB
   ENDIF
   IF rollAvgR > 0 THEN
      acR = bullR
      acG = bullG
      acB = bullB
   ELSIF rollAvgR < 0 THEN
      acR = bearR
      acG = bearG
      acB = bearB
   ELSE
      acR = mutR
      acG = mutG
      acB = mutB
   ENDIF

   // --- Text geometry: monospaced font, every character is chW pixels wide
   IF txtSize = 1 THEN
      pz = 9
   ELSIF txtSize = 3 THEN
      pz = 14
   ELSE
      pz = 11
   ENDIF
   chW = pz * 0.62
   rowH = pz + 8
   padX = 8
   padY = 4
   // Two columns: names (16 characters at most) and values (14)
   pW = 33 * chW + 2 * padX
   pH = 11 * rowH + 2 * padY
   // The dashboard sits in its corner, clear of the price scale on the right
   IF dashPos = 1 THEN
      pL = 10
      pT = 0 - 40
   ELSIF dashPos = 3 THEN
      pL = 10
      pT = 40 + pH
   ELSIF dashPos = 4 THEN
      pL = 0 - 85 - pW
      pT = 12 + pH
   ELSE
      pL = 0 - 85 - pW
      pT = 0 - 12
   ENDIF
   xVal = pL + padX + 26 * chW
   yHd = pT - padY - rowH
   yR0 = pT - padY - rowH * 0.5
   yR1 = pT - padY - rowH * 1.5
   yR2 = pT - padY - rowH * 2.5
   yR3 = pT - padY - rowH * 3.5
   yR4 = pT - padY - rowH * 4.5
   yR5 = pT - padY - rowH * 5.5
   yR6 = pT - padY - rowH * 6.5
   yR7 = pT - padY - rowH * 7.5
   yR8 = pT - padY - rowH * 8.5
   yR9 = pT - padY - rowH * 9.5
   yR10 = pT - padY - rowH * 10.5
   // Names aligned left: each one centred on half its own length
   xN0 = pL + padX + 14 * chW / 2
   xN1 = pL + padX + 6 * chW / 2
   xN2 = pL + padX + 7 * chW / 2
   xN3 = pL + padX + 16 * chW / 2
   xN4 = pL + padX + 10 * chW / 2
   xN5 = pL + padX + 8 * chW / 2
   xN6 = pL + padX + 11 * chW / 2
   xN7 = pL + padX + 12 * chW / 2
   xN8 = pL + padX + 15 * chW / 2
   xN9 = pL + padX + 8 * chW / 2
   xN10 = pL + padX + 13 * chW / 2
   IF dashPos = 1 THEN
      DRAWRECTANGLE(pL, pT, pL + pW, pT - pH) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 38)
      DRAWRECTANGLE(pL, pT, pL + pW, yHd - padY) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 64)
      DRAWTEXT("RENAISSANCE MR", xN0, yR0, monospaced, bold, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("[JOAT]", xVal, yR0, monospaced, bold, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      DRAWTEXT("Spread", xN1, yR1, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#spR4#", xVal, yR1, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Z-Score", xN2, yR2, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#zR2#", xVal, yR2, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(zcR, zcG, zcB, 255)
      DRAWTEXT("Half-Life (bars)", xN3, yR3, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF hlOk = 1 THEN
         DRAWTEXT("#hlR2#", xVal, yR3, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ELSE
         DRAWTEXT("n/a", xVal, yR3, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ENDIF
      DRAWTEXT("Tradeable?", xN4, yR4, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF tradeable = 1 THEN
         DRAWTEXT("YES", xVal, yR4, monospaced, bold, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      ELSE
         DRAWTEXT("no", xVal, yR4, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(mutR, mutG, mutB, 255)
      ENDIF
      DRAWTEXT("Position", xN5, yR5, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 1 THEN
         DRAWTEXT("LONG", xVal, yR5, monospaced, bold, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSIF posState = 0 - 1 THEN
         DRAWTEXT("SHORT", xVal, yR5, monospaced, bold, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSE
         DRAWTEXT("FLAT", xVal, yR5, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ENDIF
      DRAWTEXT("Bars in pos", xN6, yR6, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 0 THEN
         DRAWTEXT("-", xVal, yR6, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ELSE
         DRAWTEXT("#barsInPos#", xVal, yR6, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Unrealized R", xN7, yR7, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF liveOk = 0 THEN
         DRAWTEXT("-", xVal, yR7, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ELSE
         DRAWTEXT("#lvR2# R", xVal, yR7, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ENDIF
      DRAWTEXT("Win Rate (roll)", xN8, yR8, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF rollTrades > 0 THEN
         DRAWTEXT("#wrR1#%  (#rollTrades#)", xVal, yR8, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(wcR, wcG, wcB, 255)
         DRAWTEXT("#ahR1# bars", xVal, yR9, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("#avR2# R", xVal, yR10, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(acR, acG, acB, 255)
      ELSE
         DRAWTEXT("-", xVal, yR8, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR9, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR10, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Avg Hold", xN9, yR9, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Avg R / Trade", xN10, yR10, monospaced, standard, pz) ANCHOR(TOPLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
   ENDIF
   IF dashPos <> 1 AND dashPos <> 3 AND dashPos <> 4 THEN
      DRAWRECTANGLE(pL, pT, pL + pW, pT - pH) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 38)
      DRAWRECTANGLE(pL, pT, pL + pW, yHd - padY) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 64)
      DRAWTEXT("RENAISSANCE MR", xN0, yR0, monospaced, bold, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("[JOAT]", xVal, yR0, monospaced, bold, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      DRAWTEXT("Spread", xN1, yR1, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#spR4#", xVal, yR1, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Z-Score", xN2, yR2, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#zR2#", xVal, yR2, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(zcR, zcG, zcB, 255)
      DRAWTEXT("Half-Life (bars)", xN3, yR3, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF hlOk = 1 THEN
         DRAWTEXT("#hlR2#", xVal, yR3, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ELSE
         DRAWTEXT("n/a", xVal, yR3, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ENDIF
      DRAWTEXT("Tradeable?", xN4, yR4, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF tradeable = 1 THEN
         DRAWTEXT("YES", xVal, yR4, monospaced, bold, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      ELSE
         DRAWTEXT("no", xVal, yR4, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(mutR, mutG, mutB, 255)
      ENDIF
      DRAWTEXT("Position", xN5, yR5, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 1 THEN
         DRAWTEXT("LONG", xVal, yR5, monospaced, bold, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSIF posState = 0 - 1 THEN
         DRAWTEXT("SHORT", xVal, yR5, monospaced, bold, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSE
         DRAWTEXT("FLAT", xVal, yR5, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ENDIF
      DRAWTEXT("Bars in pos", xN6, yR6, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 0 THEN
         DRAWTEXT("-", xVal, yR6, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ELSE
         DRAWTEXT("#barsInPos#", xVal, yR6, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Unrealized R", xN7, yR7, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF liveOk = 0 THEN
         DRAWTEXT("-", xVal, yR7, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ELSE
         DRAWTEXT("#lvR2# R", xVal, yR7, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ENDIF
      DRAWTEXT("Win Rate (roll)", xN8, yR8, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF rollTrades > 0 THEN
         DRAWTEXT("#wrR1#%  (#rollTrades#)", xVal, yR8, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(wcR, wcG, wcB, 255)
         DRAWTEXT("#ahR1# bars", xVal, yR9, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("#avR2# R", xVal, yR10, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(acR, acG, acB, 255)
      ELSE
         DRAWTEXT("-", xVal, yR8, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR9, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR10, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Avg Hold", xN9, yR9, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Avg R / Trade", xN10, yR10, monospaced, standard, pz) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
   ENDIF
   IF dashPos = 3 THEN
      DRAWRECTANGLE(pL, pT, pL + pW, pT - pH) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 38)
      DRAWRECTANGLE(pL, pT, pL + pW, yHd - padY) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 64)
      DRAWTEXT("RENAISSANCE MR", xN0, yR0, monospaced, bold, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("[JOAT]", xVal, yR0, monospaced, bold, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      DRAWTEXT("Spread", xN1, yR1, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#spR4#", xVal, yR1, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Z-Score", xN2, yR2, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#zR2#", xVal, yR2, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(zcR, zcG, zcB, 255)
      DRAWTEXT("Half-Life (bars)", xN3, yR3, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF hlOk = 1 THEN
         DRAWTEXT("#hlR2#", xVal, yR3, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ELSE
         DRAWTEXT("n/a", xVal, yR3, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ENDIF
      DRAWTEXT("Tradeable?", xN4, yR4, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF tradeable = 1 THEN
         DRAWTEXT("YES", xVal, yR4, monospaced, bold, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      ELSE
         DRAWTEXT("no", xVal, yR4, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(mutR, mutG, mutB, 255)
      ENDIF
      DRAWTEXT("Position", xN5, yR5, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 1 THEN
         DRAWTEXT("LONG", xVal, yR5, monospaced, bold, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSIF posState = 0 - 1 THEN
         DRAWTEXT("SHORT", xVal, yR5, monospaced, bold, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSE
         DRAWTEXT("FLAT", xVal, yR5, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ENDIF
      DRAWTEXT("Bars in pos", xN6, yR6, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 0 THEN
         DRAWTEXT("-", xVal, yR6, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ELSE
         DRAWTEXT("#barsInPos#", xVal, yR6, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Unrealized R", xN7, yR7, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF liveOk = 0 THEN
         DRAWTEXT("-", xVal, yR7, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ELSE
         DRAWTEXT("#lvR2# R", xVal, yR7, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ENDIF
      DRAWTEXT("Win Rate (roll)", xN8, yR8, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF rollTrades > 0 THEN
         DRAWTEXT("#wrR1#%  (#rollTrades#)", xVal, yR8, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(wcR, wcG, wcB, 255)
         DRAWTEXT("#ahR1# bars", xVal, yR9, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("#avR2# R", xVal, yR10, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(acR, acG, acB, 255)
      ELSE
         DRAWTEXT("-", xVal, yR8, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR9, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR10, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Avg Hold", xN9, yR9, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Avg R / Trade", xN10, yR10, monospaced, standard, pz) ANCHOR(BOTTOMLEFT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
   ENDIF
   IF dashPos = 4 THEN
      DRAWRECTANGLE(pL, pT, pL + pW, pT - pH) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 38)
      DRAWRECTANGLE(pL, pT, pL + pW, yHd - padY) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(120, 123, 134, 128) FILLCOLOR(120, 123, 134, 64)
      DRAWTEXT("RENAISSANCE MR", xN0, yR0, monospaced, bold, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("[JOAT]", xVal, yR0, monospaced, bold, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      DRAWTEXT("Spread", xN1, yR1, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#spR4#", xVal, yR1, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Z-Score", xN2, yR2, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("#zR2#", xVal, yR2, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(zcR, zcG, zcB, 255)
      DRAWTEXT("Half-Life (bars)", xN3, yR3, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF hlOk = 1 THEN
         DRAWTEXT("#hlR2#", xVal, yR3, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ELSE
         DRAWTEXT("n/a", xVal, yR3, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(hcR, hcG, hcB, 255)
      ENDIF
      DRAWTEXT("Tradeable?", xN4, yR4, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF tradeable = 1 THEN
         DRAWTEXT("YES", xVal, yR4, monospaced, bold, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(bullR, bullG, bullB, 255)
      ELSE
         DRAWTEXT("no", xVal, yR4, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(mutR, mutG, mutB, 255)
      ENDIF
      DRAWTEXT("Position", xN5, yR5, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 1 THEN
         DRAWTEXT("LONG", xVal, yR5, monospaced, bold, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSIF posState = 0 - 1 THEN
         DRAWTEXT("SHORT", xVal, yR5, monospaced, bold, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ELSE
         DRAWTEXT("FLAT", xVal, yR5, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(pcR, pcG, pcB, 255)
      ENDIF
      DRAWTEXT("Bars in pos", xN6, yR6, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF posState = 0 THEN
         DRAWTEXT("-", xVal, yR6, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ELSE
         DRAWTEXT("#barsInPos#", xVal, yR6, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Unrealized R", xN7, yR7, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF liveOk = 0 THEN
         DRAWTEXT("-", xVal, yR7, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ELSE
         DRAWTEXT("#lvR2# R", xVal, yR7, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(ucR, ucG, ucB, 255)
      ENDIF
      DRAWTEXT("Win Rate (roll)", xN8, yR8, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      IF rollTrades > 0 THEN
         DRAWTEXT("#wrR1#%  (#rollTrades#)", xVal, yR8, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(wcR, wcG, wcB, 255)
         DRAWTEXT("#ahR1# bars", xVal, yR9, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("#avR2# R", xVal, yR10, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(acR, acG, acB, 255)
      ELSE
         DRAWTEXT("-", xVal, yR8, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR9, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
         DRAWTEXT("-", xVal, yR10, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      ENDIF
      DRAWTEXT("Avg Hold", xN9, yR9, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
      DRAWTEXT("Avg R / Trade", xN10, yR10, monospaced, standard, pz) ANCHOR(BOTTOMRIGHT, XSHIFT, YSHIFT) COLOURED(0, 0, 0, 255)
   ENDIF
ENDIF

RETURN slowEma COLOURED(mutR, mutG, mutB, emaA) STYLE(line, 2) AS "Slow EMA (slow leg)"
Download
Filename: PRC_Renaissance-Mean-Rev.itf
Downloads: 7
Iván González
Iván González Legend
Code artist, my biography is a blank page waiting to be scripted. Imagine a bio so awesome it hasn't been coded yet.
Author’s Profile

Comments

ProRealCode ProRealCode
Loading...