PDA

View Full Version : limit a study to 2 days, today and yesterday


nkhoi
10-19-2009, 06:31 AM
How do I limit a study so that it only shows on today and yesterday chart only.

NinjaTrader_Bertrand
10-19-2009, 06:45 AM
You can work with ToDay() for this check - http://www.ninjatrader-support.com/HelpGuideV6/ToDay.html

nkhoi
10-19-2009, 07:15 AM
thanks,

I have;

if (Bars.GetSessionBar(1) != null) // yesterday processing
{ check yesterday data, draw an arrow at 4:15 PM }

if (Bars.GetSessionBar(0) != null) // today processing
{ check today data, draw an arrow at 9:30 AM }


and it should be no arrow for any other day but arrows shows up on all of the days I load.

NinjaTrader_Josh
10-19-2009, 07:45 AM
nkhoi,

That would not work. Processing of data goes from the very oldest to the very newest. As each new day is processed you have a keep rolling forward and your conditions are true for every single day moving forward. The only way you can limit it to the last two days is if you knew definite dates for the last two days you want to process and limit it that way with DateTime checks.

nkhoi
10-19-2009, 09:40 PM
you manual is terrible there is no example for getting today date or yesterday date, a search on key word yesterday or prior day return zero hit. But you also have a cs file that shows some related example that just enough to keep me going so thanks. I upload 2 versions of open range with overnight session, one plots continuously and one doesn't in case anybody interests.

NinjaTrader_Bertrand
10-20-2009, 03:45 AM
Thanks for the feeback and the sharing of those scripts, for today you can just use DateTime.Today, for yesterday's substract one then.

nkhoi
10-20-2009, 07:06 AM
Thanks for the feeback and the sharing of those scripts, for today you can just use DateTime.Today, for yesterday's substract one then.

that was what I found out but I didn't get your answer until now.