Trading Articles
Article Categories
Article Tools

Find H and L between last 3 bars every 3 bars
Updated March 19, 2023
trending_up
631 views
thumb_up
0 thanks given
group
3 followers
forum
5 posts
attach_file
1 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members

Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to

register in order to view the content of the threads and start contributing to our community.

It's free and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)

Find H and L between last 3 bars every 3 bars

(login for full post details)

#1 (permalink )
Colombia

Posts: 11 since Mar 2021

Thanks: 1 given,
1
received

Hello everyone,
I need your help with a code that finds the HIGH and LOW between the last 3 bars ( red boxes ) and the next 3 bars without taking into account the previous 3 as shown in the figure. To perform the following calculation.
S = (4*X + 3*X[1] + 2*X[2] + X[3])
I have tried but I have not found a solution. Thank you for your time.

Can you help answer these questions from other members on futures io?

Best Threads (Most Thanked) in the last 7 days on futures io

(login for full post details)

#2 (permalink )
Posts: 3,503 since Jul 2012

Thanks: 1,838 given,
7,059
received

Not sure if this is what you are looking for... (not checked)
var :X(0),X1(0),X2(0),X3(0),X4(0);
X=(maxlist(high,high[1])+minlist(low,low[1]))/2.
X1=(maxlist(high[2],high[3],high[4])+minlist(low[2],low[3],low[4]))/2.
X2=(maxlist(high[5],high[6],high[7])+minlist(low[5],low[6],low[7]))/2.
X3=(maxlist(high[8],high[9],high[10])+minlist(low[8],low[9],low[10]))/2.
X4=(maxlist(high[11],high[12],high[13])+minlist(low[11],low[12],low[13]))/2.

(login for full post details)

#3 (permalink )
Colombia

Posts: 11 since Mar 2021

Thanks: 1 given,
1
received

Kevin thanks for your time, maybe my explanation was no the better,
Attached new imagen explaining better,
the first imagen (red boxes) was hand draw.
The idea is to find the Highest and Lowest in the 3x bars interval formed , like you can see in the pic.
calculate and storage ‘X’ to get data .....X, X[1], X[2]........ so on.
You can see part of code.
Where: X ‘Variable to store, ” it can be another letter , X= (H+L)/2
H= Highest of 3 bars interval
L= Lowest of 3 bars interval
// -----------------------------------------------
Vars: X(0), S(0), D(0);
X= (H+L)/0.5;
If CurrentBar > 5 Then Begin
S = (4*X + 3*X[1] + 2*X[2] + X[3]) / 10; // Calculate S with X[1],.......X[3]
D = (.0962*S + .5769*S[2] - .5769*S[4]- .0962*S[6]); // Calculate D with S[1],.......S[6]
{……….. part of the code.
.........
}
End;
//-----------------------------------------
Regards,
Carlos
I
kevinkdog
Not sure if this is what you are looking for... (not checked)

var :X(0),X1(0),X2(0),X3(0),X4(0);

X=(maxlist(high,high[1])+minlist(low,low[1]))/2.

X1=(maxlist(high[2],high[3],high[4])+minlist(low[2],low[3],low[4]))/2.

X2=(maxlist(high[5],high[6],high[7])+minlist(low[5],low[6],low[7]))/2.

X3=(maxlist(high[8],high[9],high[10])+minlist(low[8],low[9],low[10]))/2.

X4=(maxlist(high[11],high[12],high[13])+minlist(low[11],low[12],low[13]))/2.

(login for full post details)

#4 (permalink )
Posts: 3,503 since Jul 2012

Thanks: 1,838 given,
7,059
received

Sorry, I am unclear what you want. Maybe someone else will understand.

(login for full post details)

#5 (permalink )
Colombia

Posts: 11 since Mar 2021

Thanks: 1 given,
1
received

Hi Kevin,
For example, if I have a 5 minutes chart, 3 bars in the that interval are 1 bar in a 15 min chart. Then H and L in 15 min chart, is the same the H and L en 5 min chat ( 3 bars x 5 min).
I want to find the H and L for 15 min bar, but in the 5 min chart. for that the 3 bars interval.
I hope you can help me, please.
thank you,
kevinkdog
Sorry, I am unclear what you want. Maybe someone else will understand.

(login for full post details)

#6 (permalink )
Taipei ,Taiwan

Posts: 2 since Apr 2021

Thanks: 42 given,
0
received

Carlera
Kevin thanks for your time, maybe my explanation was no the better,
Attached new imagen explaining better,
the first imagen (red boxes) was hand draw.
The idea is to find the Highest and Lowest in the 3x bars interval formed , like you can see in the pic.
calculate and storage ‘X’ to get data .....X, X[1], X[2]........ so on.
You can see part of code.
Where: X ‘Variable to store, ” it can be another letter , X= (H+L)/2
H= Highest of 3 bars interval
L= Lowest of 3 bars interval
// -----------------------------------------------
Vars: X(0), S(0), D(0);
X= (H+L)/0.5;
If CurrentBar > 5 Then Begin
S = (4*X + 3*X[1] + 2*X[2] + X[3]) / 10; // Calculate S with X[1],.......X[3]
D = (.0962*S + .5769*S[2] - .5769*S[4]- .0962*S[6]); // Calculate D with S[1],.......S[6]
{……….. part of the code.
.........
}
End;
//-----------------------------------------
Regards,
Carlos
I

x=(highest(h[1],3)+lowest(L[1],3))/2
S = (4*X + 3*X[3] + 2*X[6] + X[9]) / 10
or
inputs: n(3," bars interval"),n1(1200,"total bars");
var : i(0),j(0);
array: x[400](0),s[400](0);
If CurrentBar > 5 Then Begin
for i=0 to floor(n1/n) // keep integer
x[i]=(highest(h[n*I+1],n)+lowest(L[n*i+1],n))/2;
for i=0 to floor(n1/n)
begin
for j= n+1 downTo 1
s[i]=s[i]+j*x[n+1-j];
s[i]=s[i]/((n+2)*(n+1)/2); //wma
end ;
end;
D = (.0962*S[0] + .5769*S[2] - .5769*S[4]- .0962*S[6]); // Calculate D with S[1],.......S[6]
{……….. part of the code.
.........
}
End;

Last Updated on March 19, 2023

Ongoing