Vienna
Experience: Intermediate
Platform: NinjaTrader
Trading: Futures
Posts: 5 since Oct 2020
Thanks Given: 5
Thanks Received: 0
|
Hi,
I want to call OnBarUpdate() multiple times, like having a Shell/Loop above it. Let me explain what I try to achieve.
I want to set a StartTime = 10:00 and EndTime == 16:00. In that period, I take some statistics for each bar. Once this is done for the entire Time Frame, let’s say 5 days (5 sessions and I expect to get 5x “Bars.IsFirstBarOfSession”), I want to collect the same statistics for StartTime = 11:00 and EndTime = 16:00 for every bar again.
I can achieve this with Properties and set the StartTime and EndTime BUT I would need to run this manually and make changes to the Properties manually, let’s say 5 times for StartTime = 10:00, 11:00, 12:00, 13:00 etc.
But instead of having the time set manually, I want to have the time set Automatically to 10:00, run NT completely thru all Bars, then automatically set to 11:00, run again OnBarUpdate() thru all Bars.
Note: i might even want to change other variables/properties. So its basically similar to NT Strategy Analyzer - Optimizer, where multiple iterations run.
For( int i=0; i < 5; i++ )
{
switch( i)
{
Case 0:
StartTime = 10:00;
EndTime = 16:00;
Case 1:
StartTime = 11:00;
EndTime = 16:00
Case 3:
StartTime = 12:00;
EndTime = 16:00
Etc.
}
OnBarUpdate()
{
If( ToTime(Time[0]) > ToTime(StartTime) && ToTime(Time[0]) <= ToTime(EndTime) )
{
// collecting my statistics
}
// but also outside i want to collect information/statistics
}
}
How can I achieve this best; do i need to write a Windows script to achieve this?
Maybe this has been discussed already somewhere and someone can send me the link of it.
Any help is much appreciated !
|