Repaints Order Block Finder for ThinkOrSwim

Repaints
check the below

CSS:
input plotPVT = yes;#(defval=true, title='Plot Pivots', group='Pivots')
input pivotLookup = 1;#(defval=1, minval=1, maxval=5,title='Pivot Lookup', group='Pivots', tooltip='Minimum = 1, Maximum = 5')

def na = Double.NaN;
#valuewhen (cond, source, occurrence) =>
script valuewhen {
    input cond = 0;
    input source = 0;
    input occurrence = 0;
    def n = occurrence + 1;
# start at 0 so it looks at current bar
    def offset2 = fold j = 0 to 200
    with p
    while p < n + 1
    do p + ( if p == n then j - n else if GetValue(cond, j) then 1 else 0 );
# def bnz = bn - offset2 + 1;
    plot price = GetValue(source, offset2 - 1);
    plot offset = offset2;
}
#//////////////////// Pivots ////////////////////
script FindPivots {
    input dat = close; # default data or study being evaluated
    input HL  = 0;    # default high or low pivot designation, -1 low, +1 high
    input lbL  = 5;    # default Pivot Lookback Left
    input lbR  = 1;    # default Pivot Lookback Right
    ##############
    def _nan;    # used for non-number returns
    def _BN;     # the current barnumber
    def _VStop;  # confirms that the lookforward period continues the pivot trend
    def _V;      # the Value at the actual pivot point
    ##############
    _BN  = BarNumber();
    _nan = Double.NaN;
    _VStop = if !IsNaN(dat) and lbR > 0 and lbL > 0 then
                fold a = 1 to lbR + 1 with b=1 while b do
                    if HL > 0 then dat > GetValue(dat, -a) else dat < GetValue(dat, -a) else _nan;
    if (HL > 0) {
        _V = if _BN > lbL and dat == Highest(dat, lbL + 1) and _VStop
            then dat else _nan;
    } else {
        _V = if _BN > lbL and dat == Lowest(dat, lbL + 1) and _VStop
            then dat else _nan;
    }
    plot result = if !IsNaN(_V) and _VStop then _V else _nan;
}

def hih = findpivots(high, 1, pivotLookup, pivotLookup);
def lol = findpivots(low , -1, pivotLookup, pivotLookup);
def top =   if !isNaN(hih) then hih else  if isNaN(top[1]) then high[pivotLookup] else top[1];
def bottom = if !isNaN(lol) then lol else if isNaN(bottom[1]) then low[pivotLookup] else bottom[1];
plot PvtTop = if isNaN(close) or !top then na else  top;#, offset=-pivotLookup, linewidth=1, color=(top != top[1] ? na : (plotPVT ? pvtTopColor : na)), title="Pivot Top")
PvtTop.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot PvtBit = if isNaN(close) or !bottom then na else  bottom;#, offset=-pivotLookup, linewidth=1, color=(bottom != bottom[1] ? na : (plotPVT ? pvtBottomColor : na)), title="Pivot Bottom")
PvtBit.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Hi Samer800,

Can you please help to improvise it by adding an arrow head pointer (or a caret similar to fractal pattern) to the candle that framed structure break, like shown below?

el5goCu.png


Hi Samer800,

Never mind my request.
I see you have done something similar and more in this post: https://usethinkscript.com/threads/order-block-finder-for-thinkorswim.12162/

There is a bit of complexity and excess functionality there in the code. I turned off some of the plots and was able to get what I needed. I was just after the candle marker :)

Thank you!
 
Last edited by a moderator:
Hi Samer800,

Can you please help to improvise it by adding an arrow head pointer (or a caret similar to fractal pattern) to the candle that framed structure break, like shown below?

el5goCu.png


Hi Samer800,

Never mind my request.
I see you have done something similar and more in this post: https://usethinkscript.com/threads/order-block-finder-for-thinkorswim.12162/

There is a bit of complexity and excess functionality there in the code. I turned off some of the plots and was able to get what I needed. I was just after the candle marker :)

Thank you!
@Sree Do you mind sharing what you came up with..Thanks

Sure. Here is what I was looking for...


fxJbUVm.png
TY...Actually I was looking for what you took out of the code to create that.. So in essence it is the new code that was created.
 
Last edited by a moderator:
Sure. Here is what I was looking for...


fxJbUVm.png



Apologies if my comment was misleading. Like I had mentioned earlier, I just turned off a few plots in the settings menu - thats all. no code changes were applied.
You weren't misleading I think I was. I wanted to know what you turned off and somehow went off the rails with asking about the code. LOL
 
@Sree In working with this concept I found that using +5 works best with what I'm doing. I'm not good with coding so I'm hoping you would be able to help me with adding those lines to be extended to the right side of the chart. TIA
 
@Sree In working with this concept I found that using +5 works best with what I'm doing. I'm not good with coding so I'm hoping you would be able to help me with adding those lines to be extended to the right side of the chart. TIA

Honestly, I think the line is just the right size to show the fractal nature of the bars. If extended to right, since it cant be erased once its drawn, as the chart grows to the right the lines will be present. Over a period of time, the chart will look loaded with horizontal lines and cluttered. just my 2 cents :)
 
Honestly, I think the line is just the right size to show the fractal nature of the bars. If extended to right, since it cant be erased once its drawn, as the chart grows to the right the lines will be present. Over a period of time, the chart will look loaded with horizontal lines and cluttered. just my 2 cents :)
Thanks and I see the point and it will become too cluttered which is exactly what I don't want so I spent the weekend going over some things and correlating to working with stocks as opposed to futures...Appreciate the feedback..
 
This is a repainting indicator. It uses future bars. Meaning, it waits until the future happens and then goes back and paints the triggers that you see on your charts.

Scripts that repaint should NOT be used in Scans, Labels, Watchlists, Alerts, Conditional Orders or Backtesting Strategies.
a. It will falsely show up in your Scans, Labels, Watchlists, Alerts, Conditional Orders or Backtesting Strategies, but the signal will not be painted on your chart. You will think the script is broken.
b. Or the opposite. It will be painted on your chart but NOT show up in your Scans, Labels, Watchlists, Alerts, Conditional Orders or Backtesting Strategies. This is because it wasn't there in real time! It was painted on afterward.
You will think the script is broken.

Attempting to scan repainted signals is an exercise in frustration.
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
FutureTony Naked POC finder For ThinkOrSwim Indicators 5
C Phoenix Finder Trend Strength Indicator for ThinkorSwim Indicators 25

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
330 Online
Create Post

Similar threads

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.
Back
Top