NexusFi: Find Your Edge


Home Menu

 





Comparing a bar with your body size?


Discussion in NinjaTrader

Updated
    1. trending_up 1,132 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Comparing a bar with your body size?

  #1 (permalink)
 eryo 
Babia, Spain
 
Experience: Intermediate
Platform: ninja trader
Broker: zen fire
Trading: gold
Posts: 48 since Apr 2010
Thanks Given: 22
Thanks Received: 8

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.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
52 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
31 thanks

  #3 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


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;

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





Last Updated on February 18, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts