PDA

View Full Version : only check the last 3 day's data


wkmetal
02-13-2010, 10:11 AM
Hi
I am new for Ninjascript, I want to build a indicator work in 1 minute time frame, but I want to add a rule : just check the last 3 days' chart data.
How can I add this rule on the indicator? Thanks a lot :p

NinjaTrader_Ben
02-13-2010, 10:31 AM
Hello,

You will see how to do it here:
http://www.ninjatrader-support.com/HelpGuideV6/MultiTimeFrameInstruments.html

Note: you must have daily data if you add a daily bar.

wkmetal
02-13-2010, 08:22 PM
Thanks Ben
I understand to add:

Add(PeriodType.Day,1)

and set:
if (BarsInProgress == 1)

after that I don't know how to filter out the other days,
I only want the data of last recent 3 days.

NinjaTrader_Ben
02-14-2010, 09:32 AM
Hello,

You will need to sort out the logic yourself, but you likely can use the GetBar() method to get the bar reference or you could use some sort of looping structure:
for (int i = 0; i < my_barsback; i++)
{
if(my_time == ToTime(Time[i]))
{
my_vol = Volume[i];
break;
}
}
Or maybe this link will help:
http://www.ninjatrader-support2.com/vb/showthread.php?t=8600

wkmetal
02-15-2010, 10:22 PM
Thank you Ben , to point me the direction,
I will like into them. cheers