Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,459 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Chart for differences from day open price #413310
12/11/12 22:04
12/11/12 22:04
Joined: Nov 2012
Posts: 6
N
NightWalker Offline OP
Newbie
NightWalker  Offline OP
Newbie
N

Joined: Nov 2012
Posts: 6
Hi, I'm writing excercises to know better Zorro.

Below you can find script, which calculates and plots differences for every hour bar from daily open (fx).

Code:
// Script generates chart for differences between day open price (midnight for fx market) and every bar according to defined bar period.
// author: NightWalker @ Zorro Trader Forum
// version: 20121202.

function run()
{
	BarPeriod = 60; //time frame set to 1 hour
	StartDate = 2012; //testing just for 2012 year
	NumDays = 30; // and only 30 days
	 
	TimeFrame = 24; //switchitng time frame - price series below reference to daily frame (24 * BarPeriod))
	var daily_atr = ATR(1);

	TimeFrame = 1; //switching timeframe to 1 hour and printf debugging info
	printf("\n close = %f, daily-open = %f, atr = %f", priceClose(0), priceOpen(hour(0)), daily_atr);
	
	var pricediff = (priceClose(0) - priceOpen(hour(0)))/daily_atr*PIP; //calculate difference in price
	// hour(0) means current price, so priceOpen(hour(0)) points to daily open (for fx markets - midnight))

	if ( hour(0) == 0)	// ploting big red bar separating days instead of first hour bar
		plot("new day", daily_atr, BARS, RED);
	else
		plot("price differences", pricediff, BARS, BLUE);	//plot price difference for current bar
		
	PlotHeight1 = 300;
		
	set(PLOTNOW);
}



NightWalker
Re: Chart for differences from day open price [Re: NightWalker] #419233
03/08/13 05:10
03/08/13 05:10
Joined: Nov 2012
Posts: 19
B
Boris Offline
Newbie
Boris  Offline
Newbie
B

Joined: Nov 2012
Posts: 19
I am curious as to how you would go about calculating differences between the closing on Friday and Opening Price on Sunday for gap trading strategies? Any ideas?


Moderated by  Petra 

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