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