NexusFi: Find Your Edge


Home Menu

 





MACD with colours wanted


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one alright with 4 posts (0 thanks)
    2. looks_two marker with 3 posts (0 thanks)
    3. looks_3 futurestrader1 with 3 posts (0 thanks)
    4. looks_4 eDanny with 2 posts (7 thanks)
      Best Posters
    1. looks_one eDanny with 3.5 thanks per post
    2. looks_two Markus with 2 thanks per post
    3. looks_3 cory with 1 thanks per post
    4. looks_4 max-td with 0.5 thanks per post
    1. trending_up 9,312 views
    2. thumb_up 12 thanks given
    3. group 8 followers
    1. forum 21 posts
    2. attach_file 6 attachments




 
Search this Thread

MACD with colours wanted

  #11 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hello marker,
welcome to BigMikeTrading - forum !

if you have questions, please provide as much explaination of your topic as you can. if folks dont understand what you mean you will get no answers.
so the best way is to post a screenshot of chart with the indicator and explain it with some more words.

sorry, but with questions like :

where is the line ?
OR
please i need 4 colors !

noone really knows what people are talking about.

hope that makes sense.

looking forward to hear from you !



max-td
Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
26 thanks
Just another trading journal: PA, Wyckoff & Trends
23 thanks
Tao te Trade: way of the WLD
20 thanks
My NQ Trading Journal
19 thanks
HumbleTraders next chapter
9 thanks
  #12 (permalink)
 skyfly 
Texas
 
Posts: 113 since Jun 2010

I'm just wondering how to get the ccs file into ninja trader? Anyone Anyone?

Reply With Quote
  #13 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


we get this question one a month

Reply With Quote
Thanked by:
  #14 (permalink)
 
Dragon's Avatar
 Dragon 
Bellingham, WA
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: 6E, CL
Posts: 491 since Aug 2009
Thanks Given: 747
Thanks Received: 259

wiki much?

Visit my NexusFi Trade Journal Reply With Quote
  #15 (permalink)
 
futurestrader1's Avatar
 futurestrader1 
New York City, USA
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES, CL, 6E
Posts: 149 since Jun 2010
Thanks Given: 81
Thanks Received: 42

Here is what i want...

Based on a MACD with only the AVERAGE line plotting as the line and the histogram bars.

This one has a neutral plot on the histogram...i don't know how.

easy visible signals on the line is nice to have from green to red based on the zero line.

Attached Thumbnails
Click image for larger version

Name:	MacdPAINTS.png
Views:	314
Size:	12.3 KB
ID:	16418  
Reply With Quote
  #16 (permalink)
 
eDanny's Avatar
 eDanny 
East Rochester, NY
 
Experience: Intermediate
Platform: NT
Posts: 329 since Jul 2009
Thanks Given: 18
Thanks Received: 425

...on for size.


futurestrader1 View Post
Here is what i want...

Based on a MACD with only the AVERAGE line plotting as the line and the histogram bars.

This one has a neutral plot on the histogram...i don't know how.

easy visible signals on the line is nice to have from green to red based on the zero line.


Attached Files
Elite Membership required to download: MACD_Z.zip
Reply With Quote
  #17 (permalink)
 
futurestrader1's Avatar
 futurestrader1 
New York City, USA
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES, CL, 6E
Posts: 149 since Jun 2010
Thanks Given: 81
Thanks Received: 42

Thanks eDanny....this is really great!

Reply With Quote
  #18 (permalink)
Markus
Frankfurt am Main
 
Posts: 38 since May 2010
Thanks Given: 6
Thanks Received: 33

Here's the MACD that paints bars when above or below zero line

Attached Files
Elite Membership required to download: MacdZeroLineColorBar.zip
Reply With Quote
Thanked by:
  #19 (permalink)
 
futurestrader1's Avatar
 futurestrader1 
New York City, USA
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES, CL, 6E
Posts: 149 since Jun 2010
Thanks Given: 81
Thanks Received: 42


eDanny View Post
...on for size.

Thanks.... I've been finding that the AVERAGE line, which you supplied above is great but the actual MACD signal line can work even better.

Can you please code it for the Signal line.... or if someone could reply with the code adjustment.


 
Code
 // 
//

#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// The MACD_Z is a trend following momentum indicator.
    /// </summary>
    [Description("The MACD_Z is a trend following momentum indicator.")]
    public class MACD_Z : Indicator
    {
        #region Variables
        private int                    fast    = 5;
        private int                    slow    = 15;
        private int                    smooth    = 10;
        private MACD Z;
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Add(new Plot(new Pen(Color.Green, 2), PlotStyle.Line, "Z_Hi"));
            Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Line, "Z_Lo"));
            Add(new Plot(new Pen(Color.Green, 3), PlotStyle.Bar, "Z_Rising"));
            Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Bar, "Z_Falling"));
            Add(new Plot(new Pen(Color.DimGray, 3), PlotStyle.Bar, "Z_Neutral"));

            CalculateOnBarClose = false;
            
        }
        public override string ToString()
        {return Name;}
        /// <summary>
        /// Calculates the indicator value(s) at the current index.
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBar == 0)
            {
                Z = MACD(Close, fast, slow, smooth);
                Plots[0].Min = 0;            
                Plots[1].Max = 0;
            }
            else
            {
                ZHi.Set(Z.Avg[0]); ZLo.Set(Z.Avg[0]);
                if(ZHi[0] > 0 && Z.Diff[0] > 0)
                    ZR.Set(Z.Diff[0]);
                else
                if(ZLo[0] < 0 && Z.Diff[0] < 0)
                    ZF.Set(Z.Diff[0]);
                else
                    ZN.Set(Z.Diff[0]);
            }
        }

        #region Properties
        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries ZHi
        {
            get { return Values[0]; }
        }
        
        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries ZLo
        {
            get { return Values[1]; }
        }

        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries ZR
        {
            get { return Values[2]; }
        }
        
        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries ZF
        {
            get { return Values[3]; }
        }
        
        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries ZN
        {
            get { return Values[4]; }
        }

        /// <summary>
        /// </summary>
        [Description("Number of bars, fast")]
        [Category("Parameters")]
        public int Fast
        {
            get { return fast; }
            set { fast = Math.Max(1, value); }
        }

        /// <summary>
        /// </summary>
        [Description("Number of bars, slow")]
        [Category("Parameters")]
        public int Slow
        {
            get { return slow; }
            set { slow = Math.Max(1, value); }
        }

        /// <summary>
        /// </summary>
        [Description("Number of bars, smoothing")]
        [Category("Parameters")]
        public int Smooth
        {
            get { return smooth; }
            set { smooth = Math.Max(1, value); }
        }
        #endregion
    }
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    public partial class Indicator : IndicatorBase
    {
        private MACD_Z[] cacheMACD_Z = null;

        private static MACD_Z checkMACD_Z = new MACD_Z();

        /// <summary>
        /// The MACD_Z is a trend following momentum indicator.
        /// </summary>
        /// <returns></returns>
        public MACD_Z MACD_Z(int fast, int slow, int smooth)
        {
            return MACD_Z(Input, fast, slow, smooth);
        }

        /// <summary>
        /// The MACD_Z is a trend following momentum indicator.
        /// </summary>
        /// <returns></returns>
        public MACD_Z MACD_Z(Data.IDataSeries input, int fast, int slow, int smooth)
        {
            checkMACD_Z.Fast = fast;
            fast = checkMACD_Z.Fast;
            checkMACD_Z.Slow = slow;
            slow = checkMACD_Z.Slow;
            checkMACD_Z.Smooth = smooth;
            smooth = checkMACD_Z.Smooth;

            if (cacheMACD_Z != null)
                for (int idx = 0; idx < cacheMACD_Z.Length; idx++)
                    if (cacheMACD_Z[idx].Fast == fast && cacheMACD_Z[idx].Slow == slow && cacheMACD_Z[idx].Smooth == smooth && cacheMACD_Z[idx].EqualsInput(input))
                        return cacheMACD_Z[idx];

            MACD_Z indicator = new MACD_Z();
            indicator.BarsRequired = BarsRequired;
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.Fast = fast;
            indicator.Slow = slow;
            indicator.Smooth = smooth;
            indicator.SetUp();

            MACD_Z[] tmp = new MACD_Z[cacheMACD_Z == null ? 1 : cacheMACD_Z.Length + 1];
            if (cacheMACD_Z != null)
                cacheMACD_Z.CopyTo(tmp, 0);
            tmp[tmp.Length - 1] = indicator;
            cacheMACD_Z = tmp;
            Indicators.Add(indicator);

            return indicator;
        }

    }
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
    public partial class Column : ColumnBase
    {
        /// <summary>
        /// The MACD_Z is a trend following momentum indicator.
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.MACD_Z MACD_Z(int fast, int slow, int smooth)
        {
            return _indicator.MACD_Z(Input, fast, slow, smooth);
        }

        /// <summary>
        /// The MACD_Z is a trend following momentum indicator.
        /// </summary>
        /// <returns></returns>
        public Indicator.MACD_Z MACD_Z(Data.IDataSeries input, int fast, int slow, int smooth)
        {
            return _indicator.MACD_Z(input, fast, slow, smooth);
        }

    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// The MACD_Z is a trend following momentum indicator.
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.MACD_Z MACD_Z(int fast, int slow, int smooth)
        {
            return _indicator.MACD_Z(Input, fast, slow, smooth);
        }

        /// <summary>
        /// The MACD_Z is a trend following momentum indicator.
        /// </summary>
        /// <returns></returns>
        public Indicator.MACD_Z MACD_Z(Data.IDataSeries input, int fast, int slow, int smooth)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.MACD_Z(input, fast, slow, smooth);
        }

    }
}
#endregion

Reply With Quote
  #20 (permalink)
 marker 
Las Vegas, NV
 
Experience: None
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL
Posts: 102 since Jun 2010
Thanks Given: 115
Thanks Received: 105


I agree, this looks good and it would be better if it had the option to plot both the signal and average lines or just one of them. Thanks again, I'm not a coder, but would think it would be simple to do. Thanks!

Reply With Quote




Last Updated on September 6, 2012


© 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