NexusFi: Find Your Edge


Home Menu

 





Highest high for specific bars - easylanguage code suggestion


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 11 posts (2 thanks)
    2. looks_two cactus1973 with 10 posts (0 thanks)
    3. looks_3 edgefirst with 1 posts (1 thanks)
    4. looks_4 Kolnidrei with 1 posts (2 thanks)
    1. trending_up 8,144 views
    2. thumb_up 5 thanks given
    3. group 6 followers
    1. forum 24 posts
    2. attach_file 3 attachments




 
Search this Thread

Highest high for specific bars - easylanguage code suggestion

  #11 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi Gioak,

this was just a suggestion so that you can easily familiarize yourself with the basics, as this can be helpful in learning EasyLanguage. Once you have the simple code working, you can easily adapt it to what you have in mind.

Regards,

ABCTG

Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #12 (permalink)
 SidewalkAerobics 
Los Angels
 
Experience: Intermediate
Platform: MultiChart
Trading: Emini ES
Posts: 115 since Aug 2018
Thanks Given: 173
Thanks Received: 71

You can create an array to store the value (highest high for the last 6 bars) for every bar.

Then at a later time you can call up the X place in the array to see the highest bar for that (6 bar) subset.

If you are worried about nanoseconds in your code, this might not be the most efficient way, but it is an easy way to code.

Reply With Quote
  #13 (permalink)
Kolnidrei
Lyon/France
 
Posts: 23 since Aug 2012
Thanks Given: 1
Thanks Received: 14


If I remember well you have the functions HHV and LLV in easylanguage.
So the highest high of the last 5 bars would be HHV( H, 5 ), the lowest low LLV( L, 5 ),
the highest open HHV( O, 5 ) etc.

Reply With Quote
Thanked by:
  #14 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Kolnidrei,

HHV and LLV are part of Metastock as far as I am aware, but maybe someone created them for Tradestation as custom functions, too. However you can accomplish the same using the built-in functions Highest and Lowest i.e. Highest( High, 5 ) would give you the highest high over the last five bars in EasyLanguage.

Regards,

ABCTG


Kolnidrei View Post
If I remember well you have the functions HHV and LLV in easylanguage.
So the highest high of the last 5 bars would be HHV( H, 5 ), the lowest low LLV( L, 5 ),
the highest open HHV( O, 5 ) etc.


Follow me on Twitter Reply With Quote
  #15 (permalink)
 edgefirst 
Las Cruces, NM
 
Experience: Advanced
Platform: Tradestation, MC, NT
Broker: TradeStation, IB
Trading: Liquid futures contracts
Posts: 56 since Sep 2009
Thanks Given: 389
Thanks Received: 86

Hi Gioak,

hh will be the value you want.
hh_barsback will be the location (bars back).

 
Code
var: hh(0), hh_barsback(0);
hh = 0;
for k = 0 to N-1 begin
    if Low[k] < x and High[k] > hh then begin 
        hh = High[k];
        hh_barsback = k;
    end;
end;

Reply With Quote
Thanked by:
  #16 (permalink)
cactus1973
Canicattė Italy
 
Posts: 15 since Nov 2018
Thanks Given: 0
Thanks Received: 0

Hi edgefirst, thank you for your suggestion.. but my difficulty was in coding the command to find highest (high, 5) only among the bars previous to the current bars that have a minimum lower than the level x, that is the high of the current bar.

Gioak

Reply With Quote
  #17 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi Gioak,

this is exactly what the code @edgefirst posted provides, just replace x with High.
You would also have to make k a variable and N could be an input with the value of 5.

Regards,

ABCTG


cactus1973 View Post
Hi edgefirst, thank you for your suggestion.. but my difficulty was in coding the command to find highest (high, 5) only among the bars previous to the current bars that have a minimum lower than the level x, that is the high of the current bar.

Gioak


Follow me on Twitter Reply With Quote
Thanked by:
  #18 (permalink)
cactus1973
Canicattė Italy
 
Posts: 15 since Nov 2018
Thanks Given: 0
Thanks Received: 0

Hi ABCTG ,
I have elaborated the code following the instructions but as you can see from the output HH is not calculated, I suppose something is wrong;

input: N(4);
var:Lsetup(0), K(0), hh_barsback(0),hh(0);

IF D > D[1]then begin

Lsetup = 0;
If C < L[1] and L = lowest(low,5) then Lsetup = H ;
end;

HH = 0;
for k = 0 to N-1 begin
if Low[k] < Lsetup and High[k] > hh then begin
HH = High[k];
hh_barsback = k;
end;
end;

print(File("C:\Users\utente\Desktop\outputMulticharts\test.txt")," symbol ",symbol," date ",date:7:0,spaces(2)," time ",time:4:0,spaces(2)," spaces(3)," lsetup ",lsetup,spaces(3)," hh ",hh);

Reply With Quote
  #19 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi Gioak,

check your values for Lsetup as they might prevent the code from finding values on bars you are checking.

It might make sense to take one step back by removing the "Low[k] < Lsetup" to confirm that the code is able to find the highest high within the lookback.
Once you know that this part is working correctly you can proceed in tracking down what is not working correctly when you re-introduce "Low[k] < Lsetup" to your rules.

Regards,

ABCTG


cactus1973 View Post
Hi ABCTG ,
I have elaborated the code following the instructions but as you can see from the output HH is not calculated, I suppose something is wrong;

input: N(4);
var:Lsetup(0), K(0), hh_barsback(0),hh(0);

IF D > D[1]then begin

Lsetup = 0;
If C < L[1] and L = lowest(low,5) then Lsetup = H ;
end;

HH = 0;
for k = 0 to N-1 begin
if Low[k] < Lsetup and High[k] > hh then begin
HH = High[k];
hh_barsback = k;
end;
end;

print(File("C:\Users\utente\Desktop\outputMulticharts\test.txt")," symbol ",symbol," date ",date:7:0,spaces(2)," time ",time:4:0,spaces(2)," spaces(3)," lsetup ",lsetup,spaces(3)," hh ",hh);


Follow me on Twitter Reply With Quote
  #20 (permalink)
cactus1973
Canicattė Italy
 
Posts: 15 since Nov 2018
Thanks Given: 0
Thanks Received: 0



ABCTG View Post
Hi Gioak,

check your values for Lsetup as they might prevent the code from finding values on bars you are checking.

It might make sense to take one step back by removing the "Low[k] < Lsetup" to confirm that the code is able to find the highest high within the lookback.
Once you know that this part is working correctly you can proceed in tracking down what is not working correctly when you re-introduce "Low[k] < Lsetup" to your rules.

Regards,

ABCTG

I've tried but I think the code has some problem finding the highest high, it does not calculate hh.

If D > D[1]then begin

Lsetup = 0;
If C < L[1] and L = lowest(low,5) then Lsetup = H ;
end;

input: N(4);
var: K(0), hh_barsback(0),hh(0);


HH = 0;
for k = 0 to N-1 begin
if {Low[k] < Lsetup and} High[k] > hh then begin
HH = High[k];
hh_barsback = k;
end;
end;
print(File("C:\Users\utente\Desktop\outputMulticharts\test.txt")," symbol ",symbol," date ",date:7:0,spaces(2)," time ",time:4:0,spaces(2)," lsetup ",lsetup,spaces(3)," hh ",hh);


Regards,

Gioak

Reply With Quote




Last Updated on March 1, 2019


© 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