Jump to content

REQ Backtest renko


djplastic

Recommended Posts

is there a possibility to accurately backtest renko charts in ninja?...

You'll have to write special code for historical fill processing to have a shot at accurate backtesting. No point in optimizing if you don't do that.

 

All you have to do is making some adjustments in the file: C:\Users\...\Documents\NinjaTrader 7\bin\Custom\Type\@default.cs

Find the following part of code:

if (order.OrderType == OrderType.Market)

{

if (order.OrderAction == Cbi.OrderAction.Buy || order.OrderAction == Cbi.OrderAction.BuyToCover)

FillPrice = Math.Min(NextHigh, NextOpen + SlippagePoints);

else

FillPrice = Math.Max(NextLow, NextOpen - SlippagePoints);

}

and change it to this form:

if (order.OrderType == OrderType.Market)

{

if (order.OrderAction == Cbi.OrderAction.Buy || order.OrderAction == Cbi.OrderAction.BuyToCover)

{

Bars bar = Strategy.BarsArray[strategy.BarsInProgress];

FillPrice = Math.Min(NextHigh, bar.GetClose(bar.CurrentBar) + SlippagePoints);

}

else

FillPrice = Math.Max(NextLow, NextOpen - SlippagePoints);

}

than save the file with another name (for example: mydefault.cs). From inside of NT open to edit any indicator you have in the source form and compile it. Reload NT and next time, when you will make your backtests, change backtest option: <FillType> mydefault

Link to comment
Share on other sites

Incidientally for those that may have encountered this error message the namespace 'Ninjatrader.Strategy' already contains a definition for 'DefaultFillType' will need to just redefine the "Display Name and FillType part of the code to match their chosen name" and then recompile and go to the "Fill type" input tab under "historical fill processing to double check that you have the amended addition of the modified part of the code as expertly outlined by Admis"

 

This is how I have had to correct mine "Admis and Atd" welcome to critique me lol as I am not a programmer "design engineer" by profession and just had to logistically work it out....

 

Anyhow here is the namespace amendment part of the code to remove that error:

 

// This namespace holds all strategies and is required. Do not change it.

namespace NinjaTrader.Strategy

{

/// <summary>

/// </summary>

[Gui.Design.DisplayName("mydefault")]

public class mydefaultFillType : FillType

 

take care all !

Link to comment
Share on other sites

....

Anyhow here is the namespace amendment part of the code to remove that error:

 

// This namespace holds all strategies and is required. Do not change it.

namespace NinjaTrader.Strategy

{

/// <summary>

/// </summary>

[Gui.Design.DisplayName("mydefault")]

public class mydefaultFillType : FillType

 

Very proper action! It's my fault. I've forgotten to mention about it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...