NT7 - moving average - green when rising, red when falling? - NinjaTrader | futures io social day trading
futures io futures trading


NT7 - moving average - green when rising, red when falling?
Updated: Views / Replies:5,762 / 9
Created: by Todd Attachments:2

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
 

NT7 - moving average - green when rising, red when falling?

  #1 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

NT7 - moving average - green when rising, red when falling?

With NT7, is there a moving average indicator (SMA, EMA, WMA) that can be green when rising and red when fallling?

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)
 Vendor: www.innovative-trading-solutions-online.com 
Hartford, CT. USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG, Kinetick
Favorite Futures: TF
 
RJay's Avatar
 
Posts: 677 since Jun 2009
Thanks: 726 given, 740 received

Answer
This post has been selected as an answer to the original posters question Answer



Todd View Post
With NT7, is there a moving average indicator (SMA, EMA, WMA) that can be green when rising and red when fallling?


Hi Todd,

Someone made this a while back, I forget who.

Copy into indicators directory and compile.

Works in both 6.5 and 7.0 .

You can select EMA, WMA, SMA, and HMA.

Enjoy,

RJay

Attached Files
Register to download File Type: cs ColorSampleUniversalMovingAverage2.cs (12.7 KB, 368 views)
Reply With Quote
The following 3 users say Thank You to RJay for this post:
 
  #4 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received


Todd View Post
With NT7, is there a moving average indicator (SMA, EMA, WMA) that can be green when rising and red when fallling?

No, but it's easy. Here's one with some boilerplate elided:
(as shown requires https://futures.io/free_downloads/ninjatrader-7/indicators/517-download.html?view)

 
Code
namespace NinjaTrader.Indicator
{
 [Description("EMA colored green when rising and red when falling.")]
 public class jhlEMAColored : Indicator
 {
    #region Variables
    // Wizard generated variables
    private int period = 14; // Default setting for Period
    // User defined variables (add any user defined variables below)
    private JHL.Utility.EMA ema;
    private double prior;
    private int priorBar = -1;
    #endregion


    protected override void Initialize()
    {
       ema = new JHL.Utility.EMA(Period);
       Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Hash, "Rising"));
       Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Hash, "Falling"));
       Overlay = true;
    }

    protected override void OnBarUpdate()
    {
       if ( CurrentBar == 0 ) {
          prior = Input[0];
          return;
       }
 
       double a = ema.set(Input[0], CurrentBar);
       if ( a > prior ) {
          Rising.Set(a);
          if ( Plots[0].PlotStyle == PlotStyle.Line && !Rising.ContainsValue(1) ) 
             Rising.Set(1, Falling[1]);
       }
       else if ( a < prior ) {
          Falling.Set(a);
          if ( Plots[1].PlotStyle == PlotStyle.Line && !Falling.ContainsValue(1) )
             Falling.Set(1, Rising[1]);
       }
       else { // Equality, set both and let NT deal with it?
          Rising.Set(a);
          Falling.Set(a);
       }
 
       if ( CurrentBar > priorBar ) {
          prior = a;
          priorBar = CurrentBar;
       }
    }
 
    #region Properties
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries Rising
    {
       get { return Values[0]; }
    }
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries Falling
    {
       get { return Values[1]; }
    }
    [Description("Number of periods in calculations.")]
    [GridCategory("Parameters")]
    publicint Period
    {
       get { return period; }
       set { period = Math.Max(1, value); }
    }
    #endregion
 }
}

Reply With Quote
The following user says Thank You to fluxsmith for this post:
 
  #5 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

Multi color plotting in NT7

Answer
This post has been selected as an answer to the original posters question Answer

In NT7 we have the new PlotColors Method that allows the color of a single plot to be changed on the fly, without having to use the NT6.5 kluge of switching between different plots and repainting the segment connecting the current value to the value from one bar back.

So if we are plotting an MA to the first plot of an indicator, just do this to have different colors when the indicator is rising or falling.

If(Rising(Values[0]) PlotColors[0][0]=upColor;
if(Falling(Values[0])PlotColors[0][0]=downColor;

or do this to change the color based on the current value vs some threshold

if(Values[0]>SomeThresholdValue) PlotColors[0][0]=upColor;
if(Values[0]<SomeThresholdValue) PlotColors[0][0]=downColor;

The upColor and downColor can be user selectable. They need to be declared as variables, there must be Get/Set statements for them, and they need to be serialized.

There is a thread in the Ninjatrader forums called Multi Color Plot Approach that explains this further. This goes back to the early beta releases of NT7.

Reply With Quote
The following 3 users say Thank You to Zondor for this post:
 
  #6 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received


Zondor View Post
In NT7 we have the new PlotColors Method that allows the color of a single plot to be changed on the fly...

That really is better, it does the right thing on non-line plots, and on line plots it splits the difference.

Attached Files
Register to download File Type: zip jhlEMAColored.zip (4.1 KB, 259 views)
Reply With Quote
The following user says Thank You to fluxsmith for this post:
 
  #7 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

Example of MA with user selectable up and down colors

Here is an example of a moving average that uses the PlotColors method to give user selectable colors for the rising and falling plot.

https://futures.io/free_downloads/vip_elite_circle/540-download.html?view

It's a triple smoothed EMA, not a simple EMA. It uses predefined instances of the EMA for optimization. Once more, thanks to Richard Todd of MoveTheMarkets.com for his article on this subject.

You may be surprised at how fast this indicator loads and refreshes. Further optimization can be accomplished by making an external call to a more efficient implementation of the EMA, rather than to @EMA.cs.

Reply With Quote
The following user says Thank You to Zondor for this post:
 
  #8 (permalink)
Membership Temporarily Revoked
Texas
 
Futures Experience: Intermediate
Platform: Ninja Trader
Favorite Futures: TF
 
Posts: 113 since Jun 2010
Thanks: 8 given, 51 received

Error messages on everything

Every time I try down loading something I get error messages. I have tried more than one indicator, so I know something is wrong on my end. But I have no idea what. I have NT7, every time I try to compile it I get these stupid little error messages. Something about the name and blah blah blah

Reply With Quote
 
  #9 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

hey skyfly,

please stay in ONE thread with your comiling / importing-issues !
you have one main problem in your Ninja that causes all these errors when compiling / importing.

this has to be find & solved before anything else is working.
please stay here https://futures.io/ninjatrader-programming/4594-when-i-try-input-zip-file-i-get-import-error.html#post50415

+ do all the steps, post screenshots of the errors etc to find out whats the problem at your side.
posting in diff threads makes no sense.
we will assist you if we can !

thanks max

max-td
Reply With Quote
 
  #10 (permalink)
Membership Temporarily Revoked
Texas
 
Futures Experience: Intermediate
Platform: Ninja Trader
Favorite Futures: TF
 
Posts: 113 since Jun 2010
Thanks: 8 given, 51 received


Right ok...my bad, was just venting a little lol. Just because I have no idea how to fix this, or really even explain it. But I'll keep it in one area from now on. Sorry about that.

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

Reply



futures io > > > > NT7 - moving average - green when rising, red when falling?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rockwell MACD Histogram Red/Green stockdisk NinjaTrader Programming 28 May 2nd, 2015 02:55 PM
Moving average Help yiman NinjaTrader Programming 4 July 29th, 2011 09:03 AM
Moving Average (H+L+C)/3 for NT7.0.100.2 PowerM Traders Hideout 9 January 13th, 2011 04:19 AM
NT Rising / Falling formula diverdan Traders Hideout 7 November 1st, 2010 08:45 AM
Double Moving Average Paint For NT7 adrian NinjaTrader Programming 2 June 18th, 2010 06:29 PM


All times are GMT -4. The time now is 02:11 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-11 in 0.16 seconds with 38 queries on phoenix via your IP 54.226.34.209