How to make SMA coloured histogram ? - NinjaTrader Programming | futures io social day trading
futures io futures trading


How to make SMA coloured histogram ?
Updated: Views / Replies:3,182 / 10
Created: by inmax Attachments:5

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
 5  
 
Thread Tools Search this Thread
 

How to make SMA coloured histogram ?

  #1 (permalink)
Trading Apprentice
Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: futures
 
Posts: 16 since Oct 2010
Thanks: 11 given, 2 received

How to make SMA coloured histogram ?

Hi,

I want to make coloured SMA histogram for BuySellStrength by tulanch.
Indicator you can find: NinjaTrader Support Forum > Links and Downloads Manager > Version 7 Indicators


Question is: How to make the histogram value higher than zero to have a green colour, and for values ​​lower than zero to have a red colour?

I modified the BuySellStrength indicator by adding:
// needed for the average
 
Code
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "BP"));
and
 
Code
Plot2.Set(buysellstrength);

----------------------------------------
and SMA indicator by adding:
// to illustrate the value higher and lower than zero
 
Code
Add(new Line(Color.FromKnownColor(KnownColor.Black), 0, "Zero"));
The result can be seen in the attached file. There are no colours which I wrote about. Can sombody help me?

Regards,

Attached Thumbnails
How to make SMA coloured histogram ?-6e-06-11-100-tick-2011-04-27.jpg  

Last edited by inmax; May 15th, 2011 at 03:55 PM.
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)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


Best you post the indicator file. Otherwise you need to add something like

 
Code
if (Values[1] >= 0)
    PlotColors[1][0] = Color.Lime;
else
    PlotColors[1][0] = Color.Red;
If you edit the indicator code below you will get an idea, how to make the colors user selectable.

Attached Files
Register to download File Type: zip DerivativeOscillator.zip (8.0 KB, 28 views)
Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: futures
 
Posts: 16 since Oct 2010
Thanks: 11 given, 2 received

I only need to modify BPSMA indicator. BPSMA is just a SMA standard ninjatrader indicator. I only added zero line:
 
Code
Add(new Line(Color.FromKnownColor(KnownColor.Black), 0, "Zero"));
I just want to modify the usual SMA (which can be found including standard indicators) for a value greater than zero have a green color and the lower value of zero have a red bar color.

My input series for SMA indicator (BPSMA) is: BuySellStrength indicator with Plot "BP", but it could be anything else.
BP is just a variable from BuySellStrength indicator:

 
Code
protected override void Initialize()
{
// ...
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "BP"));
// ...
}

 
Code
protected override void OnBarUpdate()
{

if (CurrentBar < 1)
return;

long bidvol = GetCurrentBidVolume();
long askvol = GetCurrentAskVolume();

int buysellstrength =  (int) askvol - (int) bidvol;

Plot2.Set(buysellstrength);
}
So, I take variable BP and make SMA but would be nice to see the effect of green bars> 0 and red <0, only by modifying SMA indicator.


UPDATE: 2011-05-16
Fix BPSMA to show if SMA > 0 then green else red.

Attached Thumbnails
How to make SMA coloured histogram ?-6e-06-11-100-tick-.jpg  
Attached Files
Register to download File Type: zip BuySellStrength.zip (2.3 KB, 26 views)
Register to download File Type: zip BPSMA.zip (2.0 KB, 31 views)

Last edited by inmax; May 16th, 2011 at 01:27 PM.
Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary

To color the SMA, just add

 
Code
if (Values[0] >= 0)
    PlotColors[0][0] = Color.Lime;
else
    PlotColors[0][0] = Color.Red;
to OnBarUpdate().

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #6 (permalink)
Trading Apprentice
Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: futures
 
Posts: 16 since Oct 2010
Thanks: 11 given, 2 received


Fat Tails View Post
To color the SMA, just add

 
Code
if (Values[0] >= 0)
    PlotColors[0][0] = Color.Lime;
else
    PlotColors[0][0] = Color.Red;
to OnBarUpdate().

Compile Error: Can not use the operator "> =" to the arguments of operations such as "NinjaTrader.Data.DataSeries" or "int".
CS0019: Error Code Explanation
Strings cannot be compared with relational operators (<, >, <=, >=, ==, !=) to other object types. Strings can only be compared to other strings and only through the use of equality operators (==, !=).

Reply With Quote
 
  #7 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


inmax View Post
Compile Error: Can not use the operator "> =" to the arguments of operations such as "NinjaTrader.Data.DataSeries" or "int".
CS0019: Error Code Explanation
Strings cannot be compared with relational operators (<, >, <=, >=, ==, !=) to other object types. Strings can only be compared to other strings and only through the use of equality operators (==, !=).

Try "Value[0]" or "Values[0][0]".

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #8 (permalink)
Trading Apprentice
Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: futures
 
Posts: 16 since Oct 2010
Thanks: 11 given, 2 received


Fat Tails View Post
Try "Value[0]" or "Values[0][0]".

Works well! Many Thanks!

Reply With Quote
 
  #9 (permalink)
Elite Member
Lagos, Nigeria
 
Futures Experience: Intermediate
Platform: NinjaTrader, SierraChart
Favorite Futures: Euro Currency & Oil
 
lolu's Avatar
 
Posts: 2,440 since Jun 2009
Thanks: 1,000 given, 1,595 received


inmax View Post
Works well! Many Thanks!

Have you updated the BPSMA posted in post #4 to the one that now works ?

Lolu

Reply With Quote
 
  #10 (permalink)
Trading Apprentice
Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: futures
 
Posts: 16 since Oct 2010
Thanks: 11 given, 2 received



lolu View Post
Have you updated the BPSMA posted in post #4 to the one that now works ?

Lolu


Right now, I updated the indicator in post #4.

Regards,
inmax

Reply With Quote

Reply



futures io > > > > > How to make SMA coloured histogram ?

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
MACD with Colored Histogram timefreedom The Elite Circle 9 October 3rd, 2017 02:43 PM
Volume histogram mysthars NinjaTrader 5 October 14th, 2011 12:13 PM
hi i am using the macds zero lag, and the teal coloured ADX DarrenH NinjaTrader 3 March 15th, 2010 12:28 PM
Does anyone use the JTstats histogram? Dragon Traders Hideout 17 February 3rd, 2010 06:31 AM
Coloured Keltner Bands Alan NinjaTrader 2 June 27th, 2009 03:39 AM


All times are GMT -4. The time now is 10:01 AM.

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.17 seconds with 20 queries on phoenix via your IP 107.20.115.174