![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Feb 2010
Posts: 74
Thanks: 1
Thanked 2 times in 2 posts
|
I'm new to C#, but not new to programming (I have a VB background). I'm trying to get the syntax right for the following. I'm trying to create a method/function that will return a number of shares based off calculations within. I've successfully created methods/functions that just perform calculations, but do not return anything. However, I'm having trouble getting the syntax right when trying to return a value. Here's my code:
publicvoid TotalShareSize (double risk, double rval, outint totShareSize) { //Calculations here... totShareSize = x; } Thanks. fosch |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Nov 2008
Location: UK
Posts: 637
Thanks: 0
Thanked 1 time in 1 post
|
If the value being returned is an integer, for example, just replace
publicvoid with public int and then in the proc, do return value; |
|
|
|
|
|
#3 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
DAve,
Thanks for the assist appreciate it. Dave is absolutely correct. Let us know if you have follow up questions, also searching the net for c# information will greatly assist here as well. Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#4 |
|
Member
Join Date: Feb 2010
Posts: 74
Thanks: 1
Thanked 2 times in 2 posts
|
Thanks fellas... dave1992, that did the trick. Much appreciated.
fosch |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| returning non plotted series | murfinp | Indicator Development | 8 | 08-17-2010 08:10 AM |
| Functions returning 2 values | kenz987 | Charting | 2 | 10-09-2009 07:36 AM |
| ZeroLagEMA returning 0 | RandyT | General Programming | 3 | 07-15-2009 08:45 AM |
| Returning ticks from entry | rsi77 | Strategy Development | 21 | 02-02-2009 01:53 AM |
| Indicator returning more than one value | ryker | General Programming | 2 | 12-06-2007 02:22 AM |