POC indicator with a twist.

ILIKESTOCKS

Member
Greetings, to all who have the magical gift of coding! I would like an indicator that follows the current days POC. When the price is above the POC the label turns green and displays current price percentage above, and when the price is below the POC it displays the current price percentage below, and turns red. If price is at the money it stays white. Also next to these labels I would like the POC displayed with price range. Id like it to work on an intraday chart for any time up to 15 minutes. I only would like a line on the chart representing current POC and that is all. Is this possible?
 
Solution
Greetings, to all who have the magical gift of coding! I would like an indicator that follows the current days POC. When the price is above the POC the label turns green and displays current price percentage above, and when the price is below the POC it displays the current price percentage below, and turns red. If price is at the money it stays white. Also next to these labels I would like the POC displayed with price range. Id like it to work on an intraday chart for any time up to 15 minutes. I only would like a line on the chart representing current POC and that is all. Is this possible?

This should provide volumeprofile POC/Close comparison data, except POC price range. TOS does not provide POC data on a bar by bar basis...
Okay this indicator performed well IMO I see that it can still be dialed in a bit, to maybe confirm some variables.
Is it possible to incorporate the following:

1) a bubble that follows the candle that displays what the %var poc says and be able to turn on and off.

2) a line that follows price movement on the candle and the price is displayed on that line and the line goes off to the right but doesn't interfere with the candle. Also can be turned on and off. I realize a bar chart is similar without the price attached, but I like HA candles.

3)Is it possible to calculate the previous delta number that is displayed, + vs - candles and get an avg? whether its more or less positive? And display that in upper left corner?

4) set the delta to watch for spikes in either direction. set a number that can be changed? or turned off. etc? that candle would have pyramid either underneath or on top?

thank you for your help thus far.
If you need an image for 1 and 2 let me know.

See if this is what you expected

Capture.jpg
Ruby:
input pricecolor = yes;

#Priceline
input priceline  = yes;
def price  = if IsNaN(close) then price[1] else close;
plot cline = if IsNaN(close[-1]) then price else Double.NaN;
cline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
AddChartBubble(priceline and IsNaN(cline[4]) and !IsNaN(cline[3]),
               cline,
               AsText(price),
               if close[4] > open[4] then Color.GREEN else Color.RED);

#POC
def yyyymmdd = GetYYYYMMDD();
def period   = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;

def cond     = 0 < period - period[1];
profile vol  = VolumeProfile("startNewProfile" = cond, "onExpansion" = no, numberOfProfiles = 1, "value area percent" = 0.0, pricePerRow = PricePerRow.TICKSIZE);

plot POC     = vol.GetPointOfControl();

#POC Variance to Close
input label_VAR = yes;
AddLabel(label_VAR, "Close: " + AsText(close) + " POC: " + AsText(POC) + " %Var: " + AsPercent((close - POC) / POC), if close > POC then Color.GREEN else if close < POC then Color.RED else Color.WHITE);

#Bubble POC Variance to close
input bubble_VAR   = yes;
input bubbleoffset = 1;

AddChartBubble(bubble_VAR,
               low - bubbleoffset * TickSize(),
               AsPercent((close - POC) / POC),
               if close > POC then Color.GREEN
               else if close < POC
               then Color.RED else Color.WHITE, no);

#Cloud - Close Proximity to POC
input showcloud = yes;
def bn          = BarNumber();
def crossbn     = if close crosses POC then bn else Double.NaN;
def touch       = Between(POC, low, high);
AddCloud(if showcloud and !touch and bn >= HighestAll(crossbn)
         then close
         else Double.NaN,
         POC,
         Color.GREEN, Color.RED);

#Vertical lines when close crosses POC
input showvertical = yes;
AddVerticalLine(showvertical and close crosses POC,
                "",
                if close crosses above POC
                then Color.GREEN
                else Color.RED);

#Buying/Selling Pressure
input length = 10;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying  = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def Delt    = Buying - Selling;

#Delta
plot Delta = Delt;
Delta.AssignValueColor(if Delta > 0 then Color.GREEN else Color.RED);
Delta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Delta.Hide();

#Bubble Delta
input bubble_delta = yes;
AddChartBubble(bubble_delta and !IsNaN(close), low - bubbleoffset * TickSize(),
               if AbsValue(Delta) > 1000
               then Round(Delta / 1000, 0) + "k"
               else Delta + "",
               Delta.TakeValueColor(), no);

#Delta Average for avg_length input bars, excluding the current bar
input label_delta_avg = yes;
input avglength       = 3;
def   delta_avg       = Sum(Delta[1], avglength) / avglength;
addlabel(label_delta_avg, " ", color.black);
AddLabel(label_delta_avg,
        "Delta Avg " + avglength + " bars: " +
        (if AbsValue(delta_avg) > 1000
         then Round(delta_avg / 1000, 0) + "k"
         else delta_avg + ""),
         if delta_avg > 0 then Color.GREEN else Color.RED);

#Delta Spike
input spike = 200000;

plot delta_spike = if Delta > +spike then high else if Delta < -spike then low else 0;
delta_spike.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
delta_spike.SetDefaultColor(Color.YELLOW);
delta_spike.SetLineWeight(5);

#Cumulative Delta
def CumulativeVolumeDelta = Sum(Delta, length);
AssignPriceColor(if !pricecolor then Color.CURRENT else
                 if CumulativeVolumeDelta > 0
                 then Color.GREEN                 
                 else Color.RED);
 
See if this is what you expected
Greetings!
It appears to be back test well this AM.
I will play with it more tomorrow.
I made an interesting observation yesterday during open hours in the am. The NYSE and NASDAQ were selling off the SPY was bottoming.
The indicator worked well it caught the reversal in terms of the candle color, delta numbers, I think POC was still above.
I thought the SPY would continue down but the SPY continued pushing up and the candles looked like a buy but the MARKET (breadth Ratio) was still selling. Eventually the spy continued pressure up and the market reversed in terms of the breadth ratio.
So my point is the indicator proved correct on direction before the breadth ratio corrected.
The the added delta avg is a good addition. The cline excellent as well. (Yet to have that work in real time) Excellent work on this and much appreciated. I like how the candles are colored to match the delta and the bubbles match the direction of the candle itself, best of both great job! Again I have probably reinvented the wheel but at least now my understanding has been exercised. Thank you for your diligence.

My original thinking was have 1 indicator that could take in $volused $trin $pcsp $add $vix $vold /ES /NQ but that seems unnecessary if the SPY is already reacting to forces that are following the markets? So, why not let their own algorithms work in our favor? Meaning equities are already reacting to the movement of the market by mega AI, so why concentrate on so many other indicators when the SPY (or any other equity) will react for you? There are days they keep poc close but there are many days they make a decision and run, might as well catch the run or the few candles in the direction of the trend. Im sure this thinking is not knew either...😎
 
Greetings!
It appears to be back test well this AM.
I will play with it more tomorrow.
I made an interesting observation yesterday during open hours in the am. The NYSE and NASDAQ were selling off the SPY was bottoming.
The indicator worked well it caught the reversal in terms of the candle color, delta numbers, I think POC was still above.
I thought the SPY would continue down but the SPY continued pushing up and the candles looked like a buy but the MARKET (breadth Ratio) was still selling. Eventually the spy continued pressure up and the market reversed in terms of the breadth ratio.
So my point is the indicator proved correct on direction before the breadth ratio corrected.
The the added delta avg is a good addition. The cline excellent as well. (Yet to have that work in real time) Excellent work on this and much appreciated. I like how the candles are colored to match the delta and the bubbles match the direction of the candle itself, best of both great job! Again I have probably reinvented the wheel but at least now my understanding has been exercised. Thank you for your diligence.

My original thinking was have 1 indicator that could take in $volused $trin $pcsp $add $vix $vold /ES /NQ but that seems unnecessary if the SPY is already reacting to forces that are following the markets? So, why not let their own algorithms work in our favor? Meaning equities are already reacting to the movement of the market by mega AI, so why concentrate on so many other indicators when the SPY (or any other equity) will react for you? There are days they keep poc close but there are many days they make a decision and run, might as well catch the run or the few candles in the direction of the trend. Im sure this thinking is not knew either...😎

I just remembered that Nube, from Thinkscript Lounge years ago, started a bar by bar volumeprofile. He did 14 bar tracking iterations and felt it was not practical and stopped. It can be resource intense, but may be worth looking at. I added up to 78 iterations, which will allow 5m and above intraday timeframe charts to use this. It is incorporated in the script below that was last included above.

The image shows the developing plot during regular trading hours. I left the verticallines showing closes crossing POC. It has a simple red/green cloud. The yellow dashes are the developing POC and the lavender dashes the hva and lva. I watched it today and it tracked extemely well on the 5m chart timeframe you use.

Capture.jpg
Ruby:
input pricecolor = yes;

#Priceline
input priceline  = yes;
def price  = if IsNaN(close) then price[1] else close;
plot cline = if IsNaN(close[-1]) then price else Double.NaN;
cline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
AddChartBubble(priceline and IsNaN(cline[4]) and !IsNaN(cline[3]),
               cline,
               AsText(price),
               if close[4] > open[4] then Color.GREEN else Color.RED);

#POC
#VolumeProfile_78_bar_by_bar

# plots POC, VAH and VAL for profiles starting at RTH Open and ending 1,2,3 etc bars later
# Not a realistic solution to the problem
# Nube
# 20220712 Sleepyz - Modified Nube's (TOS lounge) script to add additional else if statements to allow this to track these 3 variables on 5m and greater intraday periods. This can be very resource intense

def bn = BarNumber();
def na = Double.NaN;

script TestPro {
    input Start = 1;
    input nBars = -1;
    def bn    = BarNumber();
    def na    = Double.NaN;
    def EndBar        = if   bn == Start + nBars
                    then bn else EndBar[1];
    def NewProfile    = bn == Start or
                    bn crosses above EndBar;

    profile testProfile = VolumeProfile("startNewProfile" = NewProfile
, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = TickSize(), "value area percent" = 70);

    plot hva = if   bn == EndBar
           then testProfile.GetHighestValueArea()
           else na;
    plot lva = if   bn == EndBar
           then testProfile.GetLowestValueArea()
           else na;
    plot poc = if   bn == EndBar
           then testProfile.GetPointOfControl()
           else na;
}
def RTHOpen = GetDay() == GetLastDay() &&
              GetTime() crosses above
              RegularTradingStart(GetYYYYMMDD());
def RTHBar = CompoundValue(1,
             if   RTHOpen
             then bn
             else RTHBar[1], 0);


def hva =
if  bn == RTHBar + 1 then TestPro(RTHBar, 1).hva else
if  bn == RTHBar + 2 then TestPro(RTHBar, 2).hva else
if  bn == RTHBar + 3 then TestPro(RTHBar, 3).hva else
if  bn == RTHBar + 4 then TestPro(RTHBar, 4).hva else
if  bn == RTHBar + 5 then TestPro(RTHBar, 5).hva else
if  bn == RTHBar + 6 then TestPro(RTHBar, 6).hva else
if  bn == RTHBar + 7 then TestPro(RTHBar, 7).hva else
if  bn == RTHBar + 8 then TestPro(RTHBar, 8).hva else
if  bn == RTHBar + 9 then TestPro(RTHBar, 9).hva else
if  bn == RTHBar + 10 then TestPro(RTHBar, 10).hva else
if  bn == RTHBar + 11 then TestPro(RTHBar, 11).hva else
if  bn == RTHBar + 12 then TestPro(RTHBar, 12).hva else
if  bn == RTHBar + 13 then TestPro(RTHBar, 13).hva else
if  bn == RTHBar + 14 then TestPro(RTHBar, 14).hva else
if  bn == RTHBar + 15 then TestPro(RTHBar, 15).hva else
if  bn == RTHBar + 16 then TestPro(RTHBar, 16).hva else
if  bn == RTHBar + 17 then TestPro(RTHBar, 17).hva else
if  bn == RTHBar + 18 then TestPro(RTHBar, 18).hva else
if  bn == RTHBar + 19 then TestPro(RTHBar, 19).hva else
if  bn == RTHBar + 20 then TestPro(RTHBar, 20).hva else
if  bn == RTHBar + 21 then TestPro(RTHBar, 21).hva else
if  bn == RTHBar + 22 then TestPro(RTHBar, 22).hva else
if  bn == RTHBar + 23 then TestPro(RTHBar, 23).hva else
if  bn == RTHBar + 24 then TestPro(RTHBar, 24).poc else
if  bn == RTHBar + 25 then TestPro(RTHBar, 25).hva else
if  bn == RTHBar + 26 then TestPro(RTHBar, 26).hva else
if  bn == RTHBar + 27 then TestPro(RTHBar, 27).hva else
if  bn == RTHBar + 28 then TestPro(RTHBar, 28).hva else
if  bn == RTHBar + 29 then TestPro(RTHBar, 29).hva else
if  bn == RTHBar + 30 then TestPro(RTHBar, 30).hva else
if  bn == RTHBar + 31 then TestPro(RTHBar, 31).hva else
if  bn == RTHBar + 32 then TestPro(RTHBar, 32).hva else
if  bn == RTHBar + 33 then TestPro(RTHBar, 33).hva else
if  bn == RTHBar + 34 then TestPro(RTHBar, 34).hva else
if  bn == RTHBar + 35 then TestPro(RTHBar, 35).hva else
if  bn == RTHBar + 36 then TestPro(RTHBar, 36).hva else
if  bn == RTHBar + 37 then TestPro(RTHBar, 37).hva else
if  bn == RTHBar + 38 then TestPro(RTHBar, 38).hva else
if  bn == RTHBar + 39 then TestPro(RTHBar, 39).hva else
if  bn == RTHBar + 40 then TestPro(RTHBar, 40).hva else
if  bn == RTHBar + 41 then TestPro(RTHBar, 41).hva else
if  bn == RTHBar + 42 then TestPro(RTHBar, 42).hva else
if  bn == RTHBar + 43 then TestPro(RTHBar, 43).hva else
if  bn == RTHBar + 44 then TestPro(RTHBar, 44).hva else
if  bn == RTHBar + 45 then TestPro(RTHBar, 45).hva else
if  bn == RTHBar + 46 then TestPro(RTHBar, 46).hva else
if  bn == RTHBar + 47 then TestPro(RTHBar, 47).hva else
if  bn == RTHBar + 48 then TestPro(RTHBar, 48).hva else
if  bn == RTHBar + 49 then TestPro(RTHBar, 49).hva else
if  bn == RTHBar + 50 then TestPro(RTHBar, 50).hva else
if  bn == RTHBar + 51 then TestPro(RTHBar, 51).hva else
if  bn == RTHBar + 52 then TestPro(RTHBar, 52).hva else
if  bn == RTHBar + 53 then TestPro(RTHBar, 53).hva else
if  bn == RTHBar + 54 then TestPro(RTHBar, 54).hva else
if  bn == RTHBar + 55 then TestPro(RTHBar, 55).hva else
if  bn == RTHBar + 56 then TestPro(RTHBar, 56).hva else
if  bn == RTHBar + 57 then TestPro(RTHBar, 57).hva else
if  bn == RTHBar + 58 then TestPro(RTHBar, 58).hva else
if  bn == RTHBar + 59 then TestPro(RTHBar, 59).hva else
if  bn == RTHBar + 60 then TestPro(RTHBar, 60).hva else
if  bn == RTHBar + 61 then TestPro(RTHBar, 61).hva else
if  bn == RTHBar + 62 then TestPro(RTHBar, 62).hva else
if  bn == RTHBar + 63 then TestPro(RTHBar, 63).hva else
if  bn == RTHBar + 64 then TestPro(RTHBar, 64).hva else
if  bn == RTHBar + 65 then TestPro(RTHBar, 65).hva else
if  bn == RTHBar + 66 then TestPro(RTHBar, 66).hva else
if  bn == RTHBar + 67 then TestPro(RTHBar, 67).hva else
if  bn == RTHBar + 68 then TestPro(RTHBar, 68).hva else
if  bn == RTHBar + 69 then TestPro(RTHBar, 69).hva else
if  bn == RTHBar + 70 then TestPro(RTHBar, 70).hva else
if  bn == RTHBar + 71 then TestPro(RTHBar, 71).hva else
if  bn == RTHBar + 72 then TestPro(RTHBar, 72).hva else
if  bn == RTHBar + 73 then TestPro(RTHBar, 73).hva else
if  bn == RTHBar + 74 then TestPro(RTHBar, 74).hva else
if  bn == RTHBar + 75 then TestPro(RTHBar, 75).hva else
if  bn == RTHBar + 76 then TestPro(RTHBar, 76).hva else
if  bn == RTHBar + 77 then TestPro(RTHBar, 77).hva else
if  bn == RTHBar + 78 then TestPro(RTHBar, 78).hva else
na;

def lva =
if  bn == RTHBar + 1 then TestPro(RTHBar, 1).lva else
if  bn == RTHBar + 2 then TestPro(RTHBar, 2).lva else
if  bn == RTHBar + 3 then TestPro(RTHBar, 3).lva else
if  bn == RTHBar + 4 then TestPro(RTHBar, 4).lva else
if  bn == RTHBar + 5 then TestPro(RTHBar, 5).lva else
if  bn == RTHBar + 6 then TestPro(RTHBar, 6).lva else
if  bn == RTHBar + 7 then TestPro(RTHBar, 7).lva else
if  bn == RTHBar + 8 then TestPro(RTHBar, 8).lva else
if  bn == RTHBar + 9 then TestPro(RTHBar, 9).lva else
if  bn == RTHBar + 10 then TestPro(RTHBar, 10).lva else
if  bn == RTHBar + 11 then TestPro(RTHBar, 11).lva else
if  bn == RTHBar + 12 then TestPro(RTHBar, 12).lva else
if  bn == RTHBar + 13 then TestPro(RTHBar, 13).lva else
if  bn == RTHBar + 14 then TestPro(RTHBar, 14).lva else
if  bn == RTHBar + 15 then TestPro(RTHBar, 15).lva else
if  bn == RTHBar + 16 then TestPro(RTHBar, 16).lva else
if  bn == RTHBar + 17 then TestPro(RTHBar, 17).lva else
if  bn == RTHBar + 18 then TestPro(RTHBar, 18).lva else
if  bn == RTHBar + 19 then TestPro(RTHBar, 19).lva else
if  bn == RTHBar + 20 then TestPro(RTHBar, 20).lva else
if  bn == RTHBar + 21 then TestPro(RTHBar, 21).lva else
if  bn == RTHBar + 22 then TestPro(RTHBar, 22).lva else
if  bn == RTHBar + 23 then TestPro(RTHBar, 23).lva else
if  bn == RTHBar + 24 then TestPro(RTHBar, 24).lva else
if  bn == RTHBar + 25 then TestPro(RTHBar, 25).lva else
if  bn == RTHBar + 26 then TestPro(RTHBar, 26).lva else
if  bn == RTHBar + 27 then TestPro(RTHBar, 27).lva else
if  bn == RTHBar + 28 then TestPro(RTHBar, 28).lva else
if  bn == RTHBar + 29 then TestPro(RTHBar, 29).lva else
if  bn == RTHBar + 30 then TestPro(RTHBar, 30).lva else
if  bn == RTHBar + 31 then TestPro(RTHBar, 31).lva else
if  bn == RTHBar + 32 then TestPro(RTHBar, 32).lva else
if  bn == RTHBar + 33 then TestPro(RTHBar, 33).lva else
if  bn == RTHBar + 34 then TestPro(RTHBar, 34).lva else
if  bn == RTHBar + 35 then TestPro(RTHBar, 35).lva else
if  bn == RTHBar + 36 then TestPro(RTHBar, 36).lva else
if  bn == RTHBar + 37 then TestPro(RTHBar, 37).lva else
if  bn == RTHBar + 38 then TestPro(RTHBar, 38).lva else
if  bn == RTHBar + 39 then TestPro(RTHBar, 39).lva else
if  bn == RTHBar + 40 then TestPro(RTHBar, 40).lva else
if  bn == RTHBar + 41 then TestPro(RTHBar, 41).lva else
if  bn == RTHBar + 42 then TestPro(RTHBar, 42).lva else
if  bn == RTHBar + 43 then TestPro(RTHBar, 43).lva else
if  bn == RTHBar + 44 then TestPro(RTHBar, 44).lva else
if  bn == RTHBar + 45 then TestPro(RTHBar, 45).lva else
if  bn == RTHBar + 46 then TestPro(RTHBar, 46).lva else
if  bn == RTHBar + 47 then TestPro(RTHBar, 47).lva else
if  bn == RTHBar + 48 then TestPro(RTHBar, 48).lva else
if  bn == RTHBar + 49 then TestPro(RTHBar, 49).lva else
if  bn == RTHBar + 50 then TestPro(RTHBar, 50).lva else
if  bn == RTHBar + 51 then TestPro(RTHBar, 51).lva else
if  bn == RTHBar + 52 then TestPro(RTHBar, 52).lva else
if  bn == RTHBar + 53 then TestPro(RTHBar, 53).lva else
if  bn == RTHBar + 54 then TestPro(RTHBar, 54).lva else
if  bn == RTHBar + 55 then TestPro(RTHBar, 55).lva else
if  bn == RTHBar + 56 then TestPro(RTHBar, 56).lva else
if  bn == RTHBar + 57 then TestPro(RTHBar, 57).lva else
if  bn == RTHBar + 58 then TestPro(RTHBar, 58).lva else
if  bn == RTHBar + 59 then TestPro(RTHBar, 59).lva else
if  bn == RTHBar + 60 then TestPro(RTHBar, 60).lva else
if  bn == RTHBar + 61 then TestPro(RTHBar, 61).lva else
if  bn == RTHBar + 62 then TestPro(RTHBar, 62).lva else
if  bn == RTHBar + 63 then TestPro(RTHBar, 63).lva else
if  bn == RTHBar + 64 then TestPro(RTHBar, 64).lva else
if  bn == RTHBar + 65 then TestPro(RTHBar, 65).lva else
if  bn == RTHBar + 66 then TestPro(RTHBar, 66).lva else
if  bn == RTHBar + 67 then TestPro(RTHBar, 67).lva else
if  bn == RTHBar + 68 then TestPro(RTHBar, 68).lva else
if  bn == RTHBar + 69 then TestPro(RTHBar, 69).lva else
if  bn == RTHBar + 70 then TestPro(RTHBar, 70).lva else
if  bn == RTHBar + 71 then TestPro(RTHBar, 71).lva else
if  bn == RTHBar + 72 then TestPro(RTHBar, 72).lva else
if  bn == RTHBar + 73 then TestPro(RTHBar, 73).lva else
if  bn == RTHBar + 74 then TestPro(RTHBar, 74).lva else
if  bn == RTHBar + 75 then TestPro(RTHBar, 75).lva else
if  bn == RTHBar + 76 then TestPro(RTHBar, 76).lva else
if  bn == RTHBar + 77 then TestPro(RTHBar, 77).lva else
if  bn == RTHBar + 78 then TestPro(RTHBar, 78).lva else
na;

def poc =
if  bn == RTHBar + 1 then TestPro(RTHBar, 1).poc else
if  bn == RTHBar + 2 then TestPro(RTHBar, 2).poc else
if  bn == RTHBar + 3 then TestPro(RTHBar, 3).poc else
if  bn == RTHBar + 4 then TestPro(RTHBar, 4).poc else
if  bn == RTHBar + 5 then TestPro(RTHBar, 5).poc else
if  bn == RTHBar + 6 then TestPro(RTHBar, 6).poc else
if  bn == RTHBar + 7 then TestPro(RTHBar, 7).poc else
if  bn == RTHBar + 8 then TestPro(RTHBar, 8).poc else
if  bn == RTHBar + 9 then TestPro(RTHBar, 9).poc else
if  bn == RTHBar + 10 then TestPro(RTHBar, 10).poc else
if  bn == RTHBar + 11 then TestPro(RTHBar, 11).poc else
if  bn == RTHBar + 12 then TestPro(RTHBar, 12).poc else
if  bn == RTHBar + 13 then TestPro(RTHBar, 13).poc else
if  bn == RTHBar + 14 then TestPro(RTHBar, 14).poc else
if  bn == RTHBar + 15 then TestPro(RTHBar, 15).poc else
if  bn == RTHBar + 16 then TestPro(RTHBar, 16).poc else
if  bn == RTHBar + 17 then TestPro(RTHBar, 17).poc else
if  bn == RTHBar + 18 then TestPro(RTHBar, 18).poc else
if  bn == RTHBar + 19 then TestPro(RTHBar, 19).poc else
if  bn == RTHBar + 20 then TestPro(RTHBar, 20).poc else
if  bn == RTHBar + 21 then TestPro(RTHBar, 21).poc else
if  bn == RTHBar + 22 then TestPro(RTHBar, 22).poc else
if  bn == RTHBar + 23 then TestPro(RTHBar, 23).poc else
if  bn == RTHBar + 24 then TestPro(RTHBar, 24).poc else
if  bn == RTHBar + 25 then TestPro(RTHBar, 25).poc else
if  bn == RTHBar + 26 then TestPro(RTHBar, 26).poc else
if  bn == RTHBar + 27 then TestPro(RTHBar, 27).poc else
if  bn == RTHBar + 28 then TestPro(RTHBar, 28).poc else
if  bn == RTHBar + 29 then TestPro(RTHBar, 29).poc else
if  bn == RTHBar + 30 then TestPro(RTHBar, 30).poc else
if  bn == RTHBar + 31 then TestPro(RTHBar, 31).poc else
if  bn == RTHBar + 32 then TestPro(RTHBar, 32).poc else
if  bn == RTHBar + 33 then TestPro(RTHBar, 33).poc else
if  bn == RTHBar + 34 then TestPro(RTHBar, 34).poc else
if  bn == RTHBar + 35 then TestPro(RTHBar, 35).poc else
if  bn == RTHBar + 36 then TestPro(RTHBar, 36).poc else
if  bn == RTHBar + 37 then TestPro(RTHBar, 37).poc else
if  bn == RTHBar + 38 then TestPro(RTHBar, 38).poc else
if  bn == RTHBar + 39 then TestPro(RTHBar, 39).poc else
if  bn == RTHBar + 40 then TestPro(RTHBar, 40).poc else
if  bn == RTHBar + 41 then TestPro(RTHBar, 41).poc else
if  bn == RTHBar + 42 then TestPro(RTHBar, 42).poc else
if  bn == RTHBar + 43 then TestPro(RTHBar, 43).poc else
if  bn == RTHBar + 44 then TestPro(RTHBar, 44).poc else
if  bn == RTHBar + 45 then TestPro(RTHBar, 45).poc else
if  bn == RTHBar + 46 then TestPro(RTHBar, 46).poc else
if  bn == RTHBar + 47 then TestPro(RTHBar, 47).poc else
if  bn == RTHBar + 48 then TestPro(RTHBar, 48).poc else
if  bn == RTHBar + 49 then TestPro(RTHBar, 49).poc else
if  bn == RTHBar + 50 then TestPro(RTHBar, 50).poc else
if  bn == RTHBar + 51 then TestPro(RTHBar, 51).poc else
if  bn == RTHBar + 52 then TestPro(RTHBar, 52).poc else
if  bn == RTHBar + 53 then TestPro(RTHBar, 53).poc else
if  bn == RTHBar + 54 then TestPro(RTHBar, 54).poc else
if  bn == RTHBar + 55 then TestPro(RTHBar, 55).poc else
if  bn == RTHBar + 56 then TestPro(RTHBar, 56).poc else
if  bn == RTHBar + 57 then TestPro(RTHBar, 57).poc else
if  bn == RTHBar + 58 then TestPro(RTHBar, 58).poc else
if  bn == RTHBar + 59 then TestPro(RTHBar, 59).poc else
if  bn == RTHBar + 60 then TestPro(RTHBar, 60).poc else
if  bn == RTHBar + 61 then TestPro(RTHBar, 61).poc else
if  bn == RTHBar + 62 then TestPro(RTHBar, 62).poc else
if  bn == RTHBar + 63 then TestPro(RTHBar, 63).poc else
if  bn == RTHBar + 64 then TestPro(RTHBar, 64).poc else
if  bn == RTHBar + 65 then TestPro(RTHBar, 65).poc else
if  bn == RTHBar + 66 then TestPro(RTHBar, 66).poc else
if  bn == RTHBar + 67 then TestPro(RTHBar, 67).poc else
if  bn == RTHBar + 68 then TestPro(RTHBar, 68).poc else
if  bn == RTHBar + 69 then TestPro(RTHBar, 69).poc else
if  bn == RTHBar + 70 then TestPro(RTHBar, 70).poc else
if  bn == RTHBar + 71 then TestPro(RTHBar, 71).poc else
if  bn == RTHBar + 72 then TestPro(RTHBar, 72).poc else
if  bn == RTHBar + 73 then TestPro(RTHBar, 73).poc else
if  bn == RTHBar + 74 then TestPro(RTHBar, 74).poc else
if  bn == RTHBar + 75 then TestPro(RTHBar, 75).poc else
if  bn == RTHBar + 76 then TestPro(RTHBar, 76).poc else
if  bn == RTHBar + 77 then TestPro(RTHBar, 77).poc else
if  bn == RTHBar + 78 then TestPro(RTHBar, 78).poc else
na;

plot
LoVA = if   bn > HighestAll(RTHBar)
       then lva else na;
plot
HiVA = if   bn > HighestAll(RTHBar)
       then hva else na;
plot
PointOfControl = if   bn > HighestAll(RTHBar)
                 then poc else na;

LoVA.SetDefaultColor(Color.VIOLET);
LoVA.SetPaintingStrategy(PaintingStrategy.DASHES);
LoVA.EnableApproximation();
LoVA.SetLineWeight(5);
HiVA.SetPaintingStrategy(PaintingStrategy.DASHES);
HiVA.SetDefaultColor(Color.VIOLET);
HiVA.EnableApproximation();
HiVA.SetLineWeight(5);
Pointofcontrol.SetDefaultColor(Color.YELLOW);
Pointofcontrol.SetPaintingStrategy(PaintingStrategy.DASHES);
Pointofcontrol.EnableApproximation();
PointOfControl.SetLineWeight(5);

AddCloud(close, PointOfControl, color1 = Color.GREEN, showBorder = yes);

#POC Variance to Close
input label_VAR = yes;
AddLabel(label_VAR, "Close: " + AsText(close) + " POC: " + AsText(Pointofcontrol) + " %Var: " + AsPercent((close - Pointofcontrol) / Pointofcontrol), if close > Pointofcontrol then Color.GREEN else if close < Pointofcontrol then Color.RED else Color.WHITE);

#Bubble POC Variance to close
input bubble_VAR   = yes;
input bubbleoffset = 1;

AddChartBubble(bubble_VAR,
               low - bubbleoffset * TickSize(),
               AsPercent((close - Pointofcontrol) / Pointofcontrol),
               if close > Pointofcontrol then Color.GREEN
               else if close < Pointofcontrol
               then Color.RED else Color.WHITE, no);

#Cloud - Close Proximity to Pointofcontrol
input showcloud = yes;

def crossbn     = if close crosses Pointofcontrol then bn else Double.NaN;
def touch       = Between(Pointofcontrol, low, high);
AddCloud(if showcloud and !touch and bn >= HighestAll(crossbn)
         then close
         else Double.NaN,
         Pointofcontrol,
         Color.GREEN, Color.RED);

#Vertical lines when close crosses POC
input showvertical = yes;
AddVerticalLine(showvertical and close crosses Pointofcontrol,
                "",
                if close crosses above Pointofcontrol
                then Color.GREEN
                else Color.RED);

#Buying/Selling Pressure
input length = 10;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying  = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def Delt    = Buying - Selling;

#Delta
plot Delta = Delt;
Delta.AssignValueColor(if Delta > 0 then Color.GREEN else Color.RED);
Delta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Delta.Hide();

#Bubble Delta
input bubble_delta = yes;
AddChartBubble(bubble_delta and !IsNaN(close), low - bubbleoffset * TickSize(),
               if AbsValue(Delta) > 1000
               then Round(Delta / 1000, 0) + "k"
               else Delta + "",
               Delta.TakeValueColor(), no);

#Delta Average for avg_length input bars, excluding the current bar
input label_delta_avg = yes;
input avglength       = 3;
def   delta_avg       = Sum(Delta[1], avglength) / avglength;
addlabel(label_delta_avg, " ", color.black);
AddLabel(label_delta_avg,
        "Delta Avg " + avglength + " bars: " +
        (if AbsValue(delta_avg) > 1000
         then Round(delta_avg / 1000, 0) + "k"
         else delta_avg + ""),
         if delta_avg > 0 then Color.GREEN else Color.RED);

#Delta Spike
input spike = 200000;

plot delta_spike = if Delta > +spike then high else if Delta < -spike then low else 0;
delta_spike.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
delta_spike.SetDefaultColor(Color.YELLOW);
delta_spike.SetLineWeight(5);

#Cumulative Delta
def CumulativeVolumeDelta = Sum(Delta, length);
AssignPriceColor(if !pricecolor then Color.CURRENT else
                 if CumulativeVolumeDelta > 0
                 then Color.GREEN                 
                 else Color.RED);
 
I just remembered that Nube, from Thinkscript Lounge years ago, started a bar by bar volumeprofile. He did 14 bar tracking iterations and felt it was not practical and stopped. It can be resource intense, but may be worth looking at. I added up to 78 iterations, which will allow 5m and above intraday timeframe charts to use this. It is incorporated in the script below that was last included above.

The image shows the developing plot during regular trading hours. I left the verticallines showing closes crossing POC. It has a simple red/green cloud. The yellow dashes are the developing POC and the lavender dashes the hva and lva. I watched it today and it tracked extemely well on the 5m chart timeframe you use.
 
This is great this is what I wanted tracking the POC. I do generally use 5 minute candles because they seem to work well. Why would it not work for under 5 minutes? Just curious. Thank you for the added effort it is appreciated. I will try this in the AM. Thank you again!!!
 
I just remembered that Nube, from Thinkscript Lounge years ago, started a bar by bar volumeprofile. He did 14 bar tracking iterations and felt it was not practical and stopped. It can be resource intense, but may be worth looking at. I added up to 78 iterations, which will allow 5m and above intraday timeframe charts to use this. It is incorporated in the script below that was last included above.

The image shows the developing plot during regular trading hours. I left the verticallines showing closes crossing POC. It has a simple red/green cloud. The yellow dashes are the developing POC and the lavender dashes the hva and lva. I watched it today and it tracked extemely well on the 5m chart timeframe you use.
I like the HVA and the LVA good reference for possible reversal or confirmation of possible continuation, instead of just relying on cumulative delta or force index. That being said would Force index be a good choice to include in the candle somehow? yay or nay.
 
Last edited:
This is great this is what I wanted tracking the POC. I do generally use 5 minute candles because they seem to work well. Why would it not work for under 5 minutes? Just curious. Thank you for the added effort it is appreciated. I will try this in the AM. Thank you again!!!
It will work for under 5m but for only 78 bars. One can add more bars, but I found this to be very resource intensive even at 78 bars. When Nube originally did the 14 bars, computers (or perhaps his as well as mine) at the time would not even work well with that set up. That is why I forgot about him even doing the original idea.
 
It will work for under 5m but for only 78 bars. One can add more bars, but I found this to be very resource intensive even at 78 bars. When Nube originally did the 14 bars, computers (or perhaps his as well as mine) at the time would not even work well with that set up. That is why I forgot about him even doing the original idea.
Ok yeah my MacBook PRO is running slow. 2019 🙄..but its working. the POC doesnt start until 2nd candle in. I like how you have the poc segmented up and down on the candle works great. I was able to scalp this am on spy some money. But the spy is certainly acting strange this AM. Ok I understand the 78 yes more would destroy machine...
 
It will work for under 5m but for only 78 bars. One can add more bars, but I found this to be very resource intensive even at 78 bars. When Nube originally did the 14 bars, computers (or perhaps his as well as mine) at the time would not even work well with that set up. That is why I forgot about him even doing the original idea.
Ok this has worked extraordinarily well today, thank you. I was in and out of the market today 4 times all wins no loss...tiny 1-3 contract moves in and out on maybe 1-4 candle moves on 5 min chart. The coloring of the candles are a huge help. Sincere gratitude to you for bringing this to a reality.
 
Last edited:
Ok this has worked extraordinarily well today, thank you. I was in and out of the market today 4 times all wins no loss...tiny 1-3 contract moves in and out on maybe 1-4 candle moves on 5 min chart. The coloring of the candles are a huge help. Sincere gratitude to you for bringing this to a reality.
The first candle doesnt show the poc nor value. Its how's up on the second candle..?
 
The first candle doesnt show the poc nor value. Its how's up on the second candle..?
I had not had a chance to look at the volumeprofile bar by bar code in detail, but have now made a few revisions. These revisions will now start plotting at the first bar and allow an option to choose a start location.

This will allow using multiple versions of the study to use on lower than 5m timeframes to have a complete regular trading hours (rth) bar by bar profile. For example, to display a full rth for a 3 min chart (need 130 bars), one needs to load two copies of the study, with the first to have input start = 0, and the second start at 78 (avoid any gaps by starting here). For a 2 min chart, need 3 copies and a 1 min chart 5 copies.

As this is resource intensive, especially with if more copies are used, I recommend using a TODAY chart.

Capture.jpg
Ruby:
#VolumeProfile_bar_bar_78bars
#Priceline
input priceline  = no;
def price  = if IsNaN(close) then price[1] else close;
plot cline = if IsNaN(close[-1]) then price else Double.NaN;
cline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
AddChartBubble(priceline and IsNaN(cline[4]) and !IsNaN(cline[3]),
               cline,
               AsText(price),
               if close[4] > open[4] then Color.GREEN else Color.RED);

#POC
#VolumeProfile_78_bar_by_bar

# plots POC, VAH and VAL for profiles starting at RTH Open and ending 1,2,3 etc bars later
# Not a realistic solution to the problem
# Nube
# 20220712 Sleepyz - Modified Nube's (TOS lounge) script to add additional else if statements to allow this to track these 3 variables on 5m and greater intraday periods. This can be very resource intense

def bn = BarNumber();
def na = Double.NaN;

script TestPro {
    input Start = 1;
    input nBars = 0;
    def bn    = BarNumber();
    def na    = Double.NaN;
    def EndBar        = if   bn == Start + nBars
                        then bn else EndBar[1];
    def NewProfile    = bn == Start or
                        bn crosses above EndBar;

    profile testProfile = VolumeProfile("startNewProfile" = NewProfile
, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = TickSize(), "value area percent" = 70);

    plot hva = if   bn == EndBar
           then testProfile.GetHighestValueArea()
           else na;
    plot lva = if   bn == EndBar
           then testProfile.GetLowestValueArea()
           else na;
    plot poc = if   bn == EndBar
           then testProfile.GetPointOfControl()
           else na;
}
def RTHOpen = GetDay() == GetLastDay()  &&  GetTime() crosses above RegularTradingStart(GetYYYYMMDD());
def RTHBar = CompoundValue(1,
             if   RTHOpen
             then bn - 1
             else RTHBar[1], 0);

input start = 0;

def hva =
if  bn == RTHBar + start + 1 then TestPro(RTHBar,  start + 1).hva else
if  bn == RTHBar + start + 2 then TestPro(RTHBar,  start + 2).hva else
if  bn == RTHBar + start + 3 then TestPro(RTHBar,  start + 3).hva else
if  bn == RTHBar + start + 4 then TestPro(RTHBar,  start + 4).hva else
if  bn == RTHBar + start + 5 then TestPro(RTHBar,  start + 5).hva else
if  bn == RTHBar + start + 6 then TestPro(RTHBar,  start + 6).hva else
if  bn == RTHBar + start + 7 then TestPro(RTHBar,  start + 7).hva else
if  bn == RTHBar + start + 8 then TestPro(RTHBar,  start + 8).hva else
if  bn == RTHBar + start + 9 then TestPro(RTHBar,  start + 9).hva else
if  bn == RTHBar + start + 10 then TestPro(RTHBar,  start + 10).hva else
if  bn == RTHBar + start + 11 then TestPro(RTHBar,  start + 11).hva else
if  bn == RTHBar + start + 12 then TestPro(RTHBar,  start + 12).hva else
if  bn == RTHBar + start + 13 then TestPro(RTHBar,  start + 13).hva else
if  bn == RTHBar + start + 14 then TestPro(RTHBar,  start + 14).hva else
if  bn == RTHBar + start + 15 then TestPro(RTHBar,  start + 15).hva else
if  bn == RTHBar + start + 16 then TestPro(RTHBar,  start + 16).hva else
if  bn == RTHBar + start + 17 then TestPro(RTHBar,  start + 17).hva else
if  bn == RTHBar + start + 18 then TestPro(RTHBar,  start + 18).hva else
if  bn == RTHBar + start + 19 then TestPro(RTHBar,  start + 19).hva else
if  bn == RTHBar + start + 20 then TestPro(RTHBar,  start + 20).hva else
if  bn == RTHBar + start + 21 then TestPro(RTHBar,  start + 21).hva else
if  bn == RTHBar + start + 22 then TestPro(RTHBar,  start + 22).hva else
if  bn == RTHBar + start + 23 then TestPro(RTHBar,  start + 23).hva else
if  bn == RTHBar + start + 24 then TestPro(RTHBar,  start + 24).hva else
if  bn == RTHBar + start + 25 then TestPro(RTHBar,  start + 25).hva else
if  bn == RTHBar + start + 26 then TestPro(RTHBar,  start + 26).hva else
if  bn == RTHBar + start + 27 then TestPro(RTHBar,  start + 27).hva else
if  bn == RTHBar + start + 28 then TestPro(RTHBar,  start + 28).hva else
if  bn == RTHBar + start + 29 then TestPro(RTHBar,  start + 29).hva else
if  bn == RTHBar + start + 30 then TestPro(RTHBar,  start + 30).hva else
if  bn == RTHBar + start + 31 then TestPro(RTHBar,  start + 31).hva else
if  bn == RTHBar + start + 32 then TestPro(RTHBar,  start + 32).hva else
if  bn == RTHBar + start + 33 then TestPro(RTHBar,  start + 33).hva else
if  bn == RTHBar + start + 34 then TestPro(RTHBar,  start + 34).hva else
if  bn == RTHBar + start + 35 then TestPro(RTHBar,  start + 35).hva else
if  bn == RTHBar + start + 36 then TestPro(RTHBar,  start + 36).hva else
if  bn == RTHBar + start + 37 then TestPro(RTHBar,  start + 37).hva else
if  bn == RTHBar + start + 38 then TestPro(RTHBar,  start + 38).hva else
if  bn == RTHBar + start + 39 then TestPro(RTHBar,  start + 39).hva else
if  bn == RTHBar + start + 40 then TestPro(RTHBar,  start + 40).hva else
if  bn == RTHBar + start + 41 then TestPro(RTHBar,  start + 41).hva else
if  bn == RTHBar + start + 42 then TestPro(RTHBar,  start + 42).hva else
if  bn == RTHBar + start + 43 then TestPro(RTHBar,  start + 43).hva else
if  bn == RTHBar + start + 44 then TestPro(RTHBar,  start + 44).hva else
if  bn == RTHBar + start + 45 then TestPro(RTHBar,  start + 45).hva else
if  bn == RTHBar + start + 46 then TestPro(RTHBar,  start + 46).hva else
if  bn == RTHBar + start + 47 then TestPro(RTHBar,  start + 47).hva else
if  bn == RTHBar + start + 48 then TestPro(RTHBar,  start + 48).hva else
if  bn == RTHBar + start + 49 then TestPro(RTHBar,  start + 49).hva else
if  bn == RTHBar + start + 50 then TestPro(RTHBar,  start + 50).hva else
if  bn == RTHBar + start + 51 then TestPro(RTHBar,  start + 51).hva else
if  bn == RTHBar + start + 52 then TestPro(RTHBar,  start + 52).hva else
if  bn == RTHBar + start + 53 then TestPro(RTHBar,  start + 53).hva else
if  bn == RTHBar + start + 54 then TestPro(RTHBar,  start + 54).hva else
if  bn == RTHBar + start + 55 then TestPro(RTHBar,  start + 55).hva else
if  bn == RTHBar + start + 56 then TestPro(RTHBar,  start + 56).hva else
if  bn == RTHBar + start + 57 then TestPro(RTHBar,  start + 57).hva else
if  bn == RTHBar + start + 58 then TestPro(RTHBar,  start + 58).hva else
if  bn == RTHBar + start + 59 then TestPro(RTHBar,  start + 59).hva else
if  bn == RTHBar + start + 60 then TestPro(RTHBar,  start + 60).hva else
if  bn == RTHBar + start + 61 then TestPro(RTHBar,  start + 61).hva else
if  bn == RTHBar + start + 62 then TestPro(RTHBar,  start + 62).hva else
if  bn == RTHBar + start + 63 then TestPro(RTHBar,  start + 63).hva else
if  bn == RTHBar + start + 64 then TestPro(RTHBar,  start + 64).hva else
if  bn == RTHBar + start + 65 then TestPro(RTHBar,  start + 65).hva else
if  bn == RTHBar + start + 66 then TestPro(RTHBar,  start + 66).hva else
if  bn == RTHBar + start + 67 then TestPro(RTHBar,  start + 67).hva else
if  bn == RTHBar + start + 68 then TestPro(RTHBar,  start + 68).hva else
if  bn == RTHBar + start + 69 then TestPro(RTHBar,  start + 69).hva else
if  bn == RTHBar + start + 70 then TestPro(RTHBar,  start + 70).hva else
if  bn == RTHBar + start + 71 then TestPro(RTHBar,  start + 71).hva else
if  bn == RTHBar + start + 72 then TestPro(RTHBar,  start + 72).hva else
if  bn == RTHBar + start + 73 then TestPro(RTHBar,  start + 73).hva else
if  bn == RTHBar + start + 74 then TestPro(RTHBar,  start + 74).hva else
if  bn == RTHBar + start + 75 then TestPro(RTHBar,  start + 75).hva else
if  bn == RTHBar + start + 76 then TestPro(RTHBar,  start + 76).hva else
if  bn == RTHBar + start + 77 then TestPro(RTHBar,  start + 77).hva else
if  bn == RTHBar + start + 78 then TestPro(RTHBar,  start + 78).hva else
na;

def lva =
if  bn == RTHBar + start + 1 then TestPro(RTHBar,  start + 1).lva else
if  bn == RTHBar + start + 2 then TestPro(RTHBar,  start + 2).lva else
if  bn == RTHBar + start + 3 then TestPro(RTHBar,  start + 3).lva else
if  bn == RTHBar + start + 4 then TestPro(RTHBar,  start + 4).lva else
if  bn == RTHBar + start + 5 then TestPro(RTHBar,  start + 5).lva else
if  bn == RTHBar + start + 6 then TestPro(RTHBar,  start + 6).lva else
if  bn == RTHBar + start + 7 then TestPro(RTHBar,  start + 7).lva else
if  bn == RTHBar + start + 8 then TestPro(RTHBar,  start + 8).lva else
if  bn == RTHBar + start + 9 then TestPro(RTHBar,  start + 9).lva else
if  bn == RTHBar + start + 10 then TestPro(RTHBar,  start + 10).lva else
if  bn == RTHBar + start + 11 then TestPro(RTHBar,  start + 11).lva else
if  bn == RTHBar + start + 12 then TestPro(RTHBar,  start + 12).lva else
if  bn == RTHBar + start + 13 then TestPro(RTHBar,  start + 13).lva else
if  bn == RTHBar + start + 14 then TestPro(RTHBar,  start + 14).lva else
if  bn == RTHBar + start + 15 then TestPro(RTHBar,  start + 15).lva else
if  bn == RTHBar + start + 16 then TestPro(RTHBar,  start + 16).lva else
if  bn == RTHBar + start + 17 then TestPro(RTHBar,  start + 17).lva else
if  bn == RTHBar + start + 18 then TestPro(RTHBar,  start + 18).lva else
if  bn == RTHBar + start + 19 then TestPro(RTHBar,  start + 19).lva else
if  bn == RTHBar + start + 20 then TestPro(RTHBar,  start + 20).lva else
if  bn == RTHBar + start + 21 then TestPro(RTHBar,  start + 21).lva else
if  bn == RTHBar + start + 22 then TestPro(RTHBar,  start + 22).lva else
if  bn == RTHBar + start + 23 then TestPro(RTHBar,  start + 23).lva else
if  bn == RTHBar + start + 24 then TestPro(RTHBar,  start + 24).lva else
if  bn == RTHBar + start + 25 then TestPro(RTHBar,  start + 25).lva else
if  bn == RTHBar + start + 26 then TestPro(RTHBar,  start + 26).lva else
if  bn == RTHBar + start + 27 then TestPro(RTHBar,  start + 27).lva else
if  bn == RTHBar + start + 28 then TestPro(RTHBar,  start + 28).lva else
if  bn == RTHBar + start + 29 then TestPro(RTHBar,  start + 29).lva else
if  bn == RTHBar + start + 30 then TestPro(RTHBar,  start + 30).lva else
if  bn == RTHBar + start + 31 then TestPro(RTHBar,  start + 31).lva else
if  bn == RTHBar + start + 32 then TestPro(RTHBar,  start + 32).lva else
if  bn == RTHBar + start + 33 then TestPro(RTHBar,  start + 33).lva else
if  bn == RTHBar + start + 34 then TestPro(RTHBar,  start + 34).lva else
if  bn == RTHBar + start + 35 then TestPro(RTHBar,  start + 35).lva else
if  bn == RTHBar + start + 36 then TestPro(RTHBar,  start + 36).lva else
if  bn == RTHBar + start + 37 then TestPro(RTHBar,  start + 37).lva else
if  bn == RTHBar + start + 38 then TestPro(RTHBar,  start + 38).lva else
if  bn == RTHBar + start + 39 then TestPro(RTHBar,  start + 39).lva else
if  bn == RTHBar + start + 40 then TestPro(RTHBar,  start + 40).lva else
if  bn == RTHBar + start + 41 then TestPro(RTHBar,  start + 41).lva else
if  bn == RTHBar + start + 42 then TestPro(RTHBar,  start + 42).lva else
if  bn == RTHBar + start + 43 then TestPro(RTHBar,  start + 43).lva else
if  bn == RTHBar + start + 44 then TestPro(RTHBar,  start + 44).lva else
if  bn == RTHBar + start + 45 then TestPro(RTHBar,  start + 45).lva else
if  bn == RTHBar + start + 46 then TestPro(RTHBar,  start + 46).lva else
if  bn == RTHBar + start + 47 then TestPro(RTHBar,  start + 47).lva else
if  bn == RTHBar + start + 48 then TestPro(RTHBar,  start + 48).lva else
if  bn == RTHBar + start + 49 then TestPro(RTHBar,  start + 49).lva else
if  bn == RTHBar + start + 50 then TestPro(RTHBar,  start + 50).lva else
if  bn == RTHBar + start + 51 then TestPro(RTHBar,  start + 51).lva else
if  bn == RTHBar + start + 52 then TestPro(RTHBar,  start + 52).lva else
if  bn == RTHBar + start + 53 then TestPro(RTHBar,  start + 53).lva else
if  bn == RTHBar + start + 54 then TestPro(RTHBar,  start + 54).lva else
if  bn == RTHBar + start + 55 then TestPro(RTHBar,  start + 55).lva else
if  bn == RTHBar + start + 56 then TestPro(RTHBar,  start + 56).lva else
if  bn == RTHBar + start + 57 then TestPro(RTHBar,  start + 57).lva else
if  bn == RTHBar + start + 58 then TestPro(RTHBar,  start + 58).lva else
if  bn == RTHBar + start + 59 then TestPro(RTHBar,  start + 59).lva else
if  bn == RTHBar + start + 60 then TestPro(RTHBar,  start + 60).lva else
if  bn == RTHBar + start + 61 then TestPro(RTHBar,  start + 61).lva else
if  bn == RTHBar + start + 62 then TestPro(RTHBar,  start + 62).lva else
if  bn == RTHBar + start + 63 then TestPro(RTHBar,  start + 63).lva else
if  bn == RTHBar + start + 64 then TestPro(RTHBar,  start + 64).lva else
if  bn == RTHBar + start + 65 then TestPro(RTHBar,  start + 65).lva else
if  bn == RTHBar + start + 66 then TestPro(RTHBar,  start + 66).lva else
if  bn == RTHBar + start + 67 then TestPro(RTHBar,  start + 67).lva else
if  bn == RTHBar + start + 68 then TestPro(RTHBar,  start + 68).lva else
if  bn == RTHBar + start + 69 then TestPro(RTHBar,  start + 69).lva else
if  bn == RTHBar + start + 70 then TestPro(RTHBar,  start + 70).lva else
if  bn == RTHBar + start + 71 then TestPro(RTHBar,  start + 71).lva else
if  bn == RTHBar + start + 72 then TestPro(RTHBar,  start + 72).lva else
if  bn == RTHBar + start + 73 then TestPro(RTHBar,  start + 73).lva else
if  bn == RTHBar + start + 74 then TestPro(RTHBar,  start + 74).lva else
if  bn == RTHBar + start + 75 then TestPro(RTHBar,  start + 75).lva else
if  bn == RTHBar + start + 76 then TestPro(RTHBar,  start + 76).lva else
if  bn == RTHBar + start + 77 then TestPro(RTHBar,  start + 77).lva else
if  bn == RTHBar + start + 78 then TestPro(RTHBar,  start + 78).lva else
na;

def poc =
if  bn == RTHBar     then TestPro(RTHBar,  start + 0).poc else
if  bn == RTHBar + start + 1 then TestPro(RTHBar,  start + 1).poc else
if  bn == RTHBar + start + 2 then TestPro(RTHBar,  start + 2).poc else
if  bn == RTHBar + start + 3 then TestPro(RTHBar,  start + 3).poc else
if  bn == RTHBar + start + 4 then TestPro(RTHBar,  start + 4).poc else
if  bn == RTHBar + start + 5 then TestPro(RTHBar,  start + 5).poc else
if  bn == RTHBar + start + 6 then TestPro(RTHBar,  start + 6).poc else
if  bn == RTHBar + start + 7 then TestPro(RTHBar,  start + 7).poc else
if  bn == RTHBar + start + 8 then TestPro(RTHBar,  start + 8).poc else
if  bn == RTHBar + start + 9 then TestPro(RTHBar,  start + 9).poc else
if  bn == RTHBar + start + 10 then TestPro(RTHBar,  start + 10).poc else
if  bn == RTHBar + start + 11 then TestPro(RTHBar,  start + 11).poc else
if  bn == RTHBar + start + 12 then TestPro(RTHBar,  start + 12).poc else
if  bn == RTHBar + start + 13 then TestPro(RTHBar,  start + 13).poc else
if  bn == RTHBar + start + 14 then TestPro(RTHBar,  start + 14).poc else
if  bn == RTHBar + start + 15 then TestPro(RTHBar,  start + 15).poc else
if  bn == RTHBar + start + 16 then TestPro(RTHBar,  start + 16).poc else
if  bn == RTHBar + start + 17 then TestPro(RTHBar,  start + 17).poc else
if  bn == RTHBar + start + 18 then TestPro(RTHBar,  start + 18).poc else
if  bn == RTHBar + start + 19 then TestPro(RTHBar,  start + 19).poc else
if  bn == RTHBar + start + 20 then TestPro(RTHBar,  start + 20).poc else
if  bn == RTHBar + start + 21 then TestPro(RTHBar,  start + 21).poc else
if  bn == RTHBar + start + 22 then TestPro(RTHBar,  start + 22).poc else
if  bn == RTHBar + start + 23 then TestPro(RTHBar,  start + 23).poc else
if  bn == RTHBar + start + 24 then TestPro(RTHBar,  start + 24).poc else
if  bn == RTHBar + start + 25 then TestPro(RTHBar,  start + 25).poc else
if  bn == RTHBar + start + 26 then TestPro(RTHBar,  start + 26).poc else
if  bn == RTHBar + start + 27 then TestPro(RTHBar,  start + 27).poc else
if  bn == RTHBar + start + 28 then TestPro(RTHBar,  start + 28).poc else
if  bn == RTHBar + start + 29 then TestPro(RTHBar,  start + 29).poc else
if  bn == RTHBar + start + 30 then TestPro(RTHBar,  start + 30).poc else
if  bn == RTHBar + start + 31 then TestPro(RTHBar,  start + 31).poc else
if  bn == RTHBar + start + 32 then TestPro(RTHBar,  start + 32).poc else
if  bn == RTHBar + start + 33 then TestPro(RTHBar,  start + 33).poc else
if  bn == RTHBar + start + 34 then TestPro(RTHBar,  start + 34).poc else
if  bn == RTHBar + start + 35 then TestPro(RTHBar,  start + 35).poc else
if  bn == RTHBar + start + 36 then TestPro(RTHBar,  start + 36).poc else
if  bn == RTHBar + start + 37 then TestPro(RTHBar,  start + 37).poc else
if  bn == RTHBar + start + 38 then TestPro(RTHBar,  start + 38).poc else
if  bn == RTHBar + start + 39 then TestPro(RTHBar,  start + 39).poc else
if  bn == RTHBar + start + 40 then TestPro(RTHBar,  start + 40).poc else
if  bn == RTHBar + start + 41 then TestPro(RTHBar,  start + 41).poc else
if  bn == RTHBar + start + 42 then TestPro(RTHBar,  start + 42).poc else
if  bn == RTHBar + start + 43 then TestPro(RTHBar,  start + 43).poc else
if  bn == RTHBar + start + 44 then TestPro(RTHBar,  start + 44).poc else
if  bn == RTHBar + start + 45 then TestPro(RTHBar,  start + 45).poc else
if  bn == RTHBar + start + 46 then TestPro(RTHBar,  start + 46).poc else
if  bn == RTHBar + start + 47 then TestPro(RTHBar,  start + 47).poc else
if  bn == RTHBar + start + 48 then TestPro(RTHBar,  start + 48).poc else
if  bn == RTHBar + start + 49 then TestPro(RTHBar,  start + 49).poc else
if  bn == RTHBar + start + 50 then TestPro(RTHBar,  start + 50).poc else
if  bn == RTHBar + start + 51 then TestPro(RTHBar,  start + 51).poc else
if  bn == RTHBar + start + 52 then TestPro(RTHBar,  start + 52).poc else
if  bn == RTHBar + start + 53 then TestPro(RTHBar,  start + 53).poc else
if  bn == RTHBar + start + 54 then TestPro(RTHBar,  start + 54).poc else
if  bn == RTHBar + start + 55 then TestPro(RTHBar,  start + 55).poc else
if  bn == RTHBar + start + 56 then TestPro(RTHBar,  start + 56).poc else
if  bn == RTHBar + start + 57 then TestPro(RTHBar,  start + 57).poc else
if  bn == RTHBar + start + 58 then TestPro(RTHBar,  start + 58).poc else
if  bn == RTHBar + start + 59 then TestPro(RTHBar,  start + 59).poc else
if  bn == RTHBar + start + 60 then TestPro(RTHBar,  start + 60).poc else
if  bn == RTHBar + start + 61 then TestPro(RTHBar,  start + 61).poc else
if  bn == RTHBar + start + 62 then TestPro(RTHBar,  start + 62).poc else
if  bn == RTHBar + start + 63 then TestPro(RTHBar,  start + 63).poc else
if  bn == RTHBar + start + 64 then TestPro(RTHBar,  start + 64).poc else
if  bn == RTHBar + start + 65 then TestPro(RTHBar,  start + 65).poc else
if  bn == RTHBar + start + 66 then TestPro(RTHBar,  start + 66).poc else
if  bn == RTHBar + start + 67 then TestPro(RTHBar,  start + 67).poc else
if  bn == RTHBar + start + 68 then TestPro(RTHBar,  start + 68).poc else
if  bn == RTHBar + start + 69 then TestPro(RTHBar,  start + 69).poc else
if  bn == RTHBar + start + 70 then TestPro(RTHBar,  start + 70).poc else
if  bn == RTHBar + start + 71 then TestPro(RTHBar,  start + 71).poc else
if  bn == RTHBar + start + 72 then TestPro(RTHBar,  start + 72).poc else
if  bn == RTHBar + start + 73 then TestPro(RTHBar,  start + 73).poc else
if  bn == RTHBar + start + 74 then TestPro(RTHBar,  start + 74).poc else
if  bn == RTHBar + start + 75 then TestPro(RTHBar,  start + 75).poc else
if  bn == RTHBar + start + 76 then TestPro(RTHBar,  start + 76).poc else
if  bn == RTHBar + start + 77 then TestPro(RTHBar,  start + 77).poc else
if  bn == RTHBar + start + 78 then TestPro(RTHBar,  start + 78).poc else
na;

plot
LoVA = if   bn > HighestAll(RTHBar)
       then lva else na;
plot
HiVA = if   bn > HighestAll(RTHBar)
       then hva else na;
plot
PointOfControl = if   bn > HighestAll(RTHBar)
                 then poc else na;

LoVA.SetDefaultColor(Color.VIOLET);
LoVA.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
LoVA.EnableApproximation();
LoVA.SetLineWeight(2);
HiVA.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
HiVA.SetDefaultColor(Color.VIOLET);
HiVA.EnableApproximation();
HiVA.SetLineWeight(2);
PointOfControl.SetDefaultColor(Color.YELLOW);
PointOfControl.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
PointOfControl.EnableApproximation();
PointOfControl.SetLineWeight(2);

AddCloud(close, PointOfControl, color1 = Color.GREEN, showBorder = yes);

#POC Variance to Close
input label_VAR = no;
AddLabel(label_VAR, "Close: " + AsText(close) + " POC: " + AsText(PointOfControl) + " %Var: " + AsPercent((close - PointOfControl) / PointOfControl), if close > PointOfControl then Color.GREEN else if close < PointOfControl then Color.RED else Color.WHITE);

#Bubble POC Variance to close
input bubble_VAR   = no;
input bubbleoffset = 1;

AddChartBubble(bubble_VAR and RTHBar > start,
               low - bubbleoffset * TickSize(),
               AsPercent((close - PointOfControl) / PointOfControl),
               if close > PointOfControl then Color.GREEN
               else if close < PointOfControl
               then Color.RED else Color.WHITE, no);

#Cloud - Close Proximity to Pointofcontrol
input showcloud = yes;

def crossbn     = if close crosses PointOfControl then bn else Double.NaN;
def touch       = Between(PointOfControl, low, high);
AddCloud(if showcloud and !touch and bn >= HighestAll(crossbn)
         then close
         else Double.NaN,
         PointOfControl,
         Color.GREEN, Color.RED);

#Vertical lines when close crosses POC
input showvertical = yes;
AddVerticalLine(showvertical and close crosses PointOfControl,
                "",
                if close crosses above PointOfControl
                then Color.GREEN
                else Color.RED, stroke = Curve.FIRM);

#Buying/Selling Pressure
input length = 10;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying  = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def Delt    = Buying - Selling;

#Delta
plot Delta = Delt;
Delta.AssignValueColor(if Delta > 0 then Color.GREEN else Color.RED);
Delta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Delta.Hide();

#Bubble Delta
input bubble_delta = no;
AddChartBubble(bubble_delta and !IsNaN(close) and RTHBar > start, low - bubbleoffset * TickSize(),
               if AbsValue(Delta) > 1000
               then Round(Delta / 1000, 0) + "k"
               else Delta + "",
               Delta.TakeValueColor(), no);

#Delta Average for avg_length input bars, excluding the current bar
input label_delta_avg = no;
input avglength       = 3;
def   delta_avg       = Sum(Delta[1], avglength) / avglength;
AddLabel(label_delta_avg, " ", Color.BLACK);
AddLabel(label_delta_avg,
        "Delta Avg " + avglength + " bars: " +
        (if AbsValue(delta_avg) > 1000
         then Round(delta_avg / 1000, 0) + "k"
         else delta_avg + ""),
         if delta_avg > 0 then Color.GREEN else Color.RED);

#Delta Spike
input showspike = no;
input spike     = 200000;

plot delta_spike = if !showspike then double.nan
                   else if Delta > +spike
                   then high
                   else if Delta < -spike
                   then low else 0;
delta_spike.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
delta_spike.SetDefaultColor(Color.YELLOW);
delta_spike.SetLineWeight(5);

#Cumulative Delta
def CumulativeVolumeDelta = Sum(Delta, length);
input pricecolor = no;
AssignPriceColor(if !pricecolor then Color.CURRENT else
                 if CumulativeVolumeDelta > 0
                 then Color.GREEN               
                 else Color.RED);
 
Last edited:
I had not had a chance to look at the volumeprofile bar by bar code in detail, but have now made a few revisions. These revisions will now start plotting at the first bar and allow an option to choose a start location.

This will allow using multiple versions of the study to use on lower than 5m timeframes to have a complete regular trading hours (rth) bar by bar profile. For example, to display a full rth for a 3 min chart (need 130 bars), one needs to load two copies of the study, with the first to have input start = 0, and the second start at 78 (avoid any gaps by starting here). For a 2 min chart, need 3 copies and a 1 min chart 5 copies.

As this is resource intensive, especially with if more copies are used, I recommend using a TODAY chart.
 
I had not had a chance to look at the volumeprofile bar by bar code in detail, but have now made a few revisions. These revisions will now start plotting at the first bar and allow an option to choose a start location.

This will allow using multiple versions of the study to use on lower than 5m timeframes to have a complete regular trading hours (rth) bar by bar profile. For example, to display a full rth for a 3 min chart (need 130 bars), one needs to load two copies of the study, with the first to have input start = 0, and the second start at 78 (avoid any gaps by starting here). For a 2 min chart, need 3 copies and a 1 min chart 5 copies.

As this is resource intensive, especially with if more copies are used, I recommend using a TODAY chart.
Hi @SleepyZ , This is very interesting. I placed your system over @Christopher84 's C3_MAX and watched how your study corresponds to the C3_MAX's clouds and the MF line. I can see benefits of having both. However, this POC study is sooo heavy on the computer resources (as you stated) that unfortunately I'm unable to take advantage of it, especially for me as a 3min-chart-scalper.

As a new trader, double/triple confirmation (to help ease the fear as I've been tricked and burned so bad by the market for 12+ months now) is constantly needed. I use 3min along 15min and 30min charts to scalp. I just wish there's something that can give reasonably high-accuracy MTF confirmation while allowing me to be laser-focused on one 3min chart.

Thank you and @Christopher84 and so many other great minds here for your continued contribution to this community to help out [especially new] traders.
God bless.
 
Last edited by a moderator:
Hi @SleepyZ , This is very interesting. I placed your system over @Christopher84 's C3_MAX and watched how your study corresponds to the C3_MAX's clouds and the MF line. I can see benefits of having both. However, this POC study is sooo heavy on the computer resources (as you stated) that unfortunately I'm unable to take advantage of it, especially for me as a 3min-chart-scalper.

As a new trader, double/triple confirmation (to help ease the fear as I've been tricked and burned so bad by the market for 12+ months now) is constantly needed. I use 3min along 15min and 30min charts to scalp. I just wish there's something that can give reasonably high-accuracy MTF confirmation while allowing me to be laser-focused on one 3min chart.

Thank you and @Christopher84 and so many other great minds here for your continued contribution to this community to help out [especially new] traders.
God bless.

Screenshot-07-16-2022-10-10-42.png

Is there a share link for the chart shown here?
 
I had not had a chance to look at the volumeprofile bar by bar code in detail, but have now made a few revisions. These revisions will now start plotting at the first bar and allow an option to choose a start location.

This will allow using multiple versions of the study to use on lower than 5m timeframes to have a complete regular trading hours (rth) bar by bar profile. For example, to display a full rth for a 3 min chart (need 130 bars), one needs to load two copies of the study, with the first to have input start = 0, and the second start at 78 (avoid any gaps by starting here). For a 2 min chart, need 3 copies and a 1 min chart 5 copies.

As this is resource intensive, especially with if more copies are used, I recommend using a TODAY chart.
I have had the flu for a week just getting back to normal, thanks for this extra work you put into this idea. Ill have some questions later but for now Im just getting better. Thank you again.
 
I had not had a chance to look at the volumeprofile bar by bar code in detail, but have now made a few revisions. These revisions will now start plotting at the first bar and allow an option to choose a start location.

This will allow using multiple versions of the study to use on lower than 5m timeframes to have a complete regular trading hours (rth) bar by bar profile. For example, to display a full rth for a 3 min chart (need 130 bars), one needs to load two copies of the study, with the first to have input start = 0, and the second start at 78 (avoid any gaps by starting here). For a 2 min chart, need 3 copies and a 1 min chart 5 copies.

As this is resource intensive, especially with if more copies are used, I recommend using a TODAY chart.
If we run 5 copies as you suggested the program will only run each of these at one time in succession correct? So technically there wont be 5 running at one time?
 
If we run 5 copies as you suggested the program will only run each of these at one time in succession correct? So technically there wont be 5 running at one time?

TOS, I understand runs all indicators at every tick/bar on a chart. So if you run 5 copies, it would only be most useful for testing/analysis of an entire day's whole regulart trading hours. The platform performance with even 1 of this indicator loaded, can really be affected at the lowest timeframes.

I have created a new regular trading hour version that makes a floating 60 (this can be modified by adding/deleting plots) bar script that plots the last 60 bars as the day progresses. You can select at the input start_type whether to use the floating auto or manual input, as before.

It is, as was the original, best run on a TODAY chart.

There are some minor fixes to the original code that are included in the new floating code below to try make sure that it works on most timeframes.

Ruby:
#VolumeProfile_bar_bar_78bars
#Priceline
input priceline  = yes;
def price  = if IsNaN(close) then price[1] else close;
plot cline = if IsNaN(close[-1]) then price else Double.NaN;
cline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
AddChartBubble(priceline and IsNaN(cline[4]) and !IsNaN(cline[3]),
               cline,
               AsText(price),
               if close[4] > open[4] then Color.GREEN else Color.RED);

#VolumeProfile_bar_by_bar_Flexible_98_Iterations

#POC
#VolumeProfile_78_bar_by_bar

# plots POC, VAH and VAL for profiles starting at RTH Open and ending 1,2,3 etc bars later
# Not a realistic solution to the problem
# Nube
# 20220712 Sleepyz - Modified Nube's (TOS lounge) script to add additional else if statements to allow this to track these 3 variables on 5m and greater intraday periods. This can be very resource intense

input start_type   = {default autostart, manualstart};
input manual_start = 0;

def bn = BarNumber();
def na = Double.NaN;

script TestPro {
    input Start = 1;
    input nBars = 0;
    def bn    = BarNumber();
    def na    = Double.NaN;
    def EndBar        = if   bn == Start + nBars
                        then bn else EndBar[1];
    def NewProfile    = bn == Start or
                        bn crosses above EndBar;

    profile testProfile = VolumeProfile("startNewProfile" = NewProfile
, "onExpansion" = no, "numberOfProfiles" = 99, "pricePerRow" = TickSize(), "value area percent" = 70);

    plot hva = if   bn == EndBar
           then testProfile.GetHighestValueArea()
           else na;
    plot lva = if   bn == EndBar
           then testProfile.GetLowestValueArea()
           else na;
    plot poc = if   bn == EndBar
           then testProfile.GetPointOfControl()
           else na;
}
def RTHOpen = GetDay() == GetLastDay()  && 
              GetTime() crosses above RegularTradingStart(GetYYYYMMDD());

def RTHBar  = HighestAll(CompoundValue(1,
              if RTHOpen
              then bn - 1
              else Double.NaN, 0));

def count = if bn < RTHBar or
            GetTime() > RegularTradingEnd(GetYYYYMMDD())
            then 0
            else if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
            then 1
            else count[1] + 1;

def move  = if count <= 60 then 0 else Max(0, (count - 79)) ;

def start = if start_type==start_type.manualstart
            then manual_start
            else HighestAll(AbsValue(move));

def hva =
if  bn == RTHBar + start + 1 then TestPro(RTHBar,  start + 1).hva else
if  bn == RTHBar + start + 2 then TestPro(RTHBar,  start + 2).hva else
if  bn == RTHBar + start + 3 then TestPro(RTHBar,  start + 3).hva else
if  bn == RTHBar + start + 4 then TestPro(RTHBar,  start + 4).hva else
if  bn == RTHBar + start + 5 then TestPro(RTHBar,  start + 5).hva else
if  bn == RTHBar + start + 6 then TestPro(RTHBar,  start + 6).hva else
if  bn == RTHBar + start + 7 then TestPro(RTHBar,  start + 7).hva else
if  bn == RTHBar + start + 8 then TestPro(RTHBar,  start + 8).hva else
if  bn == RTHBar + start + 9 then TestPro(RTHBar,  start + 9).hva else
if  bn == RTHBar + start + 10 then TestPro(RTHBar,  start + 10).hva else
if  bn == RTHBar + start + 11 then TestPro(RTHBar,  start + 11).hva else
if  bn == RTHBar + start + 12 then TestPro(RTHBar,  start + 12).hva else
if  bn == RTHBar + start + 13 then TestPro(RTHBar,  start + 13).hva else
if  bn == RTHBar + start + 14 then TestPro(RTHBar,  start + 14).hva else
if  bn == RTHBar + start + 15 then TestPro(RTHBar,  start + 15).hva else
if  bn == RTHBar + start + 16 then TestPro(RTHBar,  start + 16).hva else
if  bn == RTHBar + start + 17 then TestPro(RTHBar,  start + 17).hva else
if  bn == RTHBar + start + 18 then TestPro(RTHBar,  start + 18).hva else
if  bn == RTHBar + start + 19 then TestPro(RTHBar,  start + 19).hva else
if  bn == RTHBar + start + 20 then TestPro(RTHBar,  start + 20).hva else
if  bn == RTHBar + start + 21 then TestPro(RTHBar,  start + 21).hva else
if  bn == RTHBar + start + 22 then TestPro(RTHBar,  start + 22).hva else
if  bn == RTHBar + start + 23 then TestPro(RTHBar,  start + 23).hva else
if  bn == RTHBar + start + 24 then TestPro(RTHBar,  start + 24).hva else
if  bn == RTHBar + start + 25 then TestPro(RTHBar,  start + 25).hva else
if  bn == RTHBar + start + 26 then TestPro(RTHBar,  start + 26).hva else
if  bn == RTHBar + start + 27 then TestPro(RTHBar,  start + 27).hva else
if  bn == RTHBar + start + 28 then TestPro(RTHBar,  start + 28).hva else
if  bn == RTHBar + start + 29 then TestPro(RTHBar,  start + 29).hva else
if  bn == RTHBar + start + 30 then TestPro(RTHBar,  start + 30).hva else
if  bn == RTHBar + start + 31 then TestPro(RTHBar,  start + 31).hva else
if  bn == RTHBar + start + 32 then TestPro(RTHBar,  start + 32).hva else
if  bn == RTHBar + start + 33 then TestPro(RTHBar,  start + 33).hva else
if  bn == RTHBar + start + 34 then TestPro(RTHBar,  start + 34).hva else
if  bn == RTHBar + start + 35 then TestPro(RTHBar,  start + 35).hva else
if  bn == RTHBar + start + 36 then TestPro(RTHBar,  start + 36).hva else
if  bn == RTHBar + start + 37 then TestPro(RTHBar,  start + 37).hva else
if  bn == RTHBar + start + 38 then TestPro(RTHBar,  start + 38).hva else
if  bn == RTHBar + start + 39 then TestPro(RTHBar,  start + 39).hva else
if  bn == RTHBar + start + 40 then TestPro(RTHBar,  start + 40).hva else
if  bn == RTHBar + start + 41 then TestPro(RTHBar,  start + 41).hva else
if  bn == RTHBar + start + 42 then TestPro(RTHBar,  start + 42).hva else
if  bn == RTHBar + start + 43 then TestPro(RTHBar,  start + 43).hva else
if  bn == RTHBar + start + 44 then TestPro(RTHBar,  start + 44).hva else
if  bn == RTHBar + start + 45 then TestPro(RTHBar,  start + 45).hva else
if  bn == RTHBar + start + 46 then TestPro(RTHBar,  start + 46).hva else
if  bn == RTHBar + start + 47 then TestPro(RTHBar,  start + 47).hva else
if  bn == RTHBar + start + 48 then TestPro(RTHBar,  start + 48).hva else
if  bn == RTHBar + start + 49 then TestPro(RTHBar,  start + 49).hva else
if  bn == RTHBar + start + 50 then TestPro(RTHBar,  start + 50).hva else
if  bn == RTHBar + start + 51 then TestPro(RTHBar,  start + 51).hva else
if  bn == RTHBar + start + 52 then TestPro(RTHBar,  start + 52).hva else
if  bn == RTHBar + start + 53 then TestPro(RTHBar,  start + 53).hva else
if  bn == RTHBar + start + 54 then TestPro(RTHBar,  start + 54).hva else
if  bn == RTHBar + start + 55 then TestPro(RTHBar,  start + 55).hva else
if  bn == RTHBar + start + 56 then TestPro(RTHBar,  start + 56).hva else
if  bn == RTHBar + start + 57 then TestPro(RTHBar,  start + 57).hva else
if  bn == RTHBar + start + 58 then TestPro(RTHBar,  start + 58).hva else
if  bn == RTHBar + start + 59 then TestPro(RTHBar,  start + 59).hva else
if  bn == RTHBar + start + 60 then TestPro(RTHBar,  start + 60).hva else
na;

def lva =
if  bn == RTHBar + start + 1 then TestPro(RTHBar,  start + 1).lva else
if  bn == RTHBar + start + 2 then TestPro(RTHBar,  start + 2).lva else
if  bn == RTHBar + start + 3 then TestPro(RTHBar,  start + 3).lva else
if  bn == RTHBar + start + 4 then TestPro(RTHBar,  start + 4).lva else
if  bn == RTHBar + start + 5 then TestPro(RTHBar,  start + 5).lva else
if  bn == RTHBar + start + 6 then TestPro(RTHBar,  start + 6).lva else
if  bn == RTHBar + start + 7 then TestPro(RTHBar,  start + 7).lva else
if  bn == RTHBar + start + 8 then TestPro(RTHBar,  start + 8).lva else
if  bn == RTHBar + start + 9 then TestPro(RTHBar,  start + 9).lva else
if  bn == RTHBar + start + 10 then TestPro(RTHBar,  start + 10).lva else
if  bn == RTHBar + start + 11 then TestPro(RTHBar,  start + 11).lva else
if  bn == RTHBar + start + 12 then TestPro(RTHBar,  start + 12).lva else
if  bn == RTHBar + start + 13 then TestPro(RTHBar,  start + 13).lva else
if  bn == RTHBar + start + 14 then TestPro(RTHBar,  start + 14).lva else
if  bn == RTHBar + start + 15 then TestPro(RTHBar,  start + 15).lva else
if  bn == RTHBar + start + 16 then TestPro(RTHBar,  start + 16).lva else
if  bn == RTHBar + start + 17 then TestPro(RTHBar,  start + 17).lva else
if  bn == RTHBar + start + 18 then TestPro(RTHBar,  start + 18).lva else
if  bn == RTHBar + start + 19 then TestPro(RTHBar,  start + 19).lva else
if  bn == RTHBar + start + 20 then TestPro(RTHBar,  start + 20).lva else
if  bn == RTHBar + start + 21 then TestPro(RTHBar,  start + 21).lva else
if  bn == RTHBar + start + 22 then TestPro(RTHBar,  start + 22).lva else
if  bn == RTHBar + start + 23 then TestPro(RTHBar,  start + 23).lva else
if  bn == RTHBar + start + 24 then TestPro(RTHBar,  start + 24).lva else
if  bn == RTHBar + start + 25 then TestPro(RTHBar,  start + 25).lva else
if  bn == RTHBar + start + 26 then TestPro(RTHBar,  start + 26).lva else
if  bn == RTHBar + start + 27 then TestPro(RTHBar,  start + 27).lva else
if  bn == RTHBar + start + 28 then TestPro(RTHBar,  start + 28).lva else
if  bn == RTHBar + start + 29 then TestPro(RTHBar,  start + 29).lva else
if  bn == RTHBar + start + 30 then TestPro(RTHBar,  start + 30).lva else
if  bn == RTHBar + start + 31 then TestPro(RTHBar,  start + 31).lva else
if  bn == RTHBar + start + 32 then TestPro(RTHBar,  start + 32).lva else
if  bn == RTHBar + start + 33 then TestPro(RTHBar,  start + 33).lva else
if  bn == RTHBar + start + 34 then TestPro(RTHBar,  start + 34).lva else
if  bn == RTHBar + start + 35 then TestPro(RTHBar,  start + 35).lva else
if  bn == RTHBar + start + 36 then TestPro(RTHBar,  start + 36).lva else
if  bn == RTHBar + start + 37 then TestPro(RTHBar,  start + 37).lva else
if  bn == RTHBar + start + 38 then TestPro(RTHBar,  start + 38).lva else
if  bn == RTHBar + start + 39 then TestPro(RTHBar,  start + 39).lva else
if  bn == RTHBar + start + 40 then TestPro(RTHBar,  start + 40).lva else
if  bn == RTHBar + start + 41 then TestPro(RTHBar,  start + 41).lva else
if  bn == RTHBar + start + 42 then TestPro(RTHBar,  start + 42).lva else
if  bn == RTHBar + start + 43 then TestPro(RTHBar,  start + 43).lva else
if  bn == RTHBar + start + 44 then TestPro(RTHBar,  start + 44).lva else
if  bn == RTHBar + start + 45 then TestPro(RTHBar,  start + 45).lva else
if  bn == RTHBar + start + 46 then TestPro(RTHBar,  start + 46).lva else
if  bn == RTHBar + start + 47 then TestPro(RTHBar,  start + 47).lva else
if  bn == RTHBar + start + 48 then TestPro(RTHBar,  start + 48).lva else
if  bn == RTHBar + start + 49 then TestPro(RTHBar,  start + 49).lva else
if  bn == RTHBar + start + 50 then TestPro(RTHBar,  start + 50).lva else
if  bn == RTHBar + start + 51 then TestPro(RTHBar,  start + 51).lva else
if  bn == RTHBar + start + 52 then TestPro(RTHBar,  start + 52).lva else
if  bn == RTHBar + start + 53 then TestPro(RTHBar,  start + 53).lva else
if  bn == RTHBar + start + 54 then TestPro(RTHBar,  start + 54).lva else
if  bn == RTHBar + start + 55 then TestPro(RTHBar,  start + 55).lva else
if  bn == RTHBar + start + 56 then TestPro(RTHBar,  start + 56).lva else
if  bn == RTHBar + start + 57 then TestPro(RTHBar,  start + 57).lva else
if  bn == RTHBar + start + 58 then TestPro(RTHBar,  start + 58).lva else
if  bn == RTHBar + start + 59 then TestPro(RTHBar,  start + 59).lva else
if  bn == RTHBar + start + 60 then TestPro(RTHBar,  start + 60).lva else
na;

def poc =
if  bn == RTHBar + start + 1 then TestPro(RTHBar,  start + 1).poc else
if  bn == RTHBar + start + 2 then TestPro(RTHBar,  start + 2).poc else
if  bn == RTHBar + start + 3 then TestPro(RTHBar,  start + 3).poc else
if  bn == RTHBar + start + 4 then TestPro(RTHBar,  start + 4).poc else
if  bn == RTHBar + start + 5 then TestPro(RTHBar,  start + 5).poc else
if  bn == RTHBar + start + 6 then TestPro(RTHBar,  start + 6).poc else
if  bn == RTHBar + start + 7 then TestPro(RTHBar,  start + 7).poc else
if  bn == RTHBar + start + 8 then TestPro(RTHBar,  start + 8).poc else
if  bn == RTHBar + start + 9 then TestPro(RTHBar,  start + 9).poc else
if  bn == RTHBar + start + 10 then TestPro(RTHBar,  start + 10).poc else
if  bn == RTHBar + start + 11 then TestPro(RTHBar,  start + 11).poc else
if  bn == RTHBar + start + 12 then TestPro(RTHBar,  start + 12).poc else
if  bn == RTHBar + start + 13 then TestPro(RTHBar,  start + 13).poc else
if  bn == RTHBar + start + 14 then TestPro(RTHBar,  start + 14).poc else
if  bn == RTHBar + start + 15 then TestPro(RTHBar,  start + 15).poc else
if  bn == RTHBar + start + 16 then TestPro(RTHBar,  start + 16).poc else
if  bn == RTHBar + start + 17 then TestPro(RTHBar,  start + 17).poc else
if  bn == RTHBar + start + 18 then TestPro(RTHBar,  start + 18).poc else
if  bn == RTHBar + start + 19 then TestPro(RTHBar,  start + 19).poc else
if  bn == RTHBar + start + 20 then TestPro(RTHBar,  start + 20).poc else
if  bn == RTHBar + start + 21 then TestPro(RTHBar,  start + 21).poc else
if  bn == RTHBar + start + 22 then TestPro(RTHBar,  start + 22).poc else
if  bn == RTHBar + start + 23 then TestPro(RTHBar,  start + 23).poc else
if  bn == RTHBar + start + 24 then TestPro(RTHBar,  start + 24).poc else
if  bn == RTHBar + start + 25 then TestPro(RTHBar,  start + 25).poc else
if  bn == RTHBar + start + 26 then TestPro(RTHBar,  start + 26).poc else
if  bn == RTHBar + start + 27 then TestPro(RTHBar,  start + 27).poc else
if  bn == RTHBar + start + 28 then TestPro(RTHBar,  start + 28).poc else
if  bn == RTHBar + start + 29 then TestPro(RTHBar,  start + 29).poc else
if  bn == RTHBar + start + 30 then TestPro(RTHBar,  start + 30).poc else
if  bn == RTHBar + start + 31 then TestPro(RTHBar,  start + 31).poc else
if  bn == RTHBar + start + 32 then TestPro(RTHBar,  start + 32).poc else
if  bn == RTHBar + start + 33 then TestPro(RTHBar,  start + 33).poc else
if  bn == RTHBar + start + 34 then TestPro(RTHBar,  start + 34).poc else
if  bn == RTHBar + start + 35 then TestPro(RTHBar,  start + 35).poc else
if  bn == RTHBar + start + 36 then TestPro(RTHBar,  start + 36).poc else
if  bn == RTHBar + start + 37 then TestPro(RTHBar,  start + 37).poc else
if  bn == RTHBar + start + 38 then TestPro(RTHBar,  start + 38).poc else
if  bn == RTHBar + start + 39 then TestPro(RTHBar,  start + 39).poc else
if  bn == RTHBar + start + 40 then TestPro(RTHBar,  start + 40).poc else
if  bn == RTHBar + start + 41 then TestPro(RTHBar,  start + 41).poc else
if  bn == RTHBar + start + 42 then TestPro(RTHBar,  start + 42).poc else
if  bn == RTHBar + start + 43 then TestPro(RTHBar,  start + 43).poc else
if  bn == RTHBar + start + 44 then TestPro(RTHBar,  start + 44).poc else
if  bn == RTHBar + start + 45 then TestPro(RTHBar,  start + 45).poc else
if  bn == RTHBar + start + 46 then TestPro(RTHBar,  start + 46).poc else
if  bn == RTHBar + start + 47 then TestPro(RTHBar,  start + 47).poc else
if  bn == RTHBar + start + 48 then TestPro(RTHBar,  start + 48).poc else
if  bn == RTHBar + start + 49 then TestPro(RTHBar,  start + 49).poc else
if  bn == RTHBar + start + 50 then TestPro(RTHBar,  start + 50).poc else
if  bn == RTHBar + start + 51 then TestPro(RTHBar,  start + 51).poc else
if  bn == RTHBar + start + 52 then TestPro(RTHBar,  start + 52).poc else
if  bn == RTHBar + start + 53 then TestPro(RTHBar,  start + 53).poc else
if  bn == RTHBar + start + 54 then TestPro(RTHBar,  start + 54).poc else
if  bn == RTHBar + start + 55 then TestPro(RTHBar,  start + 55).poc else
if  bn == RTHBar + start + 56 then TestPro(RTHBar,  start + 56).poc else
if  bn == RTHBar + start + 57 then TestPro(RTHBar,  start + 57).poc else
if  bn == RTHBar + start + 58 then TestPro(RTHBar,  start + 58).poc else
if  bn == RTHBar + start + 59 then TestPro(RTHBar,  start + 59).poc else
if  bn == RTHBar + start + 60 then TestPro(RTHBar,  start + 60).poc else
na;

plot
LoVA = if   bn > HighestAll(RTHBar)
       then lva else na;
plot
HiVA = if   bn > HighestAll(RTHBar)
       then hva else na;
plot
PointOfControl = if   bn > HighestAll(RTHBar)
                 then poc else na;

LoVA.SetDefaultColor(Color.VIOLET);
LoVA.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
LoVA.EnableApproximation();
LoVA.SetLineWeight(2);
HiVA.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
HiVA.SetDefaultColor(Color.VIOLET);
HiVA.EnableApproximation();
HiVA.SetLineWeight(2);
PointOfControl.SetDefaultColor(Color.YELLOW);
PointOfControl.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
PointOfControl.EnableApproximation();
PointOfControl.SetLineWeight(2);

AddCloud(close, PointOfControl, color1 = Color.GREEN, showBorder = yes);

#POC Variance to Close
input label_VAR = no;
AddLabel(label_VAR, "Close: " + AsText(close) + " POC: " + AsText(PointOfControl) + " %Var: " + AsPercent((close - PointOfControl) / PointOfControl), if close > PointOfControl then Color.GREEN else if close < PointOfControl then Color.RED else Color.WHITE);


#Cloud - Close Proximity to Pointofcontrol
input showcloud = yes;
def rthrs = Between(GetTime(), RegularTradingStart(GetYYYYMMDD()),
                    RegularTradingEnd(GetYYYYMMDD()));
def crossbn     = if close crosses PointOfControl then bn else Double.NaN;
def touch       = Between(PointOfControl, low, high);
AddCloud(if showcloud and !touch and bn >= HighestAll(crossbn)
         then close
         else Double.NaN,
         PointOfControl,
         Color.GREEN, Color.RED);

#Vertical lines when close crosses POC
input showvertical = yes;
AddVerticalLine(showvertical and rthrs and close crosses PointOfControl,
                "",
                if close crosses above PointOfControl
                then Color.GREEN
                else Color.RED, stroke = Curve.FIRM);
;

#Bubble POC Variance to close
input bubble_VAR   = yes;
input bubbleoffset = 1;

AddChartBubble(rthrs and bubble_VAR and RTHBar > start,
               low - bubbleoffset * TickSize(),
               AsPercent((close - PointOfControl) / PointOfControl),
               if close > PointOfControl then Color.GREEN
               else if close < PointOfControl
               then Color.RED else Color.WHITE, no);


#Buying/Selling Pressure
input length = 10;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying  = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def Delt    = Buying - Selling;

#Delta
plot Delta = Delt;
Delta.AssignValueColor(if Delta > 0 then Color.GREEN else Color.RED);
Delta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Delta.Hide();

#Bubble Delta
input bubble_delta = yes;
AddChartBubble(rthrs and bubble_delta and !IsNaN(close) and RTHBar > start, low - bubbleoffset * TickSize(),
               if AbsValue(Delta) > 1000
               then Round(Delta / 1000, 0) + "k"
               else Delta + "",
               Delta.TakeValueColor(), no);

#Delta Average for avg_length input bars, excluding the current bar
input label_delta_avg = yes;
input avglength       = 3;
def   delta_avg       = Sum(Delta[1], avglength) / avglength;
AddLabel(label_delta_avg, " ", Color.BLACK);
AddLabel(label_delta_avg,
        "Delta Avg " + avglength + " bars: " +
        (if AbsValue(delta_avg) > 1000
         then Round(delta_avg / 1000, 0) + "k"
         else delta_avg + ""),
         if delta_avg > 0 then Color.GREEN else Color.RED);

#Delta Spike
input showspike = yes;
input spike     = 200000;

plot delta_spike = if !showspike then Double.NaN
                   else if Delta > +spike
                   then high
                   else if Delta < -spike
                   then low else 0;
delta_spike.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
delta_spike.SetDefaultColor(Color.YELLOW);
delta_spike.SetLineWeight(5);

#Cumulative Delta
def CumulativeVolumeDelta = Sum(Delta, length);
input pricecolor = yes;
AssignPriceColor(if !pricecolor then Color.CURRENT else
                 if CumulativeVolumeDelta > 0
                 then Color.GREEN               
                 else Color.RED);
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
453 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