Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
AssetFrame issues #467598
08/15/17 23:19
08/15/17 23:19
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Hi,

I am trying to use both, AssetZone and AssetMarket at the same time, which does not seem to work.

What I want to achieve is to skip all bars outside of market hours and combine all bars within market hours to 1 bar.

As an example:
BarPeriod = 60;
StartMarket = 1000;
EndMarket = 1400;

I'd like to combine those 4 bars to 1 and ignore all price data points outside of those hours.

Using:
AssetMarket = UTC;
TimeFrame = AssetFrame;
vars Price = series(priceClose());

successfully skips all bars outside those hours.

Using:
AssetZone = UTC;
TimeFrame = AssetFrame;
vars Price = series(priceClose());

successfully combines all 24 hourly bars to 1 daily bar.

But so far I couldn't figure out how to only emulate those bars within those pre-defined market hours. Using AssetZone and AssetMarket in the same script did not work.

I also tried to use dayClose(UTC,1) instead, which works in showing me the closing price of the market end. However, it seems that the day functions cannot be combined with TimeFrame.

Eventually I'd like to use other indicators on those emulated bars such as SMA or RSI and I could not get this working with the day functions either.

Could anyone shed some light on this matter?

Re: AssetFrame issues [Re: Ger1] #467601
08/16/17 05:53
08/16/17 05:53
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
AssetZone and AssetMarket are mutually exclusive, since using them together would make no sense. Assetzone produces daily time frames, but skipping outside market hours makes only sense with intraday time frames.

Re: AssetFrame issues [Re: jcl] #467602
08/16/17 06:14
08/16/17 06:14
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Okay. So is there way to achieve above?

As an example, is it possible to calculate the SMA of the last 5 day highs?

The issue is that I want to use only the high that occurred between StartMarket and EndMarket.

I first thought I could use dayHigh but this did not work.

I'd highly appreciate if you could shed some light on this as I got stuck.

Re: AssetFrame issues [Re: Ger1] #467627
08/17/17 22:10
08/17/17 22:10
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Could anyone shed some light on this?

I further tried following code based on the manual:

if(between(hour(),19,23) or between(hour(),0,5)) //outside market hours --> skip and ignore those bars
{
TimeFrame = 0;
SkippedBars--; // count negative number of bars outside market hours
}
else if(hour()==6)
{
TimeFrame=SkippedBars; // end this timeFrame
SkippedBars = 0;
}
else if(between(hour(),7,17)) //the hours I want to trade and use as an input for my indicators;
{
TimeFrame=0;
BarsPerMarketDay--;
}
else if(hour()==18) //Market Closes --> combine all market hours bars to one and use as an input for SMA, RSI, etc.
{
TimeFrame=BarsPerMarketDay;
BarsPerMarketDay = 0;
}
vars PriceD1 = series(priceClose()); //my problem is that it fills in also the price bar from the closed market hours that I do not want to have in here
//vars smaD = series(SMA(PriceD1,3)); //create an SMA of my last three market days

plot("PriceD1",PriceD1,MAIN,RED); // seems to work, but not sure if outside market hour bar is ignored or just a 2nd daily bar

//plot("smaD",smaD,MAIN,BLUE); // DOES NOT WORK AS INTENDED


Can anyone explain what is going wrong here and how to solve it?
It seems to me that the only way around this is to write several loops as there does not seem to be a way around this.

I was also wondering if anyone traded multiple FXCM cfds on daily bars, which does not seem to be an easy endeavour with Zorro as each cfd is traded during different market hours.

Last edited by Ger1; 08/18/17 08:10.
Re: AssetFrame issues [Re: Ger1] #467634
08/18/17 08:18
08/18/17 08:18
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
attached fxcm cfd market hours, where I'd like to implement a strategy trading multiple assets on a daily timeframe

Attached Files
Last edited by Ger1; 08/18/17 08:19.
Re: AssetFrame issues [Re: Ger1] #467646
08/18/17 16:42
08/18/17 16:42
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Originally Posted By: Ger1
is it possible to calculate the SMA of the last 5 day highs?

The issue is that I want to use only the high that occurred between StartMarket and EndMarket.

I first thought I could use dayHigh

I would think the same. dayHigh is exactly what you want - no need to skip bars or define time frames.

Re: AssetFrame issues [Re: jcl] #467652
08/19/17 01:08
08/19/17 01:08
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
Okay thanks.

I am able to replicate the daily price with the dayHigh function.

USE TIMEFRAME:
TimeFrame=frameSync(24);
vars PriceD1 = series(priceHigh());
TimeFrame=1;

USE DAYHIGH:
StartMarket = 0000;
EndMarket = 2359;
vars DayHigh = series(dayHigh(UTC,1));


However, I am unable to use the output from dayHigh as an input for indicator functions.

As an example I tried to set up the daily SMA:
vars smaD = series(SMA(PriceD1,3));
vars smaDayHigh = series(SMA(DayHigh,3));

Both give very different results.

I have attached the script I used and the resulting chart.

Could you please advise what is going wrong here and how to set it up correctly?

Eventually I'd like to set up various indicators on daily timeframes (but only getting price inputs during market hours) for various CFDs.

Thanks a lot.

Attached Files
AssetFrame.c (5 downloads)
DAYHIGH.png (10 downloads)
Re: AssetFrame issues [Re: Ger1] #467679
08/21/17 11:06
08/21/17 11:06
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Print PriceD1[0] and DayHigh[0] in the log and compare them with the High prices of the last 24 hours. Then you can see where the difference comes from. I cannot say it from a look at your code, but that would be the logical next step.


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