Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, TipmyPip, VoroneTZ, Quad, 1 invisible), 688 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
UniRenko Bars Test #463990
01/11/17 23:33
01/11/17 23:33
Joined: Jul 2016
Posts: 8
H
Hlopetz Offline OP
Newbie
Hlopetz  Offline OP
Newbie
H

Joined: Jul 2016
Posts: 8
I've made UniRenko bars described here https://www.youtube.com/watch?v=V6QIKEEb-og

The code:
//UniRenko Bars 3rd edition
//////////////////////////////////////////////////////////////
#include <default.c>
var _Open = 0;
var _Close = 0;
var _High = 0;
var _Low = 0;
var _barMax = 0;
var _barMin = 0;
var _fakeOpen = 0;
int _barDirection = 0;
var _openOffset = 0;
var _trendOffset = 0;
var _reversalOffset = 0;
bool _maxExceeded = false;
bool _minExceeded = false;
var _TickTrend = 0;
var _TickReversal = 0;
var _TickOpenOffset = 0;
int _barsCount = 0;
DATE LastTickTime=0;
DATE _StartTime =0;
DATE _passOffset = 0;

var UniRenkoInit(var TickTrend, var TickOpenOffset,var TickReversal)
{
_trendOffset = TickTrend *PIP;
_reversalOffset = TickReversal*PIP;
_openOffset = TickOpenOffset*PIP;

}

int bar(vars Open, vars High, vars Low, vars Close, vars Price, DATE Start, DATE Time)
{
var thisClose =0;

if ( _barsCount == 0 )
{
_Open = Close[0];
_Low = Close[0];
_Close = Close[0];
_High = Close[0];
_barMax = Close[0]+_trendOffset;
_barMin = Close[0]-_trendOffset;

Open[0] = Close[0];
High[0] = Close[0];
Low[0] = Close[0];
_fakeOpen = Close[0];

_barsCount = 1;

LastTickTime = Time;
return 4; //Active, not close
}

if(Time-LastTickTime>= 1./24.){ // If it is a new session
Open[0]=_Open;
High[0]=_High;
Low[0]=_Low;
Close[0] = _Close;
LastTickTime = Time;
_barsCount=0;
return 1;
}

if (Close[0] > _barMax ) _maxExceeded = true;
else _maxExceeded = false;
if (Close[0] < _barMin ) _minExceeded = true;
else _minExceeded = false;

if ( _maxExceeded || _minExceeded )
{

if (_maxExceeded) {
_barDirection = 1;
thisClose = min(Close[0],_barMax);
_High = thisClose;
_barMax = thisClose + _trendOffset; // For the next bar calculation
_barMin = thisClose - _reversalOffset; // For the next bar calculation
}
else {
_barDirection = -1;
thisClose = max(Close[0],_barMin);
_Low = thisClose;
_barMax = thisClose + _reversalOffset; // For the next bar calculation
_barMin = thisClose - _trendOffset; // For the next bar calculation
}



_Close = thisClose;

//Add the new bar
Open[0] = _Open;
Close[0] = _Close;
High[0] = _High;
Low[0] = _Low;

//Prepare for the nex bar
_fakeOpen = thisClose - ( _openOffset * _barDirection ); // For the next bar calculation
_Open = _fakeOpen;
if (_maxExceeded) _Low = _Open;
if (_minExceeded) _High = _Open;


_barsCount = _barsCount + 1;


return 1;

}
//### Update Current Bar
else
{
if (Close[0] > High[0])_High = Close[0];
if (Close[0] < Low[0]) _Low = Close[0];
Open[0] = _Open;
High[0] = _High;
Low[0] = _Low;
_Close = Close[0];
return 4;
}

}

I have trade tick data for Swiss Market Index futures SMA since 21/06/2016 to 06/12/2016:

SMA.t1 file

2016.06.21 06:00:13.000 7883
2016.06.21 06:00:13.000 7880
2016.06.21 06:00:14.000 7884
....
2016.12.06 20:59:47.000 7944
2016.12.06 20:59:59.000 7943

Now I try plot it:

#include <UNIRENKOIII.c>

function run(){

UniRenkoInit(10,10,31);
set(TICKS|PLOTNOW);
History = ".t1";
StartDate =20161108;
EndDate = 20161108;
}

The questions:

1) Why do I see the different results when I change the bar period? The bars should not depend on time.
2) Why the plot is not for StartDate - EndDate range but different when I change the bar period?
3) Does it exist the way to check the start of the day session, night session?
I used if(Time-LastTickTime>= 1./24.){ // If it is a new session
However may be there is a better way?
4) I implemented these above because I try to find best Renko bar sizes for the strategy. Ninja Trader does not allow to loop the brick size of the bars. I hope Zorro is able to help...
I tried to use the similar code:
while(algo(loop("2","8","20")))
{
if(Algo == "2")
UniRenkoInit(2,2,6);
if(Algo == "8")
UniRenkoInit(8,8,21);
else if(Algo == "20")
UniRenkoInit(20,20,41);
}
But failed. It seems to me Zorro does not change the brick size. Is it possible to do what I want?

Re: UniRenko Bars Test [Re: Hlopetz] #464009
01/13/17 02:56
01/13/17 02:56
Joined: Feb 2014
Posts: 73
Montreal, Qc Canada
F
Finstratech Offline
Junior Member
Finstratech  Offline
Junior Member
F

Joined: Feb 2014
Posts: 73
Montreal, Qc Canada
What happens is when ex. your 10 pip brick is printed in 1 minute but your time frame is 60 minutes,that brick disappears - constantly. By the end of 60th munute you get "perfect" n number of bricks in the direction of the move, completely disregarding the up and down movements that happened DURING the 60 minutes.

Zorro is lacking application of renko IMO


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