Gamestudio Links
Zorro Links
Newest Posts
Where's the Wiki?
by Quad. 06/25/19 22:16
Published Gamestudio Games?
by Dooley. 06/25/19 16:59
Updating to A8 [SOLVED]
by Dooley. 06/25/19 16:00
Message from IB of open position
by Zheka. 06/25/19 13:58
FXCM: "Can't connect to price server"
by riinvest. 06/25/19 10:35
New Zorro version 2.12
by jcl. 06/25/19 09:42
Aum120 is ready
by Emre. 06/24/19 17:54
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
5 registered members (JeyKey II, wdlmaster, alibaba, jenGs, kvm), 574 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Theaisback, redye, rhe2564, Qw3rty, Dal
18239 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: 227
Italy
tradingest Offline OP
Member
tradingest  Offline OP
Member

Joined: Feb 2018
Posts: 227
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: 68
USA
J
jrath Offline
Junior Member
jrath  Offline
Junior Member
J

Joined: Nov 2016
Posts: 68
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: 227
Italy
tradingest Offline OP
Member
tradingest  Offline OP
Member

Joined: Feb 2018
Posts: 227
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: 68
USA
J
jrath Offline
Junior Member
jrath  Offline
Junior Member
J

Joined: Nov 2016
Posts: 68
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);
	
}



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1