Exception Handling?? - NinjaTrader Programming | futures.io
futures.io futures trading

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Exception Handling??
Started:April 11th, 2013 (01:38 PM) by tornadoatc Views / Replies:574 / 2
Last Reply:April 11th, 2013 (03:10 PM) Attachments:0

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Exception Handling??

Old April 11th, 2013, 01:38 PM   #1 (permalink)
Elite Member
Ft. Lauderdale Florida
Futures Experience: Intermediate
Platform: Tradestation
Posts: 16 since Apr 2010
Thanks: 31 given, 3 received

Exception Handling??

I am wondering what is the best way to throw exception in code when a variable is outside range that code is expecting.

For example:
switch (v_LTPeriodType)	
		case 1 :
			Add(PeriodType.Day, v_LTPeriods) ; 
		case 2 : 
			Add(PeriodType.Minute, v_LTPeriods) ; 
			throw new System.ArgumentOutOfRangeException("v_LTPeriodType", "v_LTPeriodType is out of range"); 
Is this sufficient? In TS I would have used RAISERUNTIMEERROR("Error Message").

Thank You for all your assistance!

Last edited by tornadoatc; April 11th, 2013 at 02:11 PM.
Reply With Quote

Old April 11th, 2013, 01:38 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old April 11th, 2013, 03:10 PM   #3 (permalink)
Elite Member
Berlin, Europe
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
Fat Tails's Avatar
Posts: 9,525 since Mar 2010
Thanks: 4,213 given, 24,794 received

I just use
       /// enter code here

When using catch{} without arguments it should catch all types of exceptions and write them to the logs.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:


futures.io > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Exception Handling??

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
datafeed handling in ninjatrader snusnufreak NinjaTrader 1 May 10th, 2012 07:27 AM
No Default constructor. Exception: invocation grinder NinjaTrader 1 April 5th, 2011 11:31 PM
Server side order handling nanobiotech Traders Hideout 17 December 11th, 2010 05:12 AM
event handling and calling a method kaywai NinjaTrader Programming 2 April 25th, 2010 01:21 PM
STRAT LIMITORDER REJECTION HANDLING zeller4 NinjaTrader Programming 1 February 2nd, 2010 01:41 PM

All times are GMT -4. The time now is 03:01 AM.

Copyright © 2016 by 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

Page generated 2016-10-27 in 0.07 seconds with 19 queries on phoenix via your IP