Colour Bar Script Assistance - NinjaTrader Programming | futures io social day trading
futures io futures trading


Colour Bar Script Assistance
Updated: Views / Replies:2,078 / 10
Created: by zt379 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Colour Bar Script Assistance

  #1 (permalink)
Elite Member
UK London
 
Futures Experience: None
Platform: NT and XTrader
Favorite Futures: Piano
 
Posts: 1,358 since Sep 2009
Thanks: 1,356 given, 1,551 received

Colour Bar Script Assistance

I am trying to learn this stuff !
Hoping someone can help.

This is what I have.
I've tried every combination of curly brakets and even those that compile keep
ALL bars coloured Magenta.



protected override void OnBarUpdate()

{
Value.Set(100 * (MAX(High, Period)[0] - Close[0]) / (MAX(High, Period)[0] - MIN(Low, Period)[0] == 0 ? 1 : MAX(High, Period)[0] - MIN(Low, Period)[0]));

if (Value[0] > 0);

BarColor = Color.Blue;

if (Value[0] < 0);

BarColor = Color.Magenta;

}

thx


Last edited by zt379; March 17th, 2011 at 01:59 AM.
Reply With Quote
 
  #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.

 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received


One useful thing is troubleshooting. Add a print() statement or two so you can see the value, and probably find the error in the calculation.

It's been a while, but something like:
 
Code
                            
Print(CurrentBar[0] + ": " Value[0]); 

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
Elite Member
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,068 received


zt379 View Post
I am trying to learn this stuff !
Hoping someone can help.

This is what I have.
I've tried every combination of curly brakets and even those that compile keep
ALL bars coloured Magenta.



protected override void OnBarUpdate()

{
Value.Set(100 * (MAX(High, Period)[0] - Close[0]) / (MAX(High, Period)[0] - MIN(Low, Period)[0] == 0 ? 1 : MAX(High, Period)[0] - MIN(Low, Period)[0]));

if (Value[0] > 0);

BarColor = Color.Blue;

if (Value[0] < 0);

BarColor = Color.Magenta;

}

thx

try this one:

if (Value[0] > 0);

{
BarColor = Color.Blue;
}
else
{
BarColor = Color.Magenta;
}

Reply With Quote
The following user says Thank You to redratsal for this post:
 
  #5 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received


zt379 View Post
if (Value[0] > 0);

BarColor = Color.Blue;

if (Value[0] < 0);

BarColor = Color.Magenta;


redratsal View Post
try this one:

if (Value[0] > 0);

{
BarColor = Color.Blue;
}
else
{
BarColor = Color.Magenta;
}


remove the ;

Reply With Quote
The following 2 users say Thank You to bukkan for this post:
 
  #6 (permalink)
Elite Member
UK London
 
Futures Experience: None
Platform: NT and XTrader
Favorite Futures: Piano
 
Posts: 1,358 since Sep 2009
Thanks: 1,356 given, 1,551 received


bukkan View Post
remove the ;

And the winner is................
bukkan.
I only wish I understood why ! lol

I've changed it to a CrossAbove and CrossBelow statement:
I've coloured the bars ok for CrossAbove +5 and CrossBelow -5,
without the "else" statement.(which should colour all bars between +5 and -5 as gray)

But when I add the else statement I get the magenta bars ok but all other bars are gray:

I used :

if (CrossAbove (+5,Value,1))
{
BarColor = Color.Blue;
}
if (CrossBelow (-5,Value,1))
{
BarColor = Color.Magenta;
}
else
{
BarColor = Color.Gray;
}
}

Many thx


Last edited by zt379; March 17th, 2011 at 02:21 PM.
Reply With Quote
 
  #7 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received

if (CrossAbove (+5,Value,1))
BarColor = Color.Blue;
else
if (CrossBelow (-5,Value,1))
BarColor = Color.Magenta;
else
BarColor = Color.Gray;

Not sure if the logic here is good, if a CrossBelow can possibly happen while in the CrossAbove condition but this is the way to test anyway.

Reply With Quote
The following user says Thank You to eDanny for this post:
 
  #8 (permalink)
Elite Member
UK London
 
Futures Experience: None
Platform: NT and XTrader
Favorite Futures: Piano
 
Posts: 1,358 since Sep 2009
Thanks: 1,356 given, 1,551 received


eDanny View Post
if (CrossAbove (+5,Value,1))
BarColor = Color.Blue;
else
if (CrossBelow (-5,Value,1))
BarColor = Color.Magenta;
else
BarColor = Color.Gray;

Not sure if the logic here is good, if a CrossBelow can possibly happen while in the CrossAbove condition but this is the way to test anyway.

eDanny

It's working as per your post, all be it with 2 x } at the end so many thanks.

I'm at a loss as to the reasons for differences in how to group things within the curly brackets, or
as and when they are needed.
I spend hours only to find out my mistake is down to one single bracket or a semi colon etc..

Any suggestion as to what material/video/link (anything) that would help me learn this stuff
would be great, if you have time.

Again my thanks

Reply With Quote
 
  #9 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received

If you have two statements after an if() test you will need to enclose them ind curly brackets or else only the first one will execute according to the result of the test.

if (CrossAbove (+5,Value,1))
BarColor = Color.Blue;
Print("We changed the bar color!");

Above code will only change the bar color if the CrossAbove test is passed but it will always execute the Print statement. To only Print when the bar color changes you would uses brackets to group them together.

if (CrossAbove (+5,Value,1))
{
BarColor = Color.Blue;
Print("We changed the bar color!");
}

Reply With Quote
The following user says Thank You to eDanny for this post:
 
  #10 (permalink)
Elite Member
UK London
 
Futures Experience: None
Platform: NT and XTrader
Favorite Futures: Piano
 
Posts: 1,358 since Sep 2009
Thanks: 1,356 given, 1,551 received



eDanny View Post
If you have two statements after an if() test you will need to enclose them ind curly brackets or else only the first one will execute according to the result of the test.

if (CrossAbove (+5,Value,1))
BarColor = Color.Blue;
Print("We changed the bar color!");

Above code will only change the bar color if the CrossAbove test is passed but it will always execute the Print statement. To only Print when the bar color changes you would uses brackets to group them together.

if (CrossAbove (+5,Value,1))
{
BarColor = Color.Blue;
Print("We changed the bar color!");
}

So by having "else if" after the first "if", we don't need any brackets, hence your script in your post#7 works ?

But I'm confused.
I did have statements bracketed , see my post#6,
yet the first Color.Blue did not print, only the Magenta and Gray printed.

Perhaps I'm not understanding what your saying ?

thx

Reply With Quote

Reply



futures io > > > > > Colour Bar Script Assistance

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
need vwap indicator that changes colour on up and downmoves anniebee321 NinjaTrader 27 August 10th, 2017 08:09 PM
ForceIndex - Colour up/down perryg NinjaTrader Programming 5 October 13th, 2012 11:46 AM
ATM Strategy Assistance TraderJoe0410 NinjaTrader 12 August 22nd, 2011 04:05 PM
Stoch Colour Above Below Threshold zt379 NinjaTrader Programming 1 February 12th, 2011 11:52 PM
Candlestick Border Colour yroyal NinjaTrader 1 December 8th, 2009 02:46 AM


All times are GMT -4. The time now is 05:47 PM.

Copyright © 2017 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 2017-12-17 in 0.14 seconds with 19 queries on phoenix via your IP 54.163.210.170