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

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

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

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Comparing a bar with your body size?

Old 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: 39 since Apr 2010
Thanks: 13 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:


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.

Reply With Quote

Old 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.


Old February 18th, 2016, 03:35 PM   #3 (permalink)
Elite Member
London, UK
Futures Experience: Intermediate
Platform: NinjaTrader, Julia
Favorite Futures: Ockham's razor
gregid's Avatar
Posts: 636 since Aug 2009
Thanks: 311 given, 586 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:

Also if you have no programming experience always use {} after if, eg.:
if (Value[0] > 10)
    BarColor = Color.Yellow;
This will help you avoid unintentional errors;

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Comparing a bar with your body size?

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
bar size ness1g NinjaTrader 1 May 8th, 2015 02:49 PM
Better Renko Bar Size (vs. 5 min bar) TrendTraderBH Traders Hideout 2 April 15th, 2012 03:35 PM
How do I determine what size range bar is comparable to a daily bar? Trankuility Traders Hideout 14 January 15th, 2012 10:46 AM
bar size value jwhtrades NinjaTrader 7 August 28th, 2011 10:55 PM
range bar size jb004 Traders Hideout 5 May 10th, 2010 10:25 AM

All times are GMT -4. The time now is 09:00 AM.

Copyright © 2016 by 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 2016-10-27 in 0.07 seconds with 19 queries on phoenix via your IP