NexusFi: Find Your Edge


Home Menu

 





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,926 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 4 attachments




 
Search this Thread

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

  #1 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Attached Files
Elite Membership required to download: Synthetic.cs
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



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
Thanked by:
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


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
Elite Membership required to download: Synthetic2.zip
Reply With Quote
Thanked by:
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824


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
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

@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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #9 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


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




Last Updated on August 2, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts