Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
RangeBar #475899
01/12/19 14:28
01/12/19 14:28
Joined: Feb 2018
Posts: 236
Italy
tradingest Offline OP
Member
tradingest  Offline OP
Member

Joined: Feb 2018
Posts: 236
Italy
Hi guys,

whythe range bar is not costant?

Here I show you the difference between High and Low. Why is not costant? The code used below
Code:
var BarRange = 0.005;
//Range Bar
int bar(vars Open,vars High,vars Low,vars Close)
{
  if(Open[0] != Close[1]) {
    High[0] = max(Open[0],Close[1]);
    Low[0] = min(Open[0],Close[1]);
    Open[0] = Close[1];
  }
  if(High[0]-Low[0] >= BarRange)
    return 1;
  return 4;
}
function run()
{	
	set(PLOTNOW);
	StartDate = 20180601;
	EndDate = 2019;
	BarPeriod = 1;	
	asset("EUR/USD");

	plot("Range",priceHigh()-priceLow() ,NEW,RED);
	
}



thanks

Re: RangeBar [Re: tradingest] #475900
01/12/19 15:53
01/12/19 15:53
Joined: Nov 2016
Posts: 69
USA
J
jrath Offline
Junior Member
jrath  Offline
Junior Member
J

Joined: Nov 2016
Posts: 69
USA
Your code is plotting the difference between price high and low for every bar. It varies.

Try this :

plot("Range",BarRange ,NEW,RED);

J

Re: RangeBar [Re: jrath] #475901
01/12/19 16:01
01/12/19 16:01
Joined: Feb 2018
Posts: 236
Italy
tradingest Offline OP
Member
tradingest  Offline OP
Member

Joined: Feb 2018
Posts: 236
Italy
Originally Posted By: jrath
Your code is plotting the difference between price high and low for every bar. It varies.

Try this :

plot("Range",BarRange ,NEW,RED);

J


Yes, but for definition the difference between High and Low using the RangeBar should be always the same. I really wanted to check this but there's something wrong and I don't understand what.

Can you help me?

Re: RangeBar [Re: tradingest] #475902
01/12/19 16:40
01/12/19 16:40
Joined: Nov 2016
Posts: 69
USA
J
jrath Offline
Junior Member
jrath  Offline
Junior Member
J

Joined: Nov 2016
Posts: 69
USA
Maybe :


Code:
var BarRange = 0.005;

//Range Bar
int checkBar(vars Open,vars High,vars Low,vars Close)
{
  if(Open[0] != Close[1]) {
    High[0] = max(Open[0],Close[1]);
    Low[0] = min(Open[0],Close[1]);
    Open[0] = Close[1];
  }
    
  if(High[0]-Low[0] >= BarRange)
    return 1;
  return 4;
}

function run()
{	
	set(PLOTNOW);
	StartDate = 2018;
	EndDate = 2019;
	BarPeriod = 1;	
	asset("EUR/USD");

	vars priceOpen = series(priceOpen());
	vars priceHigh = series(priceHigh());
	vars priceLow = series(priceLow());
	vars priceClose = series(priceClose());
		
	plot("Range",checkBar(priceOpen, priceHigh, priceLow, priceClose) ,NEW,RED);
	
}



Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1