PDA

View Full Version : Using MikesRenko with Minute-Data


Joerg
06-01-2010, 02:50 AM
Hello,

IŽm trying to change the BarType MikesRenko. The version which is downloadable in the file sharing section uses (like Renko Charts typically do) Tick-Data. IŽd like to change it to using Minute-Data. Of course this will result in unequal brick sizes but it would make me able to backtest on all of my minute data.

I was able to change his code to use Minute-Data for historical time periodsŽbut not for realtime. How can I code the following condition in a bar type:

If 1-Min-Bar is closed begin OR
If FirstTick of 1-Min-Bar begin


Here is a part of his code where IŽd like to add the condition described above. The other changes (brickhighs, bricklows etc.) I should be able to do on my own.


publicoverridevoid Add(Data.Bars bars, double open, double high, double low, double close, DateTime time, int volume, bool isRealtime)
{
rangeValue = bars.Period.Value * bars.Instrument.MasterInstrument.TickSize;
if (bars.Count == 0)
{
// synchronize first bar with multiple of range size
if (((close * 10000) % (rangeValue * 10000)) == 0)
{
lastBrickLow = close;
lastBrickHigh = close;
AddBar(bars, close, close, close, close, time, volume);
}
}
else
{
Data.Bar bar = (Bar)bars.Get(bars.Count - 1);

{
// create virtual bars when gap above or below renko values
if (bars.Instrument.MasterInstrument.Compare(close, lastBrickHigh + rangeValue) > 0) //(close > lastBrickHigh + rangeValue)
{
while (bars.Instrument.MasterInstrument.Compare(close, lastBrickHigh + rangeValue) > 0) //(close > lastBrickHigh + rangeValue)
{
UpdateBar(bars, lastBrickHigh, lastBrickHigh + rangeValue, low, lastBrickHigh + rangeValue, time, 0);
lastBrickLow = lastBrickHigh;
lastBrickHigh += rangeValue;
AddBar(bars, lastBrickHigh, lastBrickHigh, lastBrickHigh, lastBrickHigh, time, 0);
}
}
}




Thanks a lot,

Joerg

NinjaTrader_Bertrand
06-01-2010, 07:33 AM
Joerg, hopefully forum members with experience in this field can give you some input, but unfortunately creating / alterting custom bars types is not supported by us.