Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
Deeplearning Script
by wolfi. 02/26/24 12:46
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/22/24 16:22
AssetAdd() vs. modern asset list?
by jcl. 02/21/24 15:01
How many still using A8
by Aku_Aku. 02/20/24 12:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, AndrewAMD), 567 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Indicator and TimeFrame #470516
01/17/18 23:09
01/17/18 23:09
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

I have this simple script ( only for testing )
this problem is described in manual:
TimeFrame does not affect a few indicators that do not use a Data series, but directly the current asset price series. This is mentioned in the description of the indicator.

Code:
void run()
{
	assetList("AssetsCur.csv");
	set(LOGFILE|PLOTNOW);
	set(TICKS);

	NumYears = 1;
	StartDate = 20170101;
	
	PlotScale = 8;
	PlotWidth = 1200;
	PlotHeight1 = 450;
	PlotHeight2 = 120;
	PlotDate = 20170601; 
	PlotBars = 200;

	BarPeriod = 5;
	TimeFrame = 12;	
		
	var *Price = series(price());		
	vars Trend1 = series(LowPass(Price,80));
	plot ("Price",Price,MAIN|LINE,ORANGE);
	plot("LP",Trend1,MAIN|LINE,BLUE);
	
}



after run I get this screen:






















but after remove the
Code:
TimeFrame=12;

- run only with BarPeriod is the indicator smoothed.




After change BarPeriod=60; / 5*12 / I get also different values in the indicators:




Sumary:
BarPeriod*TimeFrame / TimeFrame > 1 / not get the same value from indicator




Attached Files Snímek obrazovky 2018-01-17 v 17.02.36.pngSnímek obrazovky 2018-01-17 v 17.02.10.pngSnímek obrazovky 2018-01-17 v 17.14.22.png
Last edited by Grat; 01/17/18 23:58.
Re: Indicator and TimeFrame [Re: Grat] #470519
01/18/18 11:23
01/18/18 11:23
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
That's right. But what was the question?

Re: Indicator and TimeFrame [Re: jcl] #470522
01/18/18 13:14
01/18/18 13:14
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
no question, only explain for the other people, how work TimeFrame.

Re: Indicator and TimeFrame [Re: Grat] #470532
01/18/18 17:33
01/18/18 17:33
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
so, I have question:

how to get the same price in the exact time? For 2.1.2017 00:00:00 - price don't have same value

BarPeriod=60
TimeFrame=1
Date: 02.01.17 00:00:00 Price: 1.05265 Trend: 1.05179

BarPeriod=5
TimeFrame =12
Date: 02.01.17 00:00:00 Price: 1.05301 Trend: 1.05455

BarPeriod=5
TimeFrame =1
Date: 02.01.17 00:00:00 Price: 1.05261 Trend: 1.05348

BarPeriod=1
TimeFrame =1
Date: 02.01.17 00:00:00 Price: 1.05259 Trend: 1.05289

BarPeriod=1
TimeFrame =0
Date: 02.01.17 00:00:00 Price: 1.05290 Trend: 1.05290

Code:
printf("nDate: %s Price: %.5f Trend: %.5f",datetime(),Price[0],Trend1[0]);


Re: Indicator and TimeFrame [Re: Grat] #470537
01/19/18 07:48
01/19/18 07:48
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
price() is the mean price of the bar, so it depends on bar length. priceClose() is the price at the exact time.

Re: Indicator and TimeFrame [Re: jcl] #471766
03/19/18 14:52
03/19/18 14:52
Joined: Nov 2017
Posts: 39
Germany
E
easyX Offline
Newbie
easyX  Offline
Newbie
E

Joined: Nov 2017
Posts: 39
Germany
How can i get the H1 CCI while using 1 or 5 min BarPeriod?

What is the "current asset price series" in case i have BarPeriod = 5 is it always using M5 data then?

Does a change of TimeFrame (12) give me my H1 data?

Re: Indicator and TimeFrame [Re: easyX] #471906
03/24/18 20:15
03/24/18 20:15
Joined: Jun 2017
Posts: 78
B
BobbyT Offline
Junior Member
BobbyT  Offline
Junior Member
B

Joined: Jun 2017
Posts: 78
Hi easyX,

I'm also trying to work through some timeframe/indicator related issues and have a current thread about it.

The way I understand BarpPeriod/TimeFrame and price/indicator data is this....

BarPeriod will generate the following price series for BarPeriod: priceOpen(), priceHigh(), priceLow() and priceClose()

So in your example, the above functions will be autofilled every pass of run() which technically you could say it is filled every 5 minutes.

If you call TimeFrame(12) then yes, you will be looking at H1 data. Any call to the above functions, while TimeFrame = 12, will give you H1 data for that feature.
Of course you can always set up a TimeFrame specific series with
Code:
vars C = series(priceClose());

to make accessing non current bar elements easier.

I may have this completely wrong given I'm having problems of my own with this kind of thing.

Cheers

Last edited by BobbyT; 03/24/18 20:16.
Re: Indicator and TimeFrame [Re: BobbyT] #471910
03/25/18 11:56
03/25/18 11:56
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
Thats right, with 5 min barperiod, the TimeFrame of 1 hour is 60/5 = 12. And for catching the hour boundaries its TimeFrame = frameSync(12).

Re: Indicator and TimeFrame [Re: Grat] #478629
11/17/19 12:39
11/17/19 12:39
Joined: Nov 2018
Posts: 11
A
aventador Offline
Newbie
aventador  Offline
Newbie
A

Joined: Nov 2018
Posts: 11
I have question.

How to make weekly timeframe with BarPeriod = 60 ?

The reason to use Barperiod 60 is to trade market in timeframe 1 hour.

For example :-

If weekClose[0] > weekClose[1] then weeksignal = 1 else weeksignal = 0

in timeframe 1 hour if SMA10 > SMA30 and weeksignal = 1 then enterlong
else if SMA10 < SMA30 and weeksignal = 0 then entershort

Last edited by aventador; 11/17/19 12:48.
Re: Indicator and TimeFrame [Re: Grat] #478640
11/18/19 12:44
11/18/19 12:44
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
For a weekly time frame from 1h bars, you can use the synchronization mechanism described under "TimeFrame". But for that week signal you need no extra time frame. Just store the close at the end of Friday and compare with the previous stored close.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1