Gamestudio Links
Zorro Links
Newest Posts
Votes for future features
by 7th_zorro
Today at 01:57
Open WMB file
by Superku
Yesterday at 23:37
Stopping and resuming sessions without interrupting trade statis
by jcl
Yesterday at 08:14
Best Devlopment Experience
by j45p41
03/20/19 23:04
Blog Post: Continuous Futures Data in Zorro
by chsmac85
03/20/19 15:59
Error message : Closing Order Quantity
by OptimusPrime
03/20/19 12:49
script can work but no result(Profit and loss)
by jcl
03/20/19 09:12
AUM Magazine
Latest Screens
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Who's Online
6 registered (MINER, kvm, 3run, sdh309795gaas, 2 invisible), 618 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
FrankFred, QuartzLoop, Conchip, danatrader, ilikezorro
18190 Registered Users
Topic Options
Rate This Topic
#475899 - 01/12/19 15:28 RangeBar
tradingest Offline
Member

Registered: 02/27/18
Posts: 227
Loc: 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

Top
#475900 - 01/12/19 16:53 Re: RangeBar [Re: tradingest]
jrath Offline
Junior Member

Registered: 11/06/16
Posts: 68
Loc: 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

Top
#475901 - 01/12/19 17:01 Re: RangeBar [Re: jrath]
tradingest Offline
Member

Registered: 02/27/18
Posts: 227
Loc: 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?

Top
#475902 - 01/12/19 17:40 Re: RangeBar [Re: tradingest]
jrath Offline
Junior Member

Registered: 11/06/16
Posts: 68
Loc: 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);
	
}


Top



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

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