![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jan 2009
Location: Melbourne
Posts: 178
Thanks: 3
Thanked 0 times in 0 posts
|
Is there a simple function that can be used to compare two (double) variables and store the maximum (the larger of the two) value for later reference?
The structure I'm using to achieve this currently is a little long in the tooth: If (variable1 > variable2)Thanks Shannon |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jan 2009
Posts: 584
Thanks: 2
Thanked 20 times in 12 posts
|
you could try
Math.Max(variable1,variable2); |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2009
Posts: 172
Thanks: 0
Thanked 1 time in 1 post
|
Math.Max is the best answer.
That said, the second best would be: variable3 = variable1>variable2 ? variable1 : variable2; The original post (if) indicates... the need to read a good book about C#
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jan 2009
Location: Melbourne
Posts: 178
Thanks: 3
Thanked 0 times in 0 posts
|
zweistein & NetTecture,
Thanks for your advice. It worked a treat. Shannon |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| maximum number of simultaneously open positions | andrgm | Strategy Development | 1 | 06-03-2009 12:21 PM |
| Maximum uptime | Radical | Miscellaneous Support | 8 | 02-20-2009 06:18 PM |
| maximum daily loss / drawdown | starrynight | Miscellaneous Support | 3 | 11-10-2008 01:59 PM |
| Maximum Volume Value | innovation | Miscellaneous Support | 6 | 10-20-2008 06:51 AM |
| Tick chart maximum? | PKFFW | Miscellaneous Support | 1 | 05-13-2008 07:26 AM |