Gamestudio Links
Zorro Links
Newest Posts
Is Text Box data check possible?
by gamers. 02/17/20 11:09
Behaviour of user-defined bars
by Petra. 02/15/20 13:34
Optimization parameters results
by Petra. 02/15/20 13:22
Bollinger Band - Multi Timeframe
by migo. 02/15/20 06:50
Votes for future features
by 7th_zorro. 02/13/20 05:50
Quote size
by Zheka. 02/12/20 17:10
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
6 registered members (AndrewAMD, thomasprv, jenGs, Zheka, gamers, txesmi), 800 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
DebraSteed, Ricard, Apollo1, ziphnor, thomasprv
18377 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Behaviour of user-defined bars #479042
02/08/20 07:29
02/08/20 07:29
Joined: Oct 2018
Posts: 47
J
JamesHH Offline OP
Newbie
JamesHH  Offline OP
Newbie
J

Joined: Oct 2018
Posts: 47
I am testing a strategy based on Renko bars, by setting
Code
bar = Renko1
where Renko1 is from SpecialBars.c. First I ran it with
Code
BarPeriod = 1
and
Code
BarRange = 500.0
and everything went as expected. For example, in the log I have:

Code
[1: Sun 17-12-17 23:02] (19000.00)
[2: Mon 17-12-18 00:33] (18500.00)
[3: Mon 17-12-18 01:00] (18000.00)
...


and I can see in ZHistoryEditor that at the end of bar 2, the close price dips below 18500 for the first time at 00:33.

Then I wanted daily granularity rather than 1-min. The manual says BarPeriod only affects the start time and the number of allocated bars, but I tried
Code
BarPeriod = 1440
anyhow. The results made no sense to me. From the log:

Code
[1: Tue 17-12-19 09:00] (18500.00)
[2: Wed 17-12-20 02:45] (18000.00)
[3: Wed 17-12-20 18:26] (17500.00)
[4: Thu 17-12-21 10:06] (17000.00)


However, at 17-12-20 02:45 the price is nowhere near 18000 (same for all of the entries). Is this some bug, or else why is the log showing these close times for the Renko bars?

Re: Behaviour of user-defined bars [Re: JamesHH] #479043
02/08/20 09:03
02/08/20 09:03
Joined: Apr 2008
Posts: 264
Austria
Petra Online
Support
Petra  Online
Support

Joined: Apr 2008
Posts: 264
Austria
Well Barperiod = 1440 is wrong. Renko bars have no daily granularity. The manual has a chapter on special bars and there is also mentioned how you must set the bar period.

https://manual.zorro-project.com/bar.htm

The prices of some special bars are artificial but I believe renko bars have the real prices. So I dont know the problem with your prices but if you need help in detail you can get a support ticket and contact Support.

Re: Behaviour of user-defined bars [Re: Petra] #479049
02/08/20 17:47
02/08/20 17:47
Joined: Oct 2018
Posts: 47
J
JamesHH Offline OP
Newbie
JamesHH  Offline OP
Newbie
J

Joined: Oct 2018
Posts: 47
Originally Posted by Petra
Well Barperiod = 1440 is wrong. Renko bars have no daily granularity. The manual has a chapter on special bars and there is also mentioned how you must set the bar period.

https://manual.zorro-project.com/bar.htm

The prices of some special bars are artificial but I believe renko bars have the real prices. So I dont know the problem with your prices but if you need help in detail you can get a support ticket and contact Support.


Yes, I read the manual page.

My post wasn't very clear, but I am pointing out the strange behaviour when BarPeriod = 1440, with *your* script SpecialBars.c.

I can submit a bug report if you can't explain why the prices don't match and want to fix it.

Last edited by JamesHH; 02/08/20 19:25.
Re: Behaviour of user-defined bars [Re: JamesHH] #479058
02/11/20 11:25
02/11/20 11:25
Joined: Jul 2000
Posts: 27,105
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,105
Frankfurt
Which price exactly does not match with which one?

Re: Behaviour of user-defined bars [Re: jcl] #479080
02/13/20 03:05
02/13/20 03:05
Joined: Oct 2018
Posts: 47
J
JamesHH Offline OP
Newbie
JamesHH  Offline OP
Newbie
J

Joined: Oct 2018
Posts: 47
Originally Posted by jcl
Which price exactly does not match with which one?


I was just trying to understand what BarPeriod does when using the bar function, since I am not clear on what the manual says. However, I am not actually using bar now for what I am working on.

Anyhow, when I ran SpecialBars.c with BarPeriod = 1, setting the dates and the asset to my own and turning on logging, the log entries are "correct" as shown in my original post. The bars are timestamped in the log exactly when the OHLC data completes a Renko bar. On the other hand, with BarPeriod = 1440, the log entries are nowhere near the actual value of the Renko bar, which is what I meant when I said the prices do not match.

While I don't know what BarPeriod really does here, I wanted to point out that the code in the script for the function Renko1 is incorrect. I am not sure if that has something do with what I am seeing with the large BarPeriod. It is incorrect because it is possible for the price to move by more than
Code
2 * BarRange
in one OHLCV bar and then Close[0] will not get the correct value.

Here is what I think it should be:
Code
// Renko Bars, variant 1 
int Renko(vars Open, vars High, vars Low, vars Close)
{
  Open[0] = round(Close[1], BarRange);
  var delta = Close[0] - Open[0];
  if (delta >= BarRange) {
    int num_ranges = floor(delta / BarRange);
    Close[0] = Open[0] + num_ranges * BarRange;
    High[0] = Close[0];
    Low[0] = Open[0];
    return 1;
  }
  if (delta <= -BarRange) {
    int num_ranges = floor(-delta / BarRange);
    Close[0] = Open[0] - num_ranges * BarRange;
    High[0] = Open[0];
    Low[0] = Close[0];
    return 1;
  }
  return 4;
}

Re: Behaviour of user-defined bars [Re: JamesHH] #479092
02/15/20 13:34
02/15/20 13:34
Joined: Apr 2008
Posts: 264
Austria
Petra Online
Support
Petra  Online
Support

Joined: Apr 2008
Posts: 264
Austria
I understand from the manual under "bars" that a totally wrong bar period will result in not enough allocated bars. I dont know what consequences that has on prices but suppose that many things will then not work.

You code seems to allow the renko bars to have a multiple of their bar range, are you sure this is correct? I always thought that Renko bars must not exceed their bar range.


Powered by UBB.threads™ PHP Forum Software 7.7.1