Trend Pivot Indicator by Mobius

dougn

dougn

Member
2019 Donor
As I was unable to locate the thread in this forum where I first found this indicator here's a fresh one. Thanks in advance if someone places it in the correct location.

In reading the creators description at the start of the script I'm still unclear what the "Confirmation Line" is and whether the trade is the entrance or the exit of the red/green zones . In searching for the answers I noticed that other members here have similar questions and were referred to Thinkscript Lounge.

Anyway, here is the script.

Edit: I would like to add that in my own application of these fabulous studies the complete "suite" will always include scans for the condition/event and definitely a custom watchlist column.
Code:
# Mobius
# V01.01.29.2019
# Uses trend of higher highs with higher lows and trend of lower lows with lower highs to locate pivots. Distance for trend is set by the user. Confirmation of a reversal from pivots is set with a multiple of the pivot bars range. That multiple is also a user input.
# Trading Rules
# 1) Trade when price crosses and closes outside the pivot Confirmation line. At that point looking for best entry. Min trade is 2 contracts
# 2) Know your risk point before entering trade. Typical risk point is the pivot line itself. If your risk is crossed look for an exit. Never use hard stops - you'll often get out for little or no loss
# 3) Know your Risk off point before entering. Typical Risk Off is an ATR multiple. Offer Risk Off as soon as possible for a Risk Free trade
# 4) set mental stop one tick above entry when Risk Off is achieved
# 5) if trade continues your way move mental stop for your runner to last support / resistance each time a new support / resistance is hit.

input n = 5;
input R_Mult = .7;

def o = open;
def h = high;
def l = low;
def c = close;
def x = BarNumber();
def nan = Double.NaN;
def ts = tickSize();
def tr = TrueRange(h, c, l);
def hh = if Sum(h > h[1], n) >= n and
            Sum(l > l[1], n) >= n-1
         then h
         else if h > hh[1]
              then h
              else hh[1];
def xh = if h == hh
         then x
         else nan;
plot hh_ = if x >= HighestAll(xh)
           then HighestAll(if IsNaN(c[-1])
                           then hh
                           else nan)
           else nan;
     hh_.SetDefaultColor(Color.RED);
     hh_.HideTitle();
     hh_.HideBubble();
def hR = if h == hh
         then Round(Average(tr, n)/TickSize(), 0)*TickSize()
         else hR[1];
def PrevL = if h == hh
            then l[1]
            else PrevL[1];
plot STO = if x >= HighestAll(xh)
           then HighestAll(if IsNaN(c[-1])
           then Round((Max(PrevL, hh_ - (hR * R_Mult))) / ts, 0) * ts
                           else nan)
           else nan;
     STO.SetDefaultColor(Color.RED);
     STO.HideTitle();
     STO.HideBubble();
plot STO_RO = if x >= HighestAll(xh)
              then HighestAll(if isNaN(c[-1])
                              then STO - Min(hR, TickSize() * 16)
                              else nan)
              else nan;
     STO_RO.SetStyle(Curve.Long_Dash);
     STO_RO.SetDefaultColor(Color.White);
     STO_RO.HideBubble();
     STO_RO.HideTitle();
#AddChartBubble(x == HighestAll(x), STO_RO, "RO", STO_RO.TakeValueColor(), 0);
def ll = if Sum(l < l[1], n) >= n and
            Sum(h < h[1], n) >= n-1
         then l
         else if l < ll[1]
              then l
              else ll[1];
def xl = if l == ll
         then x
         else nan;
plot ll_ = if x >= HighestAll(xl)
           then HighestAll(if IsNaN(c[-1])
                           then ll
                           else nan)
           else nan;
     ll_.SetDefaultColor(Color.GREEN);
     ll_.HideTitle();
     ll_.HideBubble();
def lR = if l == ll
         then Round(Average(tr, n)/TickSize(), 0)*TickSize()
         else lR[1];
def PrevH = if l == ll
            then h[1]
            else PrevH[1];
plot BTO = if x >= HighestAll(xl)
           then HighestAll(if IsNaN(c[-1])
           then Round((Min(PrevH, ll_ + (lR * R_Mult))) / ts, 0) * ts
                           else nan)
           else nan;
     BTO.SetDefaultColor(Color.GREEN);
     BTO.HideTitle();
     BTO.HideBubble();
plot BTO_RO = if x >= HighestAll(xl)
              then HighestAll(if isNaN(c[-1])
                              then BTO + Min(lR, TickSize() * 16)
                              else nan)
              else nan;
     BTO_RO.SetStyle(Curve.Long_Dash);
     BTO_RO.SetDefaultColor(Color.White);
     BTO_RO.HideBubble();
     BTO_RO.HideTitle();
#AddChartBubble(x == HighestAll(x), BTO_RO, "RO", BTO_RO.TakeValueColor(), 1);
AddCloud(STO, hh_, Color.LIGHT_RED, Color.LIGHT_RED);
AddCloud(ll_, BTO, Color.LIGHT_GREEN, Color.LIGHT_GREEN);
Alert(c crosses below STO, "", Alert.Bar, Sound.Bell);
Alert(c crosses above BTO, "", Alert.Bar, Sound.Chimes);
# End Code Trend Pivots
 
Last edited:
I

inhouselr

New member
I've also been trying to figure out which one is the confirmation line. Initially, I thought breaking outside the confirmation line meant above the upper most line (be it red or green) or below the lowest line but I'm not sure. And what are the white lines in between the range? I see that @J007RMC is also using this indicator. Maybe @J007RMC can shed some light on how to use it?
 
J007RMC

J007RMC

Active member
2019 Donor
VIP
This is how I understand the indicator to work. A break and close above/below the red or green boundaries {resistance/support.} A break and close is confirmation for me else higher highs/lower lows with the pivots range . Perhaps we should direct these questions to horserider for a definitive answer.
 
T

Trader Raider

Member
VIP
Love this indicator! I've been using the STO_RO and BTO-RO plots as confirmation lines. I wait for a close above (for longs) or below (for shorts) to tell me when a pullback has ended.
 
Last edited:
J007RMC

J007RMC

Active member
2019 Donor
VIP
Code:
#StudyName:     RSI_Laguerre_Lines_wTargets
#Version/Date: v1 5/30/17
#TOS.mx Link:
#Type: [Study]
#Description: RSI in Laguerre Time MTF plotted on Upper chart
#Author: jcseattle
#Copyright: Copyright jcseattle/amalia 2016. All rights reserved.
#Copyleft: This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. See <http://www.gnu.org/licenses/>
#Requested By: ""
#History: Ver Date Auth Change
#First draft v1 5/30/17 jcseattle - No changes
# Notes :Based off original script in
# RSI in Laguerre Time MTF Option_v3
# Mobius
# V02.07.2014
# translation of J Elher's code
# Annotation : ""
# Trading Notes   : ""
declare upper;                                     
def na = Double.NaN;
script R {
input gamma = .2;
input usecandletype = {candle_hybrid, default candle};
input usehigheraggperiod = {default "Current", "Higher"};
input outputformat = {default Rounded, "Not Rounded"};
;#Hint outputformat: 'Not Rounded' is used for notes, bonds (eg: 109'110), forex, etc type format.
input atrlength = 21;
input agg = AggregationPeriod.TWO_MIN;
input overbought = .8;
input oversold = .2;
def o;
def h;
def l;
def c;
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def L0;
def L1;
def L2;
def L3;
plot RSI;
plot OS;
plot OB;
def error = usehigheraggperiod == usehigheraggperiod."Higher" and GetAggregationPeriod() > agg;
switch (usehigheraggperiod) {
case Current:
if usecandletype == usecandletype.candle_hybrid {
o = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
c = (o + h + l + close) / 4;
} else {
o = open;
            h = high;
It is working properly and will look like this.

 
Last edited by a moderator:
I

inhouselr

New member
Thanks for the information and the RSI Laguerre study. I tried to add it to my TOS but it says invalid at this line:

script R {
 
J007RMC

J007RMC

Active member
2019 Donor
VIP
Thanks for the information and the RSI Laguerre study. I tried to add it to my TOS but it says invalid at this line:

script R {
Please let me know if it works for you I too see the script R but mine seems to be working fine.
 
T

Trader Raider

Member
VIP
@J007RMC, I like that Laguerre with targets too. Problem for me is that it takes up too much real estate. I've been able to comment out the top labels. But commenting out the target bubbles along the price axis gives me a script error. Those side bubbles obscure too much price action unless the chart is expanded a mile to the right.
 
J007RMC

J007RMC

Active member
2019 Donor
VIP
Yes absolutely space is premium I trade on a laptop with a 37 inch monitor I had to go that route
 
Last edited by a moderator:
K

kz77

New member
Hi Guys,
Hope everybody is safe and having great Easter weekend :)
I found Trend pivots by Mobius here and is very interested in this one.
WHo use it - could you please share how exactly you do it?
Can anybody share upgraded version which allow to have on short term chart (let's say 5m) pivots from other timelines (15m, 30m, 1h, 2h)?
Thank you and have a great Sunday!:)
KZ
 
P

Playstation

Active member
VIP
You should probably post some screenshots on how you would use it, or why is it interesting.
 
K

kz77

New member
@Playstation
I will for sure. But if anybody can help me with coding/ or changing setup of this indicator to be plotting pivots from different TFs on one chart it would give me ability to check strategy I have in mind and share it if proved to be working.
If I post screenshots now it will be dozen of them showing pivots on different TFs.
Thanks
 
B

barbaros

Member
@dougn I am also interested in learning how to trade with this indicator. From the comments, I understand that you enter a long position when the price breaks out of the high of the support cloud. Then look for it crossing the RO line and watch the exit point. You can do the same when the price is trending down for shorting.

However, how do you handle going from long to short at the pivot points? Am I understanding this correctly?

@BenTen if you have an interpretation, can you share with us?
 
BenTen

BenTen

Administrative
Staff
VIP
@barbaros I don't know much about this one either :(
 
wtf_dude

wtf_dude

Active member
Love this indicator! I've been using the STO_RO and BTO-RO plots as confirmation lines. I wait for a close above (for longs) or below (for shorts) to tell me when a pullback has ended.
sorry, but what do STO_RO and BTO-RO mean? risk on/off is all I could figure out at a glance haha
 
dougn

dougn

Member
2019 Donor
Sorry but I don't trade long to short or even short for that matter so no help here.
 
Top