Comparing a bar with your body size? - NinjaTrader Programming | futures io social day trading

Comparing a bar with your body size?
 Updated: February 18th, 2016 (03:35 PM) Views / Replies: 358 / 2 Created: February 18th, 2016 (02:45 PM) by eryo Attachments: 0

 Welcome to futures io.

# Comparing a bar with your body size?

 February 18th, 2016, 02:45 PM #1 (permalink) Elite Member Córdoba, Spain   Futures Experience: Intermediate Platform: ninja trader Broker/Data: zen fire Favorite Futures: gold   Posts: 41 since Apr 2010 Thanks: 15 given, 7 received Comparing a bar with your body size? Hi. I have no knowledge of programming. I want to know the size of the body of a bar and get it with this code: Value.Set(Math.Abs(Open[0]-Close[0])); Now I want that if the size of the body of the bar is greater than 10 bar draw yellow. NinjaTrader forum have given me this code if (Value[0] > 10) BarColor = Color.Yellow; But does nothing. Can anyone tell me the correct way to write the code? Thank you.

 February 18th, 2016, 02:45 PM #2 (permalink) Quick Summary Quick Summary Post Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

Elite Member
Wrocław, Poland

Futures Experience: Intermediate
Favorite Futures: Ockham's razor

Posts: 651 since Aug 2009
Thanks: 321 given, 607 received

Since I gather you want to test if body is greater than eg. 10 ticks you need to multiply the values of your Value by TickSize:

Code
 `Value.Set(Math.Abs(Open[0]-Close[0])*TickSize);`
Also if you have no programming experience always use {} after if, eg.:

Code
 ```if (Value[0] > 10) { BarColor = Color.Yellow; }```
This will help you avoid unintentional errors;

 The following user says Thank You to gregid for this post:

 futures io > Comparing a bar with your body size?

Upcoming Webinars and Events (4:30PM ET unless noted)

Elite only

## Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

 Similar Threads Thread Thread Starter Forum Replies Last Post TrendTraderBH Traders Hideout 5 December 9th, 2016 04:30 AM ness1g NinjaTrader 1 May 8th, 2015 02:49 PM Trankuility Traders Hideout 14 January 15th, 2012 10:46 AM jwhtrades NinjaTrader 7 August 28th, 2011 10:55 PM jb004 Traders Hideout 5 May 10th, 2010 10:25 AM

All times are GMT -4. The time now is 05:53 AM.

 Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io All information is for educational use only and is not investment advice.There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2018-05-28 in 0.08 seconds with 19 queries on phoenix via your IP 54.80.68.137