Buyer Momentum Indicator

Adeodatus

Member
Hope someone can take this to operable level. sort through volume, then strategy to single out the runners as market opens.

This line : {Data.assignValueColor (if Data between 80 and 100 then color.green else color.red;} does not compute.

#VolumemBuyer Momentum Indication

#/ Buyer Momentum Indicator
input Length = 14;
def Result = (fold i = 0 to Length - 1 with z do z + GetValue( close, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if Data between 80 and 100 then color.green else color.red;
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();
 

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

Thanks Svanoy, made it look too easy... here is the study result.

Follows the price action, averages it and stamps that value to bottom wick on each candle. I narrowed it down to 20 period period. This does not forecast or predict anything and is more for buyer price monitoring when its green, going into overbought when red


Code:

#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator

#declare lower;

input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 10, 90) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();
 
Thanks Svanoy, made it look too easy... here is the study result.

Follows the price action, averages it and stamps that value to bottom wick each candle on upper chart as coded. I narrowed it down to 20 periods. This does not forecast or predict anything and is the buyer price monitoring, so in the lower chart you see changes, its green, going into overbought red, then whenever volume continues over 100 as peribolic move, indicator is green again.

chart Code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator
#declare lower;
input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 10, 90) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();

lower code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator

declare lower;

input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 80, 100) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();
 
Thanks Svanoy, made it look too easy... here is the study result.

Follows the price action, averages it and stamps that value to bottom wick each candle on upper chart as coded. I narrowed it down to 20 periods. This does not forecast or predict anything and is the buyer price monitoring, so in the lower chart you see changes, its green, going into overbought red, then whenever volume continues over 100 as peribolic move, indicator is green again.

chart Code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator
#declare lower;
input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 10, 90) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();

lower code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator

declare lower;

input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 80, 100) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();


first let me say, congrats on figuring out how to use a fold loop


there are a few things not quite right with your studies in post 5, so i am writing this, to ask you for feedback.
i don't mean to criticize, i just think you are confused and don't fully understand what you are trying to do. maybe you posted the wrong code?
also, i want to let others know, who may try your studies and get confused.

------------------------

all your code does is make an incorrect average of open and multiply it by 100, then plot a huge histogram...?
there is nothing to interpret from this.


what did you intend to do ?

i'm wondering if you meant to create a percentage number?
maybe based on the current open compared to the previous average?



in the future please verify and test your code before posting, unless you are asking questions.

please post code in a code window
in the header of a new post, there is a symbol,
</>
that will open a window for pasting code into. it doesn't matter what type you select, they just color the words differently. ruby seems to be a close fit.


stamp a value ? this has no meaning. nothing is near the bottom wick on the chart.

with the *100 formula, all the values with be way above the candles.
the upper study draws a huge red histogram that covers the chart.

yHy4dP1.jpg



buyer price monitoring, VolumemBuyer Momentum ? , these have no meaning.
a study can't read time and sales data, so it has no idea of buyer and seller data.


you mention volume, but volume is not used in the study?


your upper code from post5

Code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator
#declare lower;
input Length = 20;
def Result = (fold i = 0 to Length -1
 with z
 do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 10, 90) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();


a fold loop doesn't evaluate the final number in the to parameter, it stops 1 number before it.
so
. fold i = 0 to 20
will start at 0 and count up to 19, then stop, for a total of 20 loops.

if you use
. input Length = 20;
. def Result = fold i = 0 to Length -1

which is the same as
. . def Result = fold i = 0 to 19

then it will count from 0 up to 18 and stop , for a total of 19 loops


all your code is doing is,
. adding up 19 open prices,
. divide that total by 20,
. multiplying it by 100


this will give you the average of 20 opens
def result = average(open, length);


the coloring formula doesn't make any sense for the data , between 10 and 90?
green histo bars will only show up for stocks < $1



here is a test code to experiment with, to verify how many times a fold loops (iterates).
s starts at 0, it does 8 loops, so q ends up with 8.
it plots bubbles with a 8

Code:
def len = 10;
def q = fold r = 1 to (Len - 1)
with s
do s + 1;
addchartbubble(1, low, q, color.yellow, no);
# plots bubbles with a 8
 
Last edited:
Thanks Svanoy, made it look too easy... here is the study result.

Follows the price action, averages it and stamps that value to bottom wick each candle on upper chart as coded. I narrowed it down to 20 periods. This does not forecast or predict anything and is the buyer price monitoring, so in the lower chart you see changes, its green, going into overbought red, then whenever volume continues over 100 as peribolic move, indicator is green again.

chart Code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator
#declare lower;
input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 10, 90) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();

lower code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator

declare lower;

input Length = 20;
def Result = (fold i = 0 to Length -1 with z do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 80, 100) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();


here is a lower study, to experiment with.
it compares the current open to an average,
and calculates the % difference,
and plots that as a histogram.


Code:
# open_avg_loop_00b_lower

#https://usethinkscript.com/threads/buyer-momentum-indicator.14348/
# Buyer Momentum Indicator
# Adeodatus  2/5


declare lower;

input Length = 20;
# get the average of open, starting with the previous bar
def openavg = average(open[1], length);

# compare the current open to the average as a %
def per = 100*((open - openavg)/openavg);


plot Data = per;
Data.assignValueColor (if data > 0 then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();
#

2cXmvzK.jpg
 
first let me say, congrats on figuring out how to use a fold loop


there are a few things not quite right with your studies in post 5, so i am writing this, to ask you for feedback.
i don't mean to criticize, i just think you are confused and don't fully understand what you are trying to do. maybe you posted the wrong code?
also, i want to let others know, who may try your studies and get confused.

------------------------

all your code does is make an incorrect average of open and multiply it by 100, then plot a huge histogram...?
there is nothing to interpret from this.


what did you intend to do ?

i'm wondering if you meant to create a percentage number?
maybe based on the current open compared to the previous average?



in the future please verify and test your code before posting, unless you are asking questions.

please post code in a code window
in the header of a new post, there is a symbol,
</>
that will open a window for pasting code into. it doesn't matter what type you select, they just color the words differently. ruby seems to be a close fit.


stamp a value ? this has no meaning. nothing is near the bottom wick on the chart.

with the *100 formula, all the values with be way above the candles.
the upper study draws a huge red histogram that covers the chart.

yHy4dP1.jpg



buyer price monitoring, VolumemBuyer Momentum ? , these have no meaning.
a study can't read time and sales data, so it has no idea of buyer and seller data.


you mention volume, but volume is not used in the study?


your upper code from post5

Code:
#VolumemBuyer Momentum Indication
#/ Buyer Momentum Indicator
#declare lower;
input Length = 20;
def Result = (fold i = 0 to Length -1
 with z
 do z + GetValue( open, i)) / Length;
plot Data = Result * 100;
Data.assignValueColor (if between (Data, 10, 90) then color.green else color.red);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Data.SetLineWeight(3);
Data.HideBubble();


a fold loop doesn't evaluate the final number in the to parameter, it stops 1 number before it.
so
. fold i = 0 to 20
will start at 0 and count up to 19, then stop, for a total of 20 loops.

if you use
. input Length = 20;
. def Result = fold i = 0 to Length -1

which is the same as
. . def Result = fold i = 0 to 19

then it will count from 0 up to 18 and stop , for a total of 19 loops


all your code is doing is,
. adding up 19 open prices,
. divide that total by 20,
. multiplying it by 100


this will give you the average of 20 opens
def result = average(open, length);


the coloring formula doesn't make any sense for the data , between 10 and 90?
green histo bars will only show up for stocks < $1



here is a test code to experiment with, to verify how many times a fold loops (iterates).
s starts at 0, it does 8 loops, so q ends up with 8.
it plots bubbles with a 8

Code:
def len = 10;
def q = fold r = 1 to (Len - 1)
with s
do s + 1;
addchartbubble(1, low, q, color.yellow, no);
# plots bubbles with a 8
okay thanks Halc, touched on Fold?-loops back in high school, except we had "no" the computer, so its guessed at.
And the other things, it takes very long to find the correct sequence and interval, and variance. . . its still only another indicator in garage.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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