.
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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
152 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
89 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
131 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
127 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment