![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Dec 2009
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
|
Hi,
new to the NT, so what am I missing here? None of the print statements below creates any output in the Output Window during a backtest run (which creates the expected results). Best regards Gwaihir Code:
publicclass bidlowprice : Strategy
{
#region Variables
// Wizard generated variables
privateint sellDelay = 2; // Default setting for SellDelay
// User defined variables (add any user defined variables below)
#endregion
///<summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
///</summary>
protectedoverridevoid Initialize()
{
CalculateOnBarClose = false;
Print("XXX");
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
double diff = High[1] - Low[1];
Print("test");
Print(diff + " ," + High[0] + " ," + Low[0] + " ," + Low[1] + " ," + (Low[1] - diff));
if (High[0] > (Low[1] - diff)
&& Low[0] < (Low[1] - diff))
{
EnterLong(DefaultQuantity, "");
}
// Condition set 2
if (BarsSinceEntry() == SellDelay)
{
ExitLong("", "");
}
}
#region Properties
[Description("Delay before Stuff bought gets sold")]
[Category("Parameters")]
publicint SellDelay
{
get { return sellDelay; }
set { sellDelay = Math.Max(0, value); }
}
#endregion
}
}
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,393
Thanks: 252
Thanked 968 times in 951 posts
|
Gwaihir, welcome to the forums at NT - did you open the output windows before you started the strategy / backtest?
Any errors being thrown to the log tab?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Dec 2009
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Dec 2009
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
|
Ah, unlocking the code implies manually compiling it. Otherwise changes are ignored when the strategy is run. A tiny reminder like "strategy being backtested is not the one last saved" would be helpful though.
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,393
Thanks: 252
Thanked 968 times in 951 posts
|
Correct and thanks for the suggestion Gwaihir.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print() to Output Window | xewoox | General Programming | 3 | 09-04-2010 10:24 PM |
| Print Output Window data to named text file | Buttermilk | General Programming | 1 | 09-17-2009 03:56 PM |
| Printing Text to Output Window on the Last Bar of a Chart | ollywedgwood | Strategy Development | 2 | 07-24-2009 03:39 PM |
| Colored text in output window? | heech | Strategy Development | 1 | 03-03-2009 10:02 AM |
| Output window text | kenzo | Strategy Analyzer | 3 | 12-12-2008 10:30 AM |