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

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

Hi Giok,

you would have to provide more information as we can't see the debug files you created that make you think the code does not compute a value for hh.

Using the following code in an indicator works fine on my end.
 
Code
input: N(4);
var: K(0), hh_barsback(0),hh(0);

HH = 0;

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

Plot1( HH, "HH" ) ;
Regards,

ABCTG


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


Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Tao te Trade: way of the WLD
24 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #22 (permalink)
cactus1973
Canicattė Italy
 
Posts: 15 since Nov 2018
Thanks Given: 0
Thanks Received: 0

Hi ABCTG,

Putting the code in an indicator it works, i've tried. Like signal it does not work, i don't understand the reason.
I attached the debug file.

Regards,

Gioak

Attached Files
Elite Membership required to download: test.txt
Reply With Quote
  #23 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


Hi Giok,

in general the code should give you the same results in both indicator and strategy and the code from my previous post works fine within a strategy on my end.
You can utilize i_SetPlotValue and i_GetPlotValue to exchange values between a strategy and an indicator on the same chart and plot the values. This can help in tracking differences down.

Regards,

ABCTG


cactus1973 View Post
Hi ABCTG,

Putting the code in an indicator it works, i've tried. Like signal it does not work, i don't understand the reason.
I attached the debug file.

Regards,

Gioak


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


ABCTG View Post
Hi Giok,

in general the code should give you the same results in both indicator and strategy and the code from my previous post works fine within a strategy on my end.
You can utilize i_SetPlotValue and i_GetPlotValue to exchange values between a strategy and an indicator on the same chart and plot the values. This can help in tracking differences down.

Regards,

ABCTG

Hi ABCTG, thank you for your seggestion, i've tried the code like indicator and it works,even if it doesn't calculate what it should be.
This is the what i've elaborated, how you can see it does not work.

Regards
Gioak

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

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

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;
If hh <> 0 then begin
IF C[1] < hh and C > hh then buy next bar at market;
IF marketposition > 0 then hh = 0;
end;
Setstopcontract;
setstoploss(MyStop);

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

Hi Gioak,

as previously suggested, check your values for Lsetup as they might prevent the code from finding values on bars you are checking.
You might also want to consider if it could make sense to store the value of 'hh' in an additional variable, which only gets reset
after an entry.

Regards,

ABCTG



cactus1973 View Post
Hi ABCTG, thank you for your seggestion, i've tried the code like indicator and it works,even if it doesn't calculate what it should be.
This is the what i've elaborated, how you can see it does not work.

Regards
Gioak

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

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

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;
If hh <> 0 then begin
IF C[1] < hh and C > hh then buy next bar at market;
IF marketposition > 0 then hh = 0;
end;
Setstopcontract;
setstoploss(MyStop);


Follow me on Twitter 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