That does look at lot easier than what I had to figure out the 'decimals' variable. I didn't even know that Round2TickSize() method existed! Thanks, buddy!
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Someone give me a formula
Collapse
X
-
Dude. Where have you been for the past 9 months??
That does look at lot easier than what I had to figure out the 'decimals' variable. I didn't even know that Round2TickSize() method existed! Thanks, buddy!
-
Not so simple
Maybe someone else ( eg Nt?)could provide an answer to this
if I Print(Close[0]) on forex futures eg 6E and the price is 1.350
the output is 1.35 - no trailing zero.
Is there anyway to 'restore' the trailing zero as I use a substring function to knock off the first 3 or 4 digits and it is just so irritating to have to consciously think ,no, 35 is actually 350. I know I know it''s picky.
This doesn't happen on other futures it appears.
Comment
-
Mindset, using String formatting will work but would be specific to an instrument. I place this outside of OnBarUpdate() usually just before Properties and use this in all my indicators.
private string FormatPrice(double iVal)
{
return Bars.Instrument.MasterInstrument.FormatPrice(iVal) ;
}
Then a print statement like this will always work:
Print(FormatPrice(Close[0]))
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by helpwanted, Today, 03:06 AM
|
1 response
14 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
11 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
244 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
387 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
Comment