Gamestudio Links
Zorro Links
Newest Posts
lock profit without trail
by Grat. 09/18/20 14:30
how to use BrokerHistory2
by Grat. 09/18/20 14:29
MT4 plugin
by Grat. 09/18/20 08:32
Trail without setting Stop at entry
by AndrewAMD. 09/17/20 14:28
Sky and Water not working correctly?
by Preypacer. 09/17/20 11:39
Returning to A8/3DGS
by Preypacer. 09/17/20 00:46
Problem with history from MT4
by Grat. 09/16/20 18:37
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
10 registered members (NewBorn, 3run, AndrewAMD, Aku_Aku, alibaba, danatrader, 3dvg, 3 invisible), 471 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
NewBorn, 3dvg, secretagentman, distribution, EditeY
18515 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: 296
Czech Republic
G
Grat Offline OP
Member
Grat  Offline OP
Member
G

Joined: May 2015
Posts: 296
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.14.22.png (1127 downloads)
BarPeriod60
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,341
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,341
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: 296
Czech Republic
G
Grat Offline OP
Member
Grat  Offline OP
Member
G

Joined: May 2015
Posts: 296
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: 296
Czech Republic
G
Grat Offline OP
Member
Grat  Offline OP
Member
G

Joined: May 2015
Posts: 296
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,341
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,341
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: 320
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 320
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: 8
A
aventador Offline
Newbie
aventador  Offline
Newbie
A

Joined: Nov 2018
Posts: 8
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,341
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,341
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