![]() |
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 |
|
Senior Member
Join Date: Dec 2011
Posts: 121
Thanks: 23
Thanked 0 times in 0 posts
|
Instead of using a variable to set the value to x if a certain condition is met, can you put in say the number 1? I can't seem to get it to work for my statement. See the following code. Thank you.
Code:
oneUnit = if(Math.Floor(((AccountRiskPercent/100) * currentAccountSize)/Close[0]) < 1) 1 else Math.Floor(((AccountRiskPercent/100) * currentAccountSize)/Close[0]); |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello cfree5119,
Thanks for writing in and I am happy to assist you. To do a quick if check please use the following code Code:
oneUnit = Math.Floor(((AccountRiskPercent/100) * currentAccountSize)/Close[0]) < 1 ? 1.0 : Math.Floor(((AccountRiskPercent/100) * currentAccountSize)/Close[0]); Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service
Last edited by NinjaTrader_Joydeep; 03-14-2012 at 08:35 AM.
|
|
|
|
|
The following user says thank you to NinjaTrader_Joydeep for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multiple if statement | ionaz | General Programming | 1 | 11-27-2011 11:50 PM |
| Basic Or Statement? | dirygoatee | Strategy Development | 1 | 11-10-2011 02:51 AM |
| Help with IF Statement | Taddypole | Indicator Development | 2 | 04-25-2010 07:54 AM |
| if statement | velocity | General Programming | 3 | 02-20-2009 08:12 AM |
| Goto statement? | Burga1 | General Programming | 3 | 12-28-2007 09:37 AM |