View Full Version : Multi-time frame strategy with periods of different size
pequemec
02-19-2010, 07:53 PM
Hi,
I appreciate any help and I'll try to explain in English:
I'm programming a multi-time frame strategy, in 15min bars, for the ES instrument in RTH. I apply a filter in 3min bars, to specify the entries, but I need to take several bars outside RTH. I can not change session begins and session ends in the main chart without modify the parameters of the indicators used and discredit the system. How can I incorporate these bars outside RTH in my strategy?
Best regards.
NinjaTrader_Austin
02-21-2010, 02:47 PM
Hi there, unfortunately this isn't possible with NinjaTrader 6.5 unless you create some sort of time filter (http://www.ninjatrader-support2.com/vb/showthread.php?t=3226) that only lets your strategy trade during certain time periods.
pequemec
02-22-2010, 03:24 AM
Thanks for your reply.
A time filter is not the solution because the problem is not to establish a time period for the trades, is to establish a time period for the indicators.
Is it possible in NinjaTrader7?
If this is possible please indicate the detailed logic.
Best regards.
NinjaTrader_Josh
02-22-2010, 09:29 AM
pequemec,
Indicators always run on the full information displayed on the chart. If you only want it to use a subset you need to program a time filter into the indicator itself (not the strategy) to be able to allow the strategy to trade on the full hours. It may require more adjusting of indicator logic to accommodate not setting certain bars.
pequemec
02-23-2010, 10:46 AM
Josh,
What type of filter would be? The filter of the type:
if (ToTime (Time [0]) <= 153000) return;
remove plot lines but do not alter the value of the indicator.
NinjaTrader_Austin
02-23-2010, 01:45 PM
pequemec, what you seek will require you to code the entire indicator into your strategy and then wrap the time filters around it. This will most likely not be an easy task. You can use the ToTime() function to quickly verify if the time is during some period like this:
if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) <= 160000)
{
// the time is between 9:30am and 4pm
// you can set your indicator logic to only run during this time period
}
pequemec
02-23-2010, 02:54 PM
Sorry, but for me this is not a good solution. Could you tell me as they have solved this in version7?. It's as simple as documenting the logic that I use to create a strategy multitimeframe with different sessions for each BarsInProgress.
NinjaTrader_Josh
02-23-2010, 03:07 PM
pequemec,
How we have been outlining is how it works. It will work for what you have outlined. You need to use time filters. You can either get the indicator logic into the strategy directly like Austin mentioned or you can program the time filter into the indicator directly. Unfortunately there is no way around this. 7 works exactly the same way.
pequemec
02-24-2010, 02:29 AM
Suppose we apply that logic in the indicator Bollinger. Syntax:
protected override void OnBarUpdate()
{
//Filtro temporal
if (ToTime(Time[0]) > 153000 && ToTime(Time[0]) <= 221500)
miscierres.Set(Close[0]);
else
return;
BandaSuperior.Set(SMA(miscierres, periodo)[0] + desvest * StdDev(miscierres, periodo)[0]);
BandaMedia.Set(SMA(miscierres,periodo)[0]);
BandaInferior.Set(SMA(miscierres, periodo)[0] - desvest * StdDev(miscierres, periodo)[0]);
}
What happens is that you fill the "gaps" of zeros. How do I fix?
NinjaTrader_Bertrand
02-24-2010, 03:04 AM
I'm not sure I follow what you mean 'with gaps of 0's', but for sure it will disrupt indicator continuity the way you programmed it as it does not have enough data to initialize calcs properly at time filter start.
pequemec
02-24-2010, 03:29 AM
Ok, How do I maintain the continuity of the indicator?
Sorry but I'm not a programmer
NinjaTrader_Josh
02-24-2010, 10:27 AM
pequemec,
You can't use [0] the way it works out of the box because you are skipping bars with your time filter. You need to program logic that uses only the series at points you want for your calculations. Unfortunately this would require some more extensive programming to achieve. You may want to consider one of these 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/partners_onlinetrading_NinjaScript.htm