Error on calculating min/max value - please check GetMinMaxValue method - futures io
futures io futures trading



Error on calculating min/max value - please check GetMinMaxValue method


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Big Mike with 4 posts (0 thanks)
    2. looks_two Fat Tails with 3 posts (6 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 vvhg with 1 posts (0 thanks)
    1. trending_up 2,232 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 4 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Error on calculating min/max value - please check GetMinMaxValue method

(login for full post details)
  #1 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received

Error on calculating indicator min/max value for indicator 'RSI'. Please check the 'GetMinMaxValues' method: Index was outside the bounds of the array.

Attached is the indicator.

By default there is no 'symbol1' .. 'symbol10' (blank string). The error only occurs when using RSI and selecting this indicator as the input series. If you plot the indicator by itself (no RSI) it works fine.

The error also only occurs when symbol1 (or greater) are populated. So to reproduce, set symbol1 to something (ie SPY, ES 09-12, AAPL, etc). It will plot by itself fine, but when used inside RSI it generates the above error.

I couldn't find a resolution so far or even what is causing the problem.



Help appreciated. Don't laugh at code, I'm 3-years out of practice writing C#.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Attached Files
Register to download File Type: cs Synthetic.cs (23.2 KB, 17 views)
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
What blockvolume is visible? - order processing
NinjaTrader
Indicators for pair trading MES and M2K
Platforms and Indicators
Short Interest Ratio indicator?
ThinkOrSwim
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Big Mike in Ecuador
34 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,731 received



Big Mike View Post
Error on calculating indicator min/max value for indicator 'RSI'. Please check the 'GetMinMaxValues' method: Index was outside the bounds of the array.

Attached is the indicator.

By default there is no 'symbol1' .. 'symbol10' (blank string). The error only occurs when using RSI and selecting this indicator as the input series. If you plot the indicator by itself (no RSI) it works fine.

The error also only occurs when symbol1 (or greater) are populated. So to reproduce, set symbol1 to something (ie SPY, ES 09-12, AAPL, etc). It will plot by itself fine, but when used inside RSI it generates the above error.

I couldn't find a resolution so far or even what is causing the problem.



Help appreciated. Don't laugh at code, I'm 3-years out of practice writing C#.

Mike


@Big Mike: I have checked it on my side. I am getting the same error: Empty panel, array out of range error for GetMinMaxValues.

I am rather sure that it is one of the NinjaTrader mystery bugs. The code of the indicator has nothing to do with it, as it has no custom plot and does not use the offending method.

What you can do is the following:

(1) Apply the indicator -> nothing will appear
(2) Change the hoizontal compression by clicking below the x-Axis and slightly compress the chart
(3) Press F5 -> now the indicator should be shown
(4) Send a note to NinjaTrader support for explaining the peculiar behavior

Chart after the compression exercise:


Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:
 
(login for full post details)
  #4 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received

I contacted NT support, and it seems that Add() does not support dynamic calls.

What I don't understand is why it works as a stand-alone indicator, with the code as-is, which includes a dynamic Add() [in other words, the instrument is a variable and not fixed in the code].... but yet doesn't work when wrapping RSI around it.

Or perhaps it isn't working correctly now, and I've just not realized that the plot is completely wrong?

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,731 received


Big Mike View Post
I contacted NT support, and it seems that Add() does not support dynamic calls.

What I don't understand is why it works as a stand-alone indicator, with the code as-is, which includes a dynamic Add() [in other words, the instrument is a variable and not fixed in the code].... but yet doesn't work when wrapping RSI around it.

Or perhaps it isn't working correctly now, and I've just not realized that the plot is completely wrong?

Mike

I have tested this again. I have indeed coded a few indicators which call bartype and period dynamically (see VisualSMA and VisualEMA). Maybe I have committed a crime.... But as the name says, those were not really meant to be called by strategies.

To test the issue I have converted the indicator Synthetic to one which does not allow to define the instruments dynamically. The indicator (attached) is well-behaved and also calculates correct values. I have left a few Print instructions allowing to check the values for the added instruments.

Now, the original Synthetic file is also working well, if you put it on your chart. If you apply an indicator to it, it will first show an empty panel, but if you refresh via F5, it will display correct results.

I cannot entirely explain the behaviour, but it is probably linked to the Initialize section(). I suspect that

-> the code in the Initialize and Properties section is already executed when you open the indicator dialogue box of the chart panel, otherwise you would not see the information in the dialogue box
-> the Initialize() section is executed again, when the indicator is added to the chart, thus taking into account the new parameters
-> the Initialize() section is not executed again, when an indicator is called by another indicator, which means that parameter changes will not be applied to the Add instructions

What I do not know, is why pressing F5 leads to a parameter update.


Attached Files
Register to download File Type: zip Synthetic2.zip (2.3 KB, 15 views)
Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:
 
(login for full post details)
  #6 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received

NT's response clarifies it:


NinjaTrader Support
Running it just as an indicator may work as this all depends on when Initialize() is called.

When the indicator is selected to be added to the chart to define the properties Initialize() is run at that time. It can get recalled again once again when you actually hit ok to accept the changed that you made via setting the properties. This is explained as the last bullet point in our help guide which actually allows your initial indicator setup to work on its own: Initialize()

However when adding it as an input series this Initialize() is not re-run so your settings are not maintained when it comes to changing actual output in the Initialize() block based on user input.

Therefor this is why right click->reload historical data will re run initialize() with your properties set and cause your indicator to then start working.

This is part of the reasons why dynamic adding of secondary series is not supported as there is also other consideration for this functionality. For example an issue you can run into is if you run an indicator with dynamic add calls in Intialize() and then remove a secondary added series this would cause an exception since Disposing that secondary series is not expected. So there are other reasons why we do not support dynamic adding of data series in Initialize() and although it may work it would be unsupported and you may run into little things like what you did today.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #7 (permalink)
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,816 received


Fat Tails View Post
...I suspect that

-> the code in the Initialize and Properties section is already executed when you open the indicator dialogue box of the chart panel, otherwise you would not see the information in the dialogue box
-> the Initialize() section is executed again, when the indicator is added to the chart, thus taking into account the new parameters

I can confirm this behavior as I was working on an other indicator today which had a print statement in Initialize(). As always@Fat Tails is spot on. I am still waiting for the day where i can prove him wrong...

vvhg

Hic Rhodos, hic salta.
Reply With Quote
 
(login for full post details)
  #8 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received

@Fat Tails,

So Harry, do you see any problem with me calling it via a strategy? I believe that in a backtest, each run causes a Init(). As for running the strategy live on a chart, I guess I may need to hit F5?

I need to do a lot more testing...

thx for your help.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #9 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,731 received


Big Mike View Post
@Fat Tails,

So Harry, do you see any problem with me calling it via a strategy? I believe that in a backtest, each run causes a Init(). As for running the strategy live on a chart, I guess I may need to hit F5?

I need to do a lot more testing...

thx for your help.

Mike

I would definitely not start working on a backtest with an indicator that might create problems. Better start with a simple configuration. Why don't you settle for one synthetic instrument - type Synthetic2 - , which means that you can avoid adding instruments dynamically.

When the simple approach works as expected, you can then start to add complexity to your backtest by doing all sorts of things for which NinjaTrader has not been designed. I do not think you will convince the genetic optimizer to run a backtest by optimizing the instruments added.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Error on calculating min/max value - please check GetMinMaxValue method


Last Updated on August 2, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts