NexusFi: Find Your Edge


Home Menu

 





FastJSON question


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MichaelH with 2 posts (1 thanks)
    2. looks_two rleplae with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 1,824 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 2,947 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,860

I have an indicator that is using a JSON call.
This works fine.

However when I edit this indicator and compile it.
Go to the chart, unload the indicator
add the recompiled indicator back to the chart

I get an exception thrown :

Unhandled exception in MyIndicator.OnBarUpdate(): Unable to cast object of type 'MyData' to type 'MyData'.

This is on the following call :
MyData = fastJSON.JSON.ToObject<List<MyData>>(response);

Exit and reStart of Ninjatrader and all works fine.
response contains the exact same JSON data


Anybody any thoughts ?


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Topstep Acquires The Futures Desk -- Prop Firm Consolida …
Funded Trading Evaluation Firms
The 50/50 Paradox: Peace and Invasion Each at 20% -- Ira …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
TradingView Opens Volume Footprint Data to Pine Script - …
TradingView
The Backwardation Signal: How the CL Futures Curve Tells …
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
MichaelH's Avatar
 MichaelH 
Munich Germany
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader
Broker: S5
Trading: DAX, ES
Posts: 53 since Dec 2013
Thanks Given: 75
Thanks Received: 43


looks there is variable called MyData and a type MyData


MyData = fastJSON.JSON.ToObject<List<MyData>>(response);

How is the variable defined ?

would try

MyData myvar = fastJSON.JSON.ToObject<List<MyData>>(response);


Reply With Quote
  #4 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 2,947 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,860

Hello Michael

no not really
the variable is defined global

i just anonymized the code a bit

the problem is that the code runs fine until i edit the indicator and compile it
when i reload it , then the problem starts, i don't find a work around

the type is good, as the first time it works just fine


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
MichaelH's Avatar
 MichaelH 
Munich Germany
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader
Broker: S5
Trading: DAX, ES
Posts: 53 since Dec 2013
Thanks Given: 75
Thanks Received: 43

Then the only thing what comes to my mind, that there is sthg left on reload.
Is there an object or a structure which needs proper termination / disposal

To my experience that can be really anything and does not necessarily have to do with this objects or lines you posted.

Wish all the best to get it working soon.


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,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


MichaelH View Post
Then the only thing what comes to my mind, that there is sthg left on reload.
Is there an object or a structure which needs proper termination / disposal

To my experience that can be really anything and does not necessarily have to do with this objects or lines you posted.

Wish all the best to get it working soon.

Improper disposal could cause it to not function, but I don't think it would cause it to not compile...

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 X Visit my NexusFi Trade Journal Reply With Quote




Last Updated on October 26, 2015


© 2026 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 - Downloads - Top
no new posts