NexusFi: Find Your Edge


Home Menu

 





Find H and L between last 3 bars every 3 bars


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,043 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 1 attachments




 
Search this Thread

Find H and L between last 3 bars every 3 bars

  #1 (permalink)
Carlera
Colombia
 
Posts: 13 since Mar 2021
Thanks Given: 1
Thanks Received: 1

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.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Discipline isnt about fortitude. Its about conviction!
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
66 thanks
Self sabotage reframed
15 thanks
GFIs1 1 DAX trade per day journal
15 thanks
Trading with Intuition
14 thanks
The Trading Pit "Futures VIP" Account Journal
12 thanks
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,361

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.

Follow me on Twitter Reply With Quote
  #3 (permalink)
Carlera
Colombia
 
Posts: 13 since Mar 2021
Thanks Given: 1
Thanks Received: 1


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


Reply With Quote
  #4 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,361

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

Follow me on Twitter Reply With Quote
  #5 (permalink)
Carlera
Colombia
 
Posts: 13 since Mar 2021
Thanks Given: 1
Thanks Received: 1

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 View Post
Sorry, I am unclear what you want. Maybe someone else will understand.


Reply With Quote
  #6 (permalink)
alan tsai
Taipei ,Taiwan
 
Posts: 3 since Apr 2021
Thanks Given: 44
Thanks Received: 0


Carlera View Post
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;

Reply With Quote




Last Updated on March 19, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts