NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-02-2012, 01:42 AM   #1
Beauregard
Senior Member
 
Join Date: Dec 2009
Posts: 135
Thanks: 2
Thanked 1 time in 1 post
Default Add(MAX(High,CalcDistanceL)[1]) does not work

Hello

I want to plot MAX(High,CalcDistanceL)[1] on the chart, but I get an error.
This works:
Add(MAX(High,CalcDistanceL))

This does not work
Add(MAX(High,CalcDistanceL)[1])
Error:
1-Argument: cannot converted from "double" in "NinjaTrader.Indicator.IndicatorBase"
and
The best match for the overloaded NinjaTrader.Strategy.StrategyBase.Add(NinjaTrader. Indicator.IndicatorBase)-Methode has several invalid arguments

How can I plot the MAX as above?

thanks
Beauregard is offline  
Reply With Quote
Old 08-02-2012, 01:55 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Beauregard, you can only add complete indicators for plotting / visualization by your strategy - so in order to plot the max, create an indicator that would return this plot and then add it.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-02-2012, 05:48 AM   #3
Beauregard
Senior Member
 
Join Date: Dec 2009
Posts: 135
Thanks: 2
Thanked 1 time in 1 post
Default

I am not sure, whether I understand correct.
Plotting the Max works, as I have written:
Add(MAX(High,CalcDistanceL))

What does not work is MAX until the previous day
Beauregard is offline  
Reply With Quote
Old 08-02-2012, 05:51 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

You access a double value then and not a full series, this would not be possible, as you can only add a full indicator and not visualize a single value / plot.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-02-2012, 06:05 AM   #5
Beauregard
Senior Member
 
Join Date: Dec 2009
Posts: 135
Thanks: 2
Thanked 1 time in 1 post
Default

OK, all clear, thanks
Beauregard is offline  
Reply With Quote
Old 08-02-2012, 06:08 AM   #6
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,199
Thanks: 24
Thanked 1,225 times in 996 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by Beauregard View Post
Hello

I want to plot MAX(High,CalcDistanceL)[1] on the chart, but I get an error.
This works:
Add(MAX(High,CalcDistanceL))

This does not work
Add(MAX(High,CalcDistanceL)[1])
Error:
1-Argument: cannot converted from "double" in "NinjaTrader.Indicator.IndicatorBase"
and
The best match for the overloaded NinjaTrader.Strategy.StrategyBase.Add(NinjaTrader. Indicator.IndicatorBase)-Methode has several invalid arguments

How can I plot the MAX as above?

thanks
MAX(High,CalcDistanceL)[1] is a double. If you want to plot it, then assign it to the Plot, using a Set statement.
koganam is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why doesn't ADD index work? relogical Charting 5 06-21-2012 08:51 AM
CurrentBar Value of MAX(High, 20)[0]; RJay General Programming 1 07-12-2011 09:58 AM
"High[-1] >= High[0]"... does this work in Ninjascript? fredb987 Strategy Development 3 10-05-2010 11:59 AM
Please Add MAX to optimation setups ChuckAllen Version 7 Beta General Questions & Bug Reports 1 06-12-2010 10:54 AM
&& (MAX(High, 4)[0] <= Swing ().SwingHigh[0]) duck_CA Strategy Development 11 03-17-2009 11:35 PM


All times are GMT -6. The time now is 09:11 AM.