How to count the cumulative total of bars or the consecutive number of bars on the entire chart and/or the same day
To count your study you simply just have to alter ONE line. You alter the "def = VAR" line.
For this example we will use the number of bars that he close is greater than the open (number of green bars)
the default is:
NOTE: "VAR" aka the variable can be changed to the defined study/pattern you want counted.
Remember to leave a thumbs up if you found this post useful
COUNT OF THE TOTAL NUMBER OF CONSECUTIVE GREEN BARS (CLOSE>OPEN)
CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) ON THE ENTIRE CHART
CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) ON THE ENTIRE CHART WITHIN SPECIFIED TIMEFRAME
CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) ON THE THE CURRENT DAY ONLY ( TODAYS ) CHART
COUNT OF THE CUMULATIVE OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) FROM XYZ BARS AGO
(COUNT CUMULATIVE TOTAL OF GREEN BARS FROM THE LAST / PAST XYZ BARS)
To count your study you simply just have to alter ONE line. You alter the "def = VAR" line.
For this example we will use the number of bars that he close is greater than the open (number of green bars)
the default is:
Code:
def var = close > open;
Remember to leave a thumbs up if you found this post useful
COUNT OF THE TOTAL NUMBER OF CONSECUTIVE GREEN BARS (CLOSE>OPEN)
Code:
declare lower;
# COUNT OF THE TOTAL NUMBER OF CONSECUTIVE GREEN BARS (CLOSE>OPEN)
# By XeoNoX via Usethinkscript.com
def var = close > open;
def barUpCount = CompoundValue(1, if var then barUpCount[1] + 1 else 0, 0);
AddLabel (yes, "COUNT " + barUpCount );
CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) ON THE ENTIRE CHART
Code:
declare lower;
#( CUMULATIVE ) COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN)
# ON THE ENTIRE CHART
# By XeoNoX via Usethinkscript.com
def var =close>open;
def count = totalsum(var);
plot scan = count;
AddLabel (yes, "COUNT " + (count) );
CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) ON THE ENTIRE CHART WITHIN SPECIFIED TIMEFRAME
Code:
#( CUMULATIVE ) COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN)
# ON THE ENTIRE CHART WITHIN SPECIFIED TIMEFRAME
# By XeoNoX via Usethinkscript.com
input startTime = 0930;
input endTime = 1600;
def Active = SecondsFromTime(startTime) >= 0 and SecondsTillTime(endTime) >= 0;
def var = close>open;
def cumulative = if Active and !Active[1] then var else if Active then compoundValue(1, (cumulative[1] + var), 0) else cumulative[1];
plot scan = cumulative;
addLabel(1, "Count = " + scan, color.dark_green);
scan.SetPaintingStrategy(PaintingStrategy.Values_Above);
CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) ON THE THE CURRENT DAY ONLY ( TODAYS ) CHART
Code:
declare lower;
# CUMULATIVE COUNT OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN)
# ON THE THE CURRENT DAY ONLY ( TODAYS ) CHART
# By XeoNoX via Usethinkscript.com
def Active = GetDay() == GetLastDay(); #Today
def var = close>open;
def cumulative = if Active and !Active[1] then var else if Active then cumulative[1] + var else cumulative[1];
plot scan = cumulative;
AddLabel (yes, "COUNT " + (scan), color.dark_green );
COUNT OF THE CUMULATIVE OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) FROM XYZ BARS AGO
(COUNT CUMULATIVE TOTAL OF GREEN BARS FROM THE LAST / PAST XYZ BARS)
Code:
declare lower;
#COUNT OF THE CUMULATIVE OF THE TOTAL NUMBER OF GREEN BARS (CLOSE>OPEN) FROM XYZ BARS AGO
#(COUNT CUMULATIVE TOTAL OF GREEN BARS FROM THE LAST / PAST XYZ BARS)
# By XeoNoX via Usethinkscript.com
input barsago = 15;
def var =close>open;
def count = Sum(var, barsago);
AddLabel (yes, "COUNT " + (count) );
Last edited: