PDA

View Full Version : NinjaScript Delete Warning


SamIam
08-19-2007, 06:08 PM
While trying to delete a self-created strategy, I am getting the following error message.
"You have custom NinjaScript files on your PC that have programming errors. These errors must be resolved before you can delete a NinjaScript File."

How can I find error and resolve the issue? The error message does not direct me to a specific file.

Sami

NinjaTrader_Ray
08-19-2007, 07:51 PM
Open any strategy, compile it, a list of errors and associated file(s) will be listed in the bottom of the NinjaScript Editor.

SamIam
08-19-2007, 07:57 PM
Ray,

Thanks for the reply. After compiling the strategies I got the following error description.

"The name 'Max' does not exist in the current context Strategy"

This relates to my other post regarding the maximum high of last 20 bars. My code is as below.

if (High[0] <= Max(High,20)[1])
{
DrawArrowUp("My up arrow" + CurrentBar, 0, 0, Color.Green);
}

Can you point out what error I have made in the above code?

Sami

NinjaTrader_Josh
08-19-2007, 09:08 PM
I think you want to be using Bars.HighestBar instead of Max. If you decide Max is what you want to be using you should use Math.Max().

http://www.ninjatrader-support.com/HelpGuideV6/HighestBar.html
For HighestBar I believe this will work to your likings:
if(High[0] <= High[Bars.HighestBar(20)])

SamIam
08-19-2007, 09:27 PM
uacvax,

Bars.HighestBar worked great.

Thanks,

Sami

NinjaTrader_Ray
08-20-2007, 06:42 AM
Its

MAX()

not

Max()

Note: The capitilization.