Rex Entry / Exit Oscillator For ThinkOrSwim

blackbeard12

New member
Hey guys, I encourage you to hop on trading view and throw up "Rex Indicator," very powerful exit indicator that I'm sure some of y'all would like, if anyone knows how to convert it, the code is below. Def worth checking out, beautiful especially with range bars.
 
Last edited by a moderator:

diazlaz

Well-known member
2019 Donor
VIP
Hi @blackbeard12, take it for a spin, let us know what your thoughts are and how you're currently using it.

Bs2uTuC.png


Ruby:
#REX Indicator System V1.0 for ThinkOrSwim
#
#VERSION
# 2020.05.03 @diazlaz - initial port/interpretation.
#
#LINK
#https://www.tradingview.com/script/m08Wp5xr-REX-by-vitelot/
#
#INSTRUCTION
#Best used as an exit indicator at default settings.
#Also doing well in entering positions by using TEMA(14)
#for REX and SMA(14) as signal.
#
#You need to tune it yourself according to your trading style.
#Use at your own risk.
#
#CREDITS
#Vitelot/Yanez/Vts Oct 2019
#

declare lower;

input rex_ma_type = {"EMA", default "SMA", "Tenkan", "TEMA"};
input sig_ma_type = {"EMA", default "SMA", "Tenkan", "TEMA"};
input smoothing = 14;
input smoothing_sig = 14;

#def tvb = 3*close-open-high-low;
def tvb = 3*close - (open+high+low);

def rex;
switch (rex_ma_type) {
case "EMA":
    rex = ExpAverage(tvb,smoothing);
case "SMA":
    rex = Average(tvb,smoothing);
case "Tenkan":
    rex = 0.5 * (highest(tvb, smoothing) + lowest(tvb, smoothing));
case "TEMA":
    rex = 3 * (ExpAverage(tvb,smoothing) - ExpAverage(ExpAverage(tvb,smoothing), smoothing)) + ExpAverage(ExpAverage(ExpAverage(tvb,smoothing), smoothing), smoothing);
}

def sig;
switch (sig_ma_type) {
case "EMA":
    sig = ExpAverage(rex,smoothing_sig);
case "SMA":
    sig = Average(rex,smoothing_sig);
case "Tenkan":
    sig = 0.5 * (highest(rex, smoothing_sig) + lowest(rex, smoothing_sig));
case "TEMA":
    sig = 3 * (ExpAverage(rex,smoothing_sig) - ExpAverage(ExpAverage(rex,smoothing_sig), smoothing_sig)) + ExpAverage(ExpAverage(ExpAverage(tvb,smoothing_sig), smoothing_sig), smoothing_sig);
}

AddLabel(1, "REX", COLOR.ORANGE);
plot pRex = rex;
pRex.SetLineWeight(2);

plot pSig = sig;
plot pZeroline = 0;

#END of REX for ThinkOrSwim 1.0
 
Gave the REX script a quick back test. Lots of options. Thanks for converting this. It's going to take some tweaking if it's going to fit into my system.
 

BigScalp

New member
VIP
@Joshua can you code for the REX INDICATOR for my watchlist to show a light blue color in the column for every time the pRex touches (coming from the bottom) and/or crosses up above the pSig? I'll be using this on a 5M chart but would be great if it worked for all timeframes. Your time is much appreciated.
Ruby:
#REX Indicator System V1.0 for ThinkOrSwim
#
#VERSION
# 2020.05.03 @diazlaz - initial port/interpretation.
#
#LINK
#https://www.tradingview.com/script/m08Wp5xr-REX-by-vitelot/
#
#INSTRUCTION
#Best used as an exit indicator at default settings.
#Also doing well in entering positions by using TEMA(14)
#for REX and SMA(14) as signal.
#
#You need to tune it yourself according to your trading style.
#Use at your own risk.
#
#CREDITS
#Vitelot/Yanez/Vts Oct 2019
#

declare lower;

input rex_ma_type = {"EMA", default "SMA", "Tenkan", "TEMA"};
input sig_ma_type = {"EMA", default "SMA", "Tenkan", "TEMA"};
input smoothing = 14;
input smoothing_sig = 14;

#def tvb = 3*close-open-high-low;
def tvb = 3*close - (open+high+low);

def rex;
switch (rex_ma_type) {
case "EMA":
rex = ExpAverage(tvb,smoothing);
case "SMA":
rex = Average(tvb,smoothing);
case "Tenkan":
rex = 0.5 * (highest(tvb, smoothing) + lowest(tvb, smoothing));
case "TEMA":
rex = 3 * (ExpAverage(tvb,smoothing) - ExpAverage(ExpAverage(tvb,smoothing), smoothing)) + ExpAverage(ExpAverage(ExpAverage(tvb,smoothing), smoothing), smoothing);
}

def sig;
switch (sig_ma_type) {
case "EMA":
sig = ExpAverage(rex,smoothing_sig);
case "SMA":
sig = Average(rex,smoothing_sig);
case "Tenkan":
sig = 0.5 * (highest(rex, smoothing_sig) + lowest(rex, smoothing_sig));
case "TEMA":
sig = 3 * (ExpAverage(rex,smoothing_sig) - ExpAverage(ExpAverage(rex,smoothing_sig), smoothing_sig)) + ExpAverage(ExpAverage(ExpAverage(tvb,smoothing_sig), smoothing_sig), smoothing_sig);
}

AddLabel(1, "REX", COLOR.ORANGE);
plot pRex = rex;
pRex.SetLineWeight(2);

plot pSig = sig;
plot pZeroline = 0;

#END of REX for ThinkOrSwim 1.0
 
Last edited by a moderator:

Joshua

Active member
Watchlist columns must basically be hard-coded. There is no additional screen that pops up in which to adjust their settings. You can only select the aggregation period to be used, and whether or not to include extended hours. The vast majority of this particular indicator is dedicated to settings selection, so you will have to edit them manually, comment/uncomment them if you want to change them.

Ruby:
def smoothing = 14;
def smoothing_sig = 14;

#def tvb = 3*close-open-high-low;
def tvb = 3*close - (open+high+low);

def rex;
#switch (rex_ma_type) {
#case "EMgsA":
    #rex = ExpAverage(tvb,smoothing);
#case "SMA":
    rex = Average(tvb,smoothing);
#case "Tenkan":
    #rex = 0.5 * (highest(tvb, smoothing) + lowest(tvb, smoothing));
#case "TEMA":
    #rex = 3 * (ExpAverage(tvb,smoothing) - ExpAverage(ExpAverage(tvb,smoothing), smoothing))  + #ExpAverage(ExpAverage(ExpAverage(tvb,smoothing), smoothing), smoothing);
#}

def sig;
#switch (sig_ma_type) {
#case "EMA":
    #sig = ExpAverage(rex,smoothing_sig);
#case "SMA":
    sig = Average(rex,smoothing_sig);
#case "Tenkan":
    #sig = 0.5 * (highest(rex, smoothing_sig) + lowest(rex, smoothing_sig));
#case "TEMA":
    #sig = 3 * (ExpAverage(rex,smoothing_sig) - ExpAverage(ExpAverage(rex,smoothing_sig), #smoothing_sig)) + ExpAverage(ExpAverage(ExpAverage(tvb,smoothing_sig), smoothing_sig), smoothing_sig);
#}

plot x = rex;

x.AssignValueColor(
    if crosses(rex,sig,crossingDirection.ABOVE) then color.cyan
    else color.BLACK);
AssignBackgroundColor(
    if crosses(rex,sig,crossingDirection.ABOVE) then color.cyan
    else color.BLACK);
 

BigScalp

New member
VIP
Watchlist columns must basically be hard-coded. There is no additional screen that pops up in which to adjust their settings. You can only select the aggregation period to be used, and whether or not to include extended hours. The vast majority of this particular indicator is dedicated to settings selection, so you will have to edit them manually, comment/uncomment them if you want to change them.

Ruby:
def smoothing = 14;
def smoothing_sig = 14;

#def tvb = 3*close-open-high-low;
def tvb = 3*close - (open+high+low);

def rex;
#switch (rex_ma_type) {
#case "EMgsA":
    #rex = ExpAverage(tvb,smoothing);
#case "SMA":
    rex = Average(tvb,smoothing);
#case "Tenkan":
    #rex = 0.5 * (highest(tvb, smoothing) + lowest(tvb, smoothing));
#case "TEMA":
    #rex = 3 * (ExpAverage(tvb,smoothing) - ExpAverage(ExpAverage(tvb,smoothing), smoothing))  + #ExpAverage(ExpAverage(ExpAverage(tvb,smoothing), smoothing), smoothing);
#}

def sig;
#switch (sig_ma_type) {
#case "EMA":
    #sig = ExpAverage(rex,smoothing_sig);
#case "SMA":
    sig = Average(rex,smoothing_sig);
#case "Tenkan":
    #sig = 0.5 * (highest(rex, smoothing_sig) + lowest(rex, smoothing_sig));
#case "TEMA":
    #sig = 3 * (ExpAverage(rex,smoothing_sig) - ExpAverage(ExpAverage(rex,smoothing_sig), #smoothing_sig)) + ExpAverage(ExpAverage(ExpAverage(tvb,smoothing_sig), smoothing_sig), smoothing_sig);
#}

plot x = rex;

x.AssignValueColor(
    if crosses(rex,sig,crossingDirection.ABOVE) then color.cyan
    else color.BLACK);
AssignBackgroundColor(
    if crosses(rex,sig,crossingDirection.ABOVE) then color.cyan
    else color.BLACK);
@Joshua your time and detailed explanation is mush appreciated. This is exactly what I needed.

4:47am 10/21/21
 
Last edited:

Similar threads

Top