X

## Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com

 NinjaTrader Support Forum bar length question

 General Programming General NinjaScript programming questions.

 04-17-2008, 10:30 AM #1 Burga1 Senior Member   Join Date: Nov 2007 Posts: 388 Thanks: 0 Thanked 0 times in 0 posts bar length question Hi, I'm simply trying to calculate the "length" of a Candlestick bar (in "pips") using: BODY = (Math.Abs(Open[0] - Close[0])) * TickSize; This however is producing odd results (in Output Window)...what is the error in syntax here? I would think something like this is hardcoded into NT ("BarLength" for example) however I don't see it in the documentation...
 04-17-2008, 10:50 AM #2 NinjaTrader_Ray Administrator     Join Date: Nov 2004 Location: Denver, CO, USA Posts: 11,163 Thanks: 6 Thanked 45 times in 32 posts how about Math.Abs(High[0] - Low[0]) this will give you the difference in Pips if sub pip is disabled otherwise 1/10ths of pips. Ray NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
04-17-2008, 11:17 AM   #3
Burga1
Senior Member

Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts

Thank you for the reply, still having problems, here is the line I'm using:

BODY = Math.Abs(Open[0] - Close[0]);

You can see from screenshots (2 periods, 12:30pm and 12:45pm) that what is being returned is not what should be expected (in pips)...I'm looking for the absolute value of the pips (thus .00039999 should be "4" pips)...I have no explanation for the information at 12:45pm.

Also can you explain "sub pip disabling", I'm not familiar with it...
Attached Images
 screen1.JPG (27.4 KB, 8 views) screen2.JPG (27.7 KB, 6 views)

 04-17-2008, 11:54 AM #4 NinjaTrader_Ray Administrator     Join Date: Nov 2004 Location: Denver, CO, USA Posts: 11,163 Thanks: 6 Thanked 45 times in 32 posts then divide by TickSize and round to an integer value. Sub pip support is should be enabled (Tools > Options > Misc) when using data from MBT or IB for FX. Ray NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
 04-17-2008, 12:15 PM #5 Burga1 Senior Member   Join Date: Nov 2007 Posts: 388 Thanks: 0 Thanked 0 times in 0 posts Thank you. I've enabled that sub pip and divided by TickSize. That seems to improve things. Can somebody supply an explanation why the pips seem to be multiples of 10? For example 4 pips is displaying as 40, 6 pips as 60, 22 pips as 220...etc...?
 04-17-2008, 12:22 PM #6 NinjaTrader_Ray Administrator     Join Date: Nov 2004 Location: Denver, CO, USA Posts: 11,163 Thanks: 6 Thanked 45 times in 32 posts Since you are using sub-pips which prices are quoted in 1/10ths of pips, thus, divide by 10 you will get the pip value. Ray NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
 04-17-2008, 12:26 PM #7 Burga1 Senior Member   Join Date: Nov 2007 Posts: 388 Thanks: 0 Thanked 0 times in 0 posts Thank you for your help.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News and Announcements     News and Announcements Application Technical Support     ATM Strategies (Discretionary Trading)     Automated Trading     Charting     Connecting     Installation and Licensing     Market Analyzer     Miscellaneous Support         Historical Version 7 Beta Threads             Critical Information - Please review             Version 7 Beta General Questions & Bug Reports         Historical NinjaTrader 6.5 Archive             Historical NinjaTrader 6.5 Beta Threads     Strategy Analyzer     SuperDOM and other Order Entry Windows NinjaScript Development Support     General Programming     Indicator Development     Strategy Development NinjaScript Educational Resources     Reference Samples     Tips NinjaScript File Sharing     NinjaScript File Sharing Discussion     Version 7 Indicators     Version 7 Strategies     Version 7 Miscellaneous Suggestions and Feedback     Suggestions And Feedback

All times are GMT -6. The time now is 04:50 PM.

 -- Fixed Width ---- Fluid Width NinjaTrader Support Forum - Archive - Top