.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Range to Integer ???
Collapse
X
-
I think this does what you want to do. However, I'm not sure if forex/pips work the same way as futures/ticks.
int ticks = (int) ((double)Instrument.MasterInstrument.Round2TickSize(Range( )[0]) / (double)TickSize);
In futures it will convert the range into the number of ticks. So if the range in TF is .4 it will return an integer with a value of 4.
I posted a little bit ago, but then realized the code didn't work quite right unless used as a double, so I deleted it to avoid confusion.
Hope this helps.
VT
Comment
-
VTrader is correct. What you have here is a conversion of POINTS. 80 pips / 80 Ticks, are - 0 POINTS (forex: 10000 pips per point - the point is the value before the ".").Originally posted by deanz View Postlooks like that converts 0.0080 into 0 I wanted to convert it into 80
To get the ticks / pips you need to multiply the range by the number of ticks / pips per point first.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
336 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment