NexusFi: Find Your Edge


Home Menu

 





Get range of a series of bars


Discussion in MultiCharts

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




 
Search this Thread

Get range of a series of bars

  #1 (permalink)
kristian
Zurich
 
Posts: 8 since Aug 2015
Thanks Given: 4
Thanks Received: 3

Hello

I want to get the range of the bars in at a certain time. Let's say I want the range from 9-10.30. This was my first try, but obviously it doesn't give me the range of the bars as it's only looking at the 9 & 10.30 bars (and not the ones in between).

 
Code
if (Time = 0900) then begin
	storedOpen9 = low;
	storedClose9 = high;
end;
	
if (Time = 1030) then begin
	storedOpen1030 = low;
	storedClose1030 = high;
end;

rangeLow = MinList(MinList(storedOpen9, storedClose9), MinList(storedOpen1030, storedClose1030));	
rangeHigh = MaxList(MaxList(storedOpen9, storedClose9), MaxList(storedOpen1030, storedClose1030));

range = rangeHigh - rangeLow;

Another idea I had was to use 2 different timeframes, one where I use 90mins bars for getting the range (high-low) and one for trading. But I don't know how to do this nor if this is the appropriate way.

I am very new to EasyLanguage & Multicharts and tried searching for this but didn't find anything.

Thanks in advance!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
use extra computer for optimisation
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


kristian View Post
I want to get the range of the bars in at a certain time. Let's say I want the range from 9-10.30. This was my first try, but obviously it doesn't give me the range of the bars as it's only looking at the 9 & 10.30 bars (and not the ones in between).

I would try to do this as follows:

 
Code
Variables:
	barRange(0),
	highestRange(0),
	lowestRange(9999);

// Get the range of bars during a certain time
if (Time >= 900) and (Time <= 1030) then begin

	barRange = High - Low;
	
	highestRange = MaxList(barRange, highestRange);
	lowestRange = MinList(barRange, lowestRange);

end;

// Reset the variables after this time ends
if (Time > 1030) then begin

	highestRange = 0;
	lowestRange = 99999;

end;
Of course, you'd still need to implement here what you want to do with the `highestRange` and `lowestRange` variables during the 9:00 - 10:30 time period. I hope this points you in the right direction.

Reply With Quote
Thanked by:
  #3 (permalink)
kristian
Zurich
 
Posts: 8 since Aug 2015
Thanks Given: 4
Thanks Received: 3


Thank you very much Jura!

On the basis of your input I came up with the following:

 
Code
if (Time >= 0700) and (Time <= 0930) then begin
	
	highestHigh = MaxList(High, highestHigh);
	lowestLow = MinList(Low, lowestLow);
	
	range = highestHigh - lowestLow;

end;
and I reset the range every day like this:

 
Code
if date <> date[1] then begin

	highestHigh = 0;
	lowestLow = 99999999;
        range = 0;

end;

Reply With Quote
Thanked by:




Last Updated on August 12, 2015


© 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