Trading Divergence Monster Laguerre + Inertia For ThinkOrSwim

MagicBlueBalls

New member
Hello traders. I managed to get this code from a friend. He is a little weird, but he makes money consistently trading /es. That's all he does.
So... here it is the Trading Divergence Monster Laguerre + Inertia.

If anyone here can improve on this indicator please contribute. As it is... the code is pretty consistent and works really well on 5 tick Renko charts for /es. I haven't tested it on any other stonks.

HINT - IMPORTANT!
"#Turn off the original inertia, Mobius Laguerre [RSI], CTTC, SumSum. You can mess around with the mimic and the STDs deviations... The STDs can give some good signals between 1 and 1.3. "

@mashume

Quick edit:
I love it when the Renko bricks are bottom or top flat and you can see the divergence on the indicator. This is in my opinion the best type of divergence this indicator offers. Today, this indicator offered around 8 to 10 good signals. I know my friend has made some tweaks that give fewer signals but it is more accurate... like 80% to 90% ... but he is not giving me that part of the code.

h338eR0.png


Here is a comparison with common indicators... MACD, RSI, Full Stoch, Inertia... The code is similar to MACD for divergences but in some instances, the monster does a better job identifying them.

qmVGgib.png


Ruby:
#Sup Magic. Here is the code you wanted. I compiled a bunch into this. It is intended to be used in Renko charts, but it works just fine in time charts. Stick to 5 and 15 mins ... any lower and it is a mess.
#Let's begin:

#Turn off the original inertia, Mobius Laguerre [RSI], CTTC, SumSum. You can mess around with the mimic and the STDs deviations... The STDs can give some good signals between 1 and 1.3.

#This is the Trading Divergence Monster Laguerre + Inertia For ThinkOrSwim


#This works because I am using Volume . Mashume's code is probably not necessary but I'm leaving it there. He is good. Maybe he can improve on this.

declare lower;

#Mashume created this one. You may find it at https://usethinkscript.com/threads/renko-wave-volume.10005/#post-89852
input lengthTRQ = 10;
def trend_change = if (open[1] < close[1] and open > close) or (open[1] > close[1] and open < close) then 1 else 0;

def direction = if (open[1] < close[1] and open > close) then -1 else if (open[1] > close[1] and open < close) then 1 else direction[1];

def cumulative_trend_tick_count = if trend_change == 1 then direction * tick_count() else cumulative_trend_tick_count[1] + (direction * tick_count());
plot CTTC = cumulative_trend_tick_count;

CTTC.AssignValueColor(if CTTC <= 0 then color.dark_red else color.dark_green);
CTTC.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

plot sumsum = sum(CTTC, lengthTRQ) / lengthTRQ;
sumsum.SetDefaultColor(color.black);
sumSum.AssignValueColor(if sumsum <= 0 then color.light_red else color.light_green);
SumSum.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

########################################################################
######################################################
############################
#############
######
#
#
# TD Ameritrade IP Company, Inc. (c) 2009-2022
#


input lengthFGH = 20;
input rviLength = 14;

plot Inertia = Inertia(RelativeVolatilityIndex(rviLength), lengthFGH);

Inertia.SetDefaultColor(GetColor(1));

########################################################################
######################################################
############################
#############
######
#

# Mobius©: ## RSI in Laguerre Time auto-adjusted with fractal dimensions algorithm
# Mobius
# V03.08.2014
# Added Squeeze Points color coded by RSI position (for no particular reason other than I could)
# Dilbert/Thomas - Here's a compendium of Mobius comments regarding interpretation of the his RSI Laguerre/FE study. Since some of the info was duplicated across several days I have attempted to re-order it in some logical fashion.

#DISCLAIMER: Mobius mentioned that it was not his habit to give trading advice or even advice on how to use indicators. However, there's been such a proliferation of bad, inaccurate, false info regarding so many of them recently he felt compelled to give some accurate information.

#Mobius©: I use a very simple method – RSI Laguerre and Fractal Energy on a list of very liquid stocks. I look for polarity change and trade when both RSI and FE are in “confluence”. If volatility is high enough I sell spreads if not I buy them. Other than hedging (which I do a lot of) that's it. I like it simple.

#The typical base setting I like to use for the FE is a length of 8. If I'm trading options I like to look at it about the length of time I'm buying or selling the option for. I want to know if it's reverting and where the energy is so I'll use a longer length for reversion and a shorter length to see if energy is building or waning.

##If RSI Laguerre is descending and FE over .6, that tells me something is changing and I'm already looking at an equity I've determined is about to make a polarity change. So the worse case that happens is that the security grinds sideways for a few days.

#A reading of the FE over .6 is an indication that energy has been built up. If the FE is high (over .6) and RSI LaGuerre is breaking lower FE will follow suit. If RSI reverses and goes above .8 I'm outa there, with the assumption I have a short position.

#FE is a gauge of both mean reverting and linearity. Descending readings indicate a trend is on. A reading below .3 indicates exhaustion in trend or near exhaustion. A reading above .6 indicates moving sideways with rapid reversion and energy building for a move again.

#Above .6 - Think price compression or squeeze Below .3 - Think running out of gas

#Here's an example:

#FE at 60 periods is oscillating around .5 tightly while FE at 8 periods is over .6. Zscore is over 2 and is starting to roll over. That is a good short to the mean.

#Short trade setup I look for with RSI Laguerre adjusted with FE.

#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high

#2) RSI Laguerrer is above .8 and descending from 1

#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case price has risen to a lower resistance and has been rolling slowly over building energy.

#Inputs:
input n = 3;  #hint n: Periods for fractal dimensions calculations
input AscaleLow  = .0381; #hint AscaleLow: Typical range from .1 to .5
input AscaleHigh = .0619; #hint AscaleHigh: Typical range from .5 to .9
input timeFrame = {default DAY, WEEK, MONTH};
input PriceTW = {default HeikenAshi, VWAP};

# Variables:
def v = volume;
def cap = GetAggregationPeriod();
def errorInAggregation =
    timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or
    timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH;
Assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period");
def yyyyMmDd = GetYYYYMMDD();
def periodIndx;
switch (timeFrame) {
case DAY:
    periodIndx = yyyyMmDd;
case WEEK:
    periodIndx = Floor((DaysFromDate(First(yyyyMmDd)) + GetDayOfWeek(First(yyyyMmDd))) / 7);
case MONTH:
    periodIndx = RoundDown(yyyyMmDd / 100, 0);
}
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes);
def volumeSum;
def volumeVwapSum;
def volumeVwap2Sum;
if (isPeriodRolled) {
    volumeSum = v;
    volumeVwapSum = v * vwap;
    volumeVwap2Sum = v * Sqr(vwap);
} else {
    volumeSum = CompoundValue(1, volumeSum[1] + v, v);
    volumeVwapSum = CompoundValue(1, volumeVwapSum[1] + v * vwap, v * vwap);
    volumeVwap2Sum = CompoundValue(1, volumeVwap2Sum[1] + v * Sqr(vwap), v * Sqr(vwap));
}
def p = volumeVwapSum / volumeSum;
def o;
def h;
def l;
def c;
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def B;
def Ascaled;
def TR;
def data;
def L0;
def L1V;
def L2V;
def L3V;
plot RSI;
#plot OS;
#plot OB;
#plot MID;

# Internal Script
script Scale {
    input c = close;
    input Min = .01;
    input Max =   1;
    def hh = HighestAll(c);
    def ll   = LowestAll(c);
    plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
}
# Calculations
o = open;
h = high;
l = low;
c = close;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2, (o[1] + c[1]) / 2);
HAhigh = Max(Max(h, HAopen), HAclose[1]);
HAlow = Min(Min(l, HAopen), HAclose[1]);
HAclose = (HAopen + HAhigh + HAlow + HAclose[1]) / 4;
def PriceData;
switch (PriceTW) {
case VWAP:
    PriceData = p;
case HeikenAshi:
    PriceData = HAclose;
}
TR = Max(HAhigh, HAclose[1]) - Min(HAlow, HAclose[1]);
B = (Log(Sum(TR, n) / (Highest(HAhigh, n) - Lowest(HAlow, n)))
             / Log(10)) / (Log(n) / Log(10));
Ascaled = Round(Scale(c = B, min = AscaleLow, max = AscaleHigh), 2);
data = if IsNaN(Ascaled) then data[1] else Ascaled;
L0 = (1 – data) * PriceData + data * L0[1];
L1V = -data * L0 + L0[1] + data * L1V[1];
L2V = -data * L1V + L1V[1] + data * L2V[1];
L3V = -data * L2V + L2V[1] + data * L3V[1];
if L0 >= L1V
then {
    CU1 = L0 - L1V;
    CD1 = 0;
} else {
    CD1 = L1V - L0;
    CU1 = 0;
}
if L1V >= L2V
then {
    CU2 = CU1 + L1V - L2V;
    CD2 = CD1;
} else {
    CD2 = CD1 + L2V - L1V;
    CU2 = CU1;
}
if L2V >= L3V
then {
    CU = CU2 + L2V - L3V;
    CD = CD2;
} else {
    CU = CU2;
    CD = CD2 + L3V - L2V;
}
RSI = if CU + CD <> 0
      then if  CU / (CU + CD) < .09
           then 0
           else if CU / (CU + CD) > .9
                then 100
           else CU / (CU + CD)
      else 0;
#OS = if IsNaN(close) then Double.NaN else 20;
#OB = if IsNaN(close) then Double.NaN else 80;
#MID = if IsNaN(close) then Double.NaN else 50;
RSI.SetDefaultColor(Color.CYAN);
RSI.SetLineWeight(1);
#OS.SetDefaultColor(Color.GRAY);
#OB.SetDefaultColor(Color.GRAY);
#MID.SetDefaultColor(Color.DARK_GRAY);
#MID.SetStyle(Curve.Short_Dash);
#AddCloud(100,  OB,  Color.GREEN);
#AddCloud(0, OS, Color.RED);
#Alert(RSI crosses below 90, "", Alert.BAR, Sound.Bell);
#Alert(RSI crosses above 10, "", Alert.BAR, Sound.Bell);

# Price Compression (Squeeze)
#def Avg;
#def ATR;
#def SD;
#def Squeeze;
#plot SqLoc;

#Avg = Average(close, 20);
#ATR = Average(TrueRange(high, close, low), 20);
#SD = StDev(close, 20);
#Squeeze = if Avg + (2 * SD) < Avg + (1.5 * ATR)
#          then 100
#          else Double.NaN;
#SqLoc = if !IsNaN(Squeeze) and RSI >= 80
#        then 90
#        else if !IsNaN(Squeeze) and RSI <= 20
#        then 10
#        else if !IsNaN(Squeeze) and Between(RSI, 20, 80)
#        then 50
#        else Double.NaN;
#SqLoc.SetPaintingStrategy(PaintingStrategy.POINTS);
#SqLoc.SetLineWeight(3);
#SqLoc.AssignValueColor(if SqLoc == 90
#                         then Color.WHITE
#                         else if SqLoc == 10
#                         then Color.YELLOW
#                         else if SqLoc == 50
#                         then Color.CYAN
#                         else Color.CURRENT);
#AddLabel(!IsNaN(Squeeze), "Squeeze", if SqLoc == 90
#                                     then Color.WHITE
#                                     else if SqLoc == 10
#                                     then Color.YELLOW
#                                     else if SqLoc == 50
#                                     then Color.BLUE
#                                     else Color.CURRENT);
# Scan Plots
#plot LongScan = if (RSI > RSI[1]) or (RSI > 80) then 1 else 0;
#LongScan.Hide();
#plot ShortScan = if (RSI < 20) then 1 else 0;
#ShortScan.Hide();
#def target = if RSI crosses above 20
#             then Round((close + (1.5 * ATR)) / TickSize(), 0) * TickSize()
#             else if RSI crosses below 80
#                  then Round((close - (1.5 * ATR)) / TickSize(), 0) * TickSize()
#                  else target[1];
#AddLabel(1, "Target " + AsDollars(Round(target)),
#             if RSI > 20 and RSI > RSI[1]
#             then Color.Green
#             else if RSI < 80 and RSI < RSI[1]
#                  then Color.Red
#                  else Color.White);
# End Code

########################################################################
######################################################
############################
#############
######
#PercentileQ Calculations

def vol = reference VolumeZoneOscillator();
def volY = reference OnBalanceVolume();
def volX = reference MoneyFlowIndex();
def volA = reference ADX();
def volB = reference VolumeAvg();
def volJ = reference ChaikinMoneyFlow();
def volU = reference PercentChg();
def volT = reference KlingerOscillator();
def volM = reference RSI();
def volC = reference SlowVSI();
def volW = reference NegativeVolumeIndex();
def volS = reference ForceIndex();
def volH = reference PolarizedFractalEfficiency();
def volD = reference PositiveVolumeIndex();
def volN = reference ATR ();
def volR = reference ForceIndex ();
def volK = tick_count;
DEF volL = CTTC;
def volZ = volume;
input TimePeriod = 21;
#input SmoothLen = 21;
#input SmoothLenX = 21;
#input SmoothLenH = 21;

#def data = if !IsNaN((vol+volA+volx)*volume) then ((vol+volA+volx)*volume) else ((vol+volA+volx)*volume);
#def data = if !IsNaN((vol+volA+volx)) then ((vol+volA+volx)) else ((vol+volA+volx));
#def data = if !IsNaN((vol+volx)) then ((vol+volx)) else ((vol+volx));
#def data = if !IsNaN((vol+volj)*volume) then ((vol+volj)*volume) else ((vol+volj)*volume);
#def data = if !IsNaN((vol+volj)) then ((vol+volj)) else ((vol+volj));
#def data = if !IsNaN((vol+volu)) then ((vol+volu)) else ((vol+volu));
#def data = if !IsNaN((vol+volt)) then ((vol+volt)) else ((vol+volt));
#def data = if !IsNaN((vol+voly+volm)) then ((vol+voly+volm)) else ((vol+voly+volm));
#def data = if !IsNaN((volw+vol+voly)) then ((volw+vol+voly)) else ((volw+vol+voly));
#def data = if !IsNaN((volw+voly)) then ((volw+voly)) else ((volw+voly)); #Good
#def data = if !IsNaN((volw+vols)) then ((volw+vols)) else ((volw+vols));
#def data = if !IsNaN((volw+vols)) then ((volw+vols)) else ((volw+vols));
#def data = if !IsNaN((vol+volr)) then ((vol+volr)) else ((vol+volr));
#def data = if !IsNaN((vol+volr+volh)) then ((vol+volr+volh)) else ((vol+volr+volh));
#def data = if !IsNaN((vol+volh)) then ((vol+volh)) else ((vol+volh));
#def dataX = if !IsNaN((vol+voly+volj+volr+rsi)) then ((vol+voly+volj+volr+rsi)) else ((vol+voly+volj+volr+rsi));
#def dataX = if !IsNaN((vol+voly+volw+vold)) then ((vol+voly+volw+vold)) else ((vol+voly+volw+vold));
#def dataX = if !IsNaN((vol+volw+vold)) then ((vol+volw+vold)) else ((vol+volw+vold));
#def dataX = if !IsNaN((volw+vold)) then ((volw+vold)) else ((volw+vold)); #Good
#def data = if !IsNaN((vol+voly+volr)) then ((vol+voly+volr)) else ((vol+voly+volr));
#def data = if !IsNaN((voly+volr)) then ((voly+volr)) else ((voly+volr));
#def data = if !IsNaN((volr)) then ((volr)) else ((volr));
#def dataX = if !IsNaN((volw+vold+voly)) then ((volw+vold+voly)) else ((volw+vold+voly)); #good
#def dataX = if !IsNaN(WMA(volw+vold+voly)) then (WMA(volw+vold+voly)) else (WMA(volw+vold+voly));
#def dataX = if !IsNaN(TEMA(vol+voly+voln)) then (TEMA(vol+voly+voln)) else (TEMA(vol+voly+voln));
#def dataX = if !IsNaN(WMA(vol+voly+voln)) then (TEMA(vol+voly+voln)) else (TEMA(vol+voly+voln));
#def dataX = if !IsNaN((vol+voly)) then ((vol+voly)) else ((vol+voly));
#def dataX = if !IsNaN(HullMovingAvg(volw+vold+voly)) then (HullMovingAvg(volw+vold+voly)) else (HullMovingAvg(volw+vold+voly));
#def dataX = if !IsNaN(ExpAverage(volw+vold+voly)) then (ExpAverage(volw+vold+voly)) else (ExpAverage(volw+vold+voly));
#def dataX = if !IsNaN(TEMA(vol+voly+volk+voln)) then (TEMA(vol+voly+volk+voln)) else (TEMA(vol+voly+volk+voln));

#def dataX = if !IsNaN(TEMA(vol+voly+volz+volw+vold)) then (TEMA(vol+voly+volz+volw+vold)) else (TEMA(vol+voly+volz+volw+vold)); #INTERESTING

#def dataX = if !IsNaN(TEMA(vol+voly+volw+vold)) then (TEMA(vol+voly+volw+vold)) else (TEMA(vol+voly+volw+vold));

#def dataX = if !IsNaN(TEMA(vol+voly+volw+vold)) then (TEMA(vol+voly+volw+vold)) else (TEMA(vol+voly+volw+vold));

#def dataX = if !IsNaN(WMA(vol + volY + volZ + volW + volD + volL + volR)) then (WMA(vol + volY + volZ + volW + volD + volL + volR)) else (WMA(vol + volY + volZ + volW + volD + volL + volR)); #INTERESTING

def dataX = if !IsNaN(TEMA(vol + volY + volZ + volW + volD + volL + volR)) then (TEMA(vol + volY + volZ + volW + volD + volL + volR)) else (TEMA(vol + volY + volZ + volW + volD + volL + volR)); #INTERESTING

def hi = Highest(dataX, TimePeriod);
def lo = Lowest(dataX, TimePeriod);
#plot Percentile = (HullMovingAvg((datax - lo) / (hi - lo)) * 100);
#plot PercentileR = ((TEMA((datax - lo) / (hi - lo)) * voln) * 100);
#plot PercentileR = ((TEMA((datax - lo) / (hi - lo))* voln) * 100);
#plot PercentileQ = TEMA(((datax - lo) / (hi - lo)) * 100) + RSI;
plot PercentileQ = TEMA((((dataX - lo) / (hi - lo)) * 100) + (RSI + Inertia));#Interesting
#plot PercentileQ = TEMA(((datax - lo) / (hi - lo)) * 100);
#plot PercentileQ = ((WMA((datax - lo) / (hi - lo))) * 100) + RSI;
#plot PercentileQ = ((((datax - lo) / (hi - lo))) * 100);
#plot PercentileQ = ((TEMA((datax - lo) / (hi - lo)) * vola) * 100);
#plot PercentileQ = TEMA(((datax - lo) / (hi - lo)) * 100);
#plot PercentileQ = WMA(((dataX - lo) / (hi - lo))) * 100;
#plot PercentileQ = ExpAverage(((datax - lo) / (hi - lo)) * 100);

plot Mimic = PercentileQ [1];

input Dynlength = 21;
input Regulator = 1.130504;
#Plot DynUp = Average(PercentileQ,Dynlenght) + (1*StDev(PercentileQ,Dynlenght));
#Plot DynBot = Average(PercentileQ,Dynlenght) - (1*StDev(PercentileQ,Dynlenght));

plot DynUp = WMA(PercentileQ, Dynlength) + (Regulator * StDev(PercentileQ, Dynlength));
plot DynBot = WMA(PercentileQ, Dynlength) - (Regulator * StDev(PercentileQ, Dynlength));

input PerR = 31;
plot RSignal = WMA(PercentileQ, PerR);
#plot RSignal = TEMA(percentileQ, PerR);
#plot RSignal = ExpAverage(percentileQ, PerR);


#plot Cero = 0;
plot Fity = 50;
plot Cien = 100;
plot OneFity = 150;
 
Last edited by a moderator:

RickK

Active member
Very interesting @MagicBlueBalls ! Thank you for your contribution. Interesting indicator.

I took a close look at it and while I don't know if I've "improved" it, I did add a few slight visual modifications that might help. Please see the images and chart link below. The clouds and the varying color RSignal line can provide good confirmation on the divergence opportunity at times. (I've been burned by taking divergence trades too many times...so this may help.)

I do have a question about the author's statement "You can mess around with the mimic and the STDs deviations... The STDs can give some good signals between 1 and 1.3. " Do you have a way to elaborate on that? Oh, and regarding his mention of using on a 5 or 15m chart but nothing faster, I couldn't find much looking good on those timeframes at all. Is renko the way he uses it?.... optimal?

Thanks again! Although I'm not a great fan of renko, I plan on taking a close look at it during the action on monday.
(thanks @diazlaz )

Chart link: https://tos.mx/GjdMw0T


 
Last edited by a moderator:

Splinter

Member
VIP
Interesting indicator. Plots similar lines as the CSA Normalized MACD Stoch.
Since I'm not familiar with coding I can only go with what I see.


Code:
## OneNote Archive Name: C.S.A Combined Signal Approach Normalized MACD, Stochastic _Mobius

## Archive Section: Uncategorized 

## Suggested Tos Name: CSA_CombinedSignalApproach_StocMACD_Mobius

## Archive Date: 5.15.2018

## Archive Notes: 

 

## "##" indicates an addition or adjustment by the OneNote Archivist

 

## Original Code Follows

 

# C.S.A (Combined Signal Approach)

# Normalized MACD, Stochastic

# Mobius

# V02.07.2013

 

declare lower;

 

script normalizePlot {

    input data = close;

    input newRngMin =  -1;

    input newRngMax = 1;

    def hhData = HighestAll( data );

    def llData = LowestAll( data );

    plot nr = ((( newRngMax - newRngMin ) * ( data - llData )) / 

                      ( hhData - llData )) + newRngMin;

}

 

input fastEMA = 12;

input slowEMA = 26;

input Smooth  =  9;

input nK = 10;

input nD = 3;

input OverBought = 80;

input OverSold = 20;

 

def c   = close;

# MACD

script MACD{

   input fastEMA = 13;

   input slowEMA = 21;

   input Smooth  =  8;

   input value = close;

     def FSignal = (value * .15) +  (.85  * ExpAverage(value, fastEMA)[1]);

     def SSignal = (value * .075) + (.925 * ExpAverage(value, slowEMA)[1]);

     def MACD    = FSignal - SSignal;

 plot MACDSL  = ExpAverage(MACD, Smooth);

 }

 

# Stochastic

script Stochastic{

   input nK = 10;

   input nD = 3;

   input value = close;

     def l = low;

     def h = high;

     def Data = 100 * ((value - Lowest(l, nK)) / (Highest(h, nK) - Lowest(l, nK)));

     def K = Inertia(Data, nK);

 plot D = ExpAverage(K, nD);

 }

   def newMACD = normalizePlot( MACD("fastEMA" = fastEMA, "slowEMA" = slowEMA, "Smooth" = Smooth, "Value" = c), 0, 100 );

 

   def newStochastic = normalizePlot( Stochastic("value" = c, "nK" = nK, "nD" = nD ), 0, 100 );

 

  plot MACD = newMACD;

  plot Stoch = newStochastic;

 

  plot os = if isNaN(c) then Double.NaN else OverSold;

          os.SetPaintingStrategy(PaintingStrategy.LINE);

          os.SetLineWeight(1);

          os.SetDefaultColor(Color.WHITE);

  plot ob = If IsNaN(c) then Double.NaN else OverBought;

          ob.SetPaintingStrategy(PaintingStrategy.LINE);

          ob.SetLineWeight(1);

          ob.SetDefaultColor(Color.WHITE);

  plot ml = If  isNaN(c) then Double.NaN else 50;

          ml.SetPaintingStrategy(PaintingStrategy.DASHES);

          ml.SetLineWeight(1);

          ml.SetDefaultColor(Color.WHITE);

 

          MACD.SetPaintingStrategy(PaintingStrategy.Line);

          MACD.AssignValueColor(if MACD >= 50 and MACD > MACD[1]

                                                   then Color.LIGHT_GREEN

                                                   else if MACD >= 50 and MACD < MACD[1]

                                                   then Color.LIGHT_RED

                                                   else if MACD <= 50 and MACD < MACD[1]

                                                   then Color.LIGHT_RED

                                                   else Color.LIGHT_GREEN);

          AddCloud(MACD, ml, color.Light_Green, color.Light_Red);

          MACD.SetLineWeight(1);

          Stoch.SetPaintingStrategy(PaintingStrategy.Line);

          Stoch.AssignValueColor(if Stoch >= 50 and Stoch > Stoch[1]

                                                  then Color.CYAN

                                                  else if Stoch >= 50 and Stoch < Stoch[1]

                                                  then Color.BLUE

                                                  else if Stoch <= 50 and Stoch < Stoch[1]

                                                  then Color.LIGHT_RED

                                                  else Color.YELLOW);

          Stoch.SetLineWeight(1);

# End Code CSA MACD Stochastic Normalized
 

MagicBlueBalls

New member
My question: Why do you trade using Renko?
"Here is the thing. Right now, I've saved enough money to trade five /es contracts. For me, one of them 5 tick blocks is about $312 minus commissions and taxes... say $225 or something. That is how I make my money and now... I am consistently making a decent amount. It's all just probability. "

My question: Why do you not trade using time-based charts?
"In short: the more time you are long/short the more time you are exposed"

"I don't mess with time-based charts b/c they don't provide a clear picture of the price-action structure. Any ignition-based algo can punch and reverse it rather quickly. I ain't waiting or hoping for the market to keep going up or down. I'm here to make money quickly. One brick and I'm out. I don't care if I leave money on the table. Algos make their money in fractions of a second. Why should I hold for 5 mins or 15 mins or 1 hr when I can make $225 in less than 1 min with 80% to 90% certainty. "

My question: So you managed to change the Laguerre using volume?
"That's obvious. I did trial and error. I showed you my thought process. It was trial and error. I tried everything under the sun. I don't give up. The RSI Laguerre is a nice concept."

My question: You call your system the "Trading Divergence Monster Laguerre + Inertia For ThinkOrSwim" ... Is there more to this system? if so what?
"Obviously. NEVER trade based on one indicator. I modified other indicators and wrote some custom."

@RickK
Last question: Someone wondered why you wrote that this indicator could be used in 5 mins and 15 mins charts... he did not find anything. AND, what about the Standard Deviations.
"I think I changed the code? I don't know. I haven't checked time charts in a while. Whatever the case, I don't mess with time-based divergences. They can be dangerous. Renko divergences are based on price alone so they are more reliable."

And the standard deviations?
"Ah, I call that the "pinch". It is an easy mod. just change this line 372.. or any of them to...
plot PercentileQ = TEMA(((dataX - lo) / (hi - lo)) * 100) + RSI + Inertia;
And you can see what I'm talking about. This is the code for going long. I ain't giving you the one for going short cuz then you or someone is going to try to short the market and lose their money"
 
Last edited by a moderator:

MagicBlueBalls

New member
Interesting indicator. Plots similar lines as the CSA Normalized MACD Stoch.
Since I'm not familiar with coding I can only go with what I see.


Code:
## OneNote Archive Name: C.S.A Combined Signal Approach Normalized MACD, Stochastic _Mobius

## Archive Section: Uncategorized

## Suggested Tos Name: CSA_CombinedSignalApproach_StocMACD_Mobius

## Archive Date: 5.15.2018

## Archive Notes:

 

## "##" indicates an addition or adjustment by the OneNote Archivist

 

## Original Code Follows

 

# C.S.A (Combined Signal Approach)

# Normalized MACD, Stochastic

# Mobius

# V02.07.2013

 

declare lower;

 

script normalizePlot {

    input data = close;

    input newRngMin =  -1;

    input newRngMax = 1;

    def hhData = HighestAll( data );

    def llData = LowestAll( data );

    plot nr = ((( newRngMax - newRngMin ) * ( data - llData )) /

                      ( hhData - llData )) + newRngMin;

}

 

input fastEMA = 12;

input slowEMA = 26;

input Smooth  =  9;

input nK = 10;

input nD = 3;

input OverBought = 80;

input OverSold = 20;

 

def c   = close;

# MACD

script MACD{

   input fastEMA = 13;

   input slowEMA = 21;

   input Smooth  =  8;

   input value = close;

     def FSignal = (value * .15) +  (.85  * ExpAverage(value, fastEMA)[1]);

     def SSignal = (value * .075) + (.925 * ExpAverage(value, slowEMA)[1]);

     def MACD    = FSignal - SSignal;

 plot MACDSL  = ExpAverage(MACD, Smooth);

 }

 

# Stochastic

script Stochastic{

   input nK = 10;

   input nD = 3;

   input value = close;

     def l = low;

     def h = high;

     def Data = 100 * ((value - Lowest(l, nK)) / (Highest(h, nK) - Lowest(l, nK)));

     def K = Inertia(Data, nK);

 plot D = ExpAverage(K, nD);

 }

   def newMACD = normalizePlot( MACD("fastEMA" = fastEMA, "slowEMA" = slowEMA, "Smooth" = Smooth, "Value" = c), 0, 100 );

 

   def newStochastic = normalizePlot( Stochastic("value" = c, "nK" = nK, "nD" = nD ), 0, 100 );

 

  plot MACD = newMACD;

  plot Stoch = newStochastic;

 

  plot os = if isNaN(c) then Double.NaN else OverSold;

          os.SetPaintingStrategy(PaintingStrategy.LINE);

          os.SetLineWeight(1);

          os.SetDefaultColor(Color.WHITE);

  plot ob = If IsNaN(c) then Double.NaN else OverBought;

          ob.SetPaintingStrategy(PaintingStrategy.LINE);

          ob.SetLineWeight(1);

          ob.SetDefaultColor(Color.WHITE);

  plot ml = If  isNaN(c) then Double.NaN else 50;

          ml.SetPaintingStrategy(PaintingStrategy.DASHES);

          ml.SetLineWeight(1);

          ml.SetDefaultColor(Color.WHITE);

 

          MACD.SetPaintingStrategy(PaintingStrategy.Line);

          MACD.AssignValueColor(if MACD >= 50 and MACD > MACD[1]

                                                   then Color.LIGHT_GREEN

                                                   else if MACD >= 50 and MACD < MACD[1]

                                                   then Color.LIGHT_RED

                                                   else if MACD <= 50 and MACD < MACD[1]

                                                   then Color.LIGHT_RED

                                                   else Color.LIGHT_GREEN);

          AddCloud(MACD, ml, color.Light_Green, color.Light_Red);

          MACD.SetLineWeight(1);

          Stoch.SetPaintingStrategy(PaintingStrategy.Line);

          Stoch.AssignValueColor(if Stoch >= 50 and Stoch > Stoch[1]

                                                  then Color.CYAN

                                                  else if Stoch >= 50 and Stoch < Stoch[1]

                                                  then Color.BLUE

                                                  else if Stoch <= 50 and Stoch < Stoch[1]

                                                  then Color.LIGHT_RED

                                                  else Color.YELLOW);

          Stoch.SetLineWeight(1);

# End Code CSA MACD Stochastic Normalized
@Splinter Awesome observation. :)
I can see these indicators are very similar. It is cool because they both arrive at similar conclusions using different metrics. In my first post, you can see that the regular MACD tends to show similar divergences so I am not surprised the CSA did so as well. However, the "pinch" is not the same. I copied and pasted the standard deviation code to the CSA you provided, and these two indicators do not provide the same info. The monster shows a better bullish signal. The original creator mentioned to me that there is a code for a "short pinch" but he is not going to provide it because he thinks people are just going to lose money by shorting. I will keep asking for the code tho. :)
 
Last edited by a moderator:

MagicBlueBalls

New member
Here is another part of the "Trading Divergence Monster Laguerre + Inertia For ThinkOrSwim" Trading system.

I asked.
My question: Do those arrows repaint?
"The arrows DO NOT repaint 95% of the time. I've seen them repaint but it's extremely rare. Volume has to spike up over 999% for that to happen. When the arrow shows, you get at least ONE brick. Always. I'm working so the arrow shows up 100% of the time. I ain't gotten there yet, but I will"

My question: What about the colors? Is that like a stoplight?
"Yes. It's exactly like a stoplight. The brighter, the better. They're measuring the MACD, RSI, Stochastic as a cloud. Only beautiful things happen when that's the case"

My question: there are other colors...?
"Don't mess when the colors don't align. You want ONE brick. Be happy. Do NOT be a greedy. Save your money and buy more contracts. ONE brick for ONE contract. ONE brick for TWO contracts. ONE brick for THREE contracts. You'll be just fine.

My question: And I see there are lines following the price and they change color from yellow to white. What's that all about?
"Those lines tell the arrows what to do. They follow price in real-time... no lag. Well, that's not exactly true. When it's bullish the top line will be faster and then the bottom will confirm after one brick and vice versa. I don't know how to make it faster without being less accurate."
 
Last edited by a moderator:

RickK

Active member
@RickK ... Thank you for your reply. I asked the creator the following questions. Your question is the last one.

I f##king love this guy. I'd like to take him to lunch. He embraces my trading ideals perfectly ... in and out in 5 seconds if possible and when you find something that works 90+% of the time, take on more contracts - not more trades ... because the more amount of time that you're in the market, the greater the chance that you're going to get screwed.

Thanks again, @MagicBlueBalls ... I'm interested in seeing where this thread goes and if the author has additional thoughts.


[ @diazlaz ]
 
Last edited by a moderator:

Gymini

New member
the bottom indicator looks like the RSM or the B4 indicator from Barbaros. he mentioned Macd RSI and Stoch which is what they are based on
 
Last edited:

Trader_Rich

Member
VIP
In my opinion, the Trading Divergence Monster Laguerre + Inertia For ThinkOrSwim)...severely lags and you'd be better off with something like the the Chewie Strat with the B4 lower indicator on 5 tick Renko Bars. The overall strategy for scalping a few ticks is great, but I think this strat can be improved upon.

I swear, the guy who wrote this sounds like one of my fraternity brothers. The dude was a genius, but he enjoyed sending people on a scavenger hunt to figure out his madness...and half the time they were wild goose chases.
 
Last edited by a moderator:

ssmike123

Member
VIP
Very interesting @MagicBlueBalls ! Thank you for your contribution. Interesting indicator.

I took a close look at it and while I don't know if I've "improved" it, I did add a few slight visual modifications that might help. Please see the images and chart link below. The clouds and the varying color RSignal line can provide good confirmation on the divergence opportunity at times. (I've been burned by taking divergence trades too many times...so this may help.)

I do have a question about the author's statement "You can mess around with the mimic and the STDs deviations... The STDs can give some good signals between 1 and 1.3. " Do you have a way to elaborate on that? Oh, and regarding his mention of using on a 5 or 15m chart but nothing faster, I couldn't find much looking good on those timeframes at all. Is renko the way he uses it?.... optimal?

Thanks again! Although I'm not a great fan of renko, I plan on taking a close look at it during the action on monday.
(thanks @diazlaz )

Chart link: https://tos.mx/GjdMw0T


@RickK is improvement. Question, the lines drawn on Chart & Lower study showing the Divergences are hand drawn Or part of the study? I have down loaded https://tos.mx/GjdMw0T but do not see any "divergence Lines" on Price or study.

Not quite sure what is the intended use of this study. If just divergences, & the study does not have the ability to draw them, then why such a complex study? Divergences can be visually detected between lower studies & price by any one watching the charts and drawing them.

Ideally a divergence study should "indicate" the divergence. I.E, draw the divergence lines. I yet have to see if anyone has been able to achieve this in TOS.
 
Last edited by a moderator:

Splinter

Member
VIP
@RickK is improvement. Question, the lines drawn on Chart & Lower study showing the Divergences are hand drawn Or part of the study? I have down loaded https://tos.mx/GjdMw0T but do not see any "divergence Lines" on Price or study.
Those divergence lines are hand drawn for illustration purposes.

From what I understand this study was specifically made for trading the ES using a 5 tick Renko chart. As noted above it seems to pick up more divergences than other indicators. The user would need to be proficient in identifying normal and hidden divergences though to take full advantage of it.
 
Last edited by a moderator:

ficcer3030

New member
Here is another part of the "Trading Divergence Monster Laguerre + Inertia For ThinkOrSwim" Trading system.

I asked.
My question: Do those arrows repaint?


My question: What about the colors? Is that like a stoplight?


My question: there are other colors...?


My question: And I see there are lines following the price and they change color from yellow to white. What's that all about?

What arrows are you mentioning in this? I don't see anything in the script with arrows.
 

ulle73

New member
i dont see any arrows, just an indicator you dont have on your chart? could you please share your chart?
 

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top