NexusFi: Find Your Edge


Home Menu

 





H-igh L-ow C-lose bars


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one cory with 7 posts (3 thanks)
    2. looks_two danjuma with 7 posts (0 thanks)
    3. looks_3 arcade with 2 posts (0 thanks)
    4. looks_4 gio5959 with 2 posts (1 thanks)
      Best Posters
    1. looks_one tarantino with 3 thanks per post
    2. looks_two pawnbroker with 3 thanks per post
    3. looks_3 trendisyourfriend with 2 thanks per post
    4. looks_4 cory with 0.4 thanks per post
    1. trending_up 14,698 views
    2. thumb_up 12 thanks given
    3. group 11 followers
    1. forum 30 posts
    2. attach_file 9 attachments




 
Search this Thread

H-igh L-ow C-lose bars

  #11 (permalink)
 
Silvester17's Avatar
 Silvester17 
Columbus, OH
Market Wizard
 
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,603 since Aug 2009
Thanks Given: 5,139
Thanks Received: 11,527


gio5959 View Post
can one of you guys zip this for nt7 - tia

here's the zip for nt7

Attached Files
Elite Membership required to download: HLCLines2.zip
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
About a successful futures trader who didnt know anythin …
Psychology and Money Management
 
  #12 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,176
Thanks Received: 6,020

HLCloseLines modified by FatTails for NT7


Same version by the orginal author (eDanny) from www.integrity-traders.com

Reply With Quote
Thanked by:
  #13 (permalink)
 gio5959 
Chiron
 
Experience: None
Platform: ninjatrader
Broker: Amp Futures/Zen-Fire
Trading: ES
Posts: 737 since Aug 2009
Thanks Given: 25
Thanks Received: 155


i vote for silvestor17 as my best friend at futures.io (formerly BMT)

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #14 (permalink)
 
madLyfe's Avatar
 madLyfe 
Des Moines, Iowa
 
Experience: None
Platform: Ninja, TOS
Broker: AMP/CQG, TOS
Trading: CL, TF, GC
Posts: 1,641 since Feb 2011
Thanks Given: 9,220
Thanks Received: 1,020


Silvester17 View Post
here's the zip for nt7

so does this need those other files on the previous page or is this the only zip we need to get HLC bars? i saw fattys bars from the link posted how do those work out?

dont believe anything you hear and only half of what you see

¯\_(ツ)_/¯

(╯°□°)╯︵ ┻━┻
Visit my NexusFi Trade Journal Reply With Quote
  #15 (permalink)
 danjuma 
London, UK
 
Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker: IB, Kinetic
Trading: Stocks, Forex
Posts: 98 since Nov 2011
Thanks Given: 47
Thanks Received: 16

Hello,

Code below is the code for the modified version (to work on NT7) of the original HLC Bars (the NT 6.5 version from the NT Forum). I prefer the look of this, only problem is the bars are not coloured (green for up, red for down), just grey. Would somebody be kind enough to modify this so it colours (or advise me what to change in the code so it colours)?

Many thanks
Dan

 
Code
//
// Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//
// Modified by MrJoe
//   14.may.2011 - first release
//   15.may.2011 - automatic resize of the closing tick line 
//

#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>
    /// HLC Bars for VSA.
    /// </summary>
    [Description("HLC Bars for VSA")]
    public class HLCBars : Indicator
    {
        #region Variables
        private Color           savePenColor         = Color.Transparent;
        private Color           savePen2Color        = Color.Transparent;
        private Color           saveDownColor        = Color.Empty;
        private Color           saveUpColor          = Color.Empty;
        private Color           m_barColor           = Color.Gray;
        private Pen				m_barPen		     = null;
		private int             m_barWidth           = 0;
        #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(Color.Gray, PlotStyle.Line, "MOpen"));
            Add(new Plot(Color.Gray, PlotStyle.Line, "MHigh"));
            Add(new Plot(Color.Gray, PlotStyle.Line, "MLow"));
            Add(new Plot(Color.Gray, PlotStyle.Line, "MClose"));
			ZOrder				= 1;
            PaintPriceMarkers   = false;
            CalculateOnBarClose = false;
            PlotsConfigurable   = false;
            Overlay             = true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			MClose.Set(Close[0]);
            MHigh.Set(High[0]);
            MLow.Set(Low[0]);
        }

        #region Properties


        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MOpen
        {
            get { return Values[0]; }
        }

        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MHigh
        {
            get { return Values[1]; }
        }

        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MLow
        {
            get { return Values[2]; }
        }

        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MClose
        {
            get { return Values[3]; }
        }	
		
        [Description("Forced HLC bar width (0 = use Data Series settings).")]
        [Category("Settings")]
        [Gui.Design.DisplayNameAttribute("Bar width")]
        public int HLCBarWidth
        {
            get { return m_barWidth; }
            set { m_barWidth = value; }
        }

        [XmlIgnore]
        [Description("Color of bars.")]
        [Category("Settings")]
        [Gui.Design.DisplayNameAttribute("Color of bars")]
        public Color HLCBarColor
        {
            get { return m_barColor; }
            set { m_barColor = value; }
        }

        [Browsable(false)]
        public string HLCBarColorSerialize
        {
            get { return Gui.Design.SerializableColor.ToString(m_barColor); }
            set { m_barColor = Gui.Design.SerializableColor.FromString(value); }
        }


        #endregion

		private int GetBarWidth()
		{
			if ( m_barWidth != 0 ) {
				return m_barWidth;
			}
			else {
				return Bars.BarsData.ChartStyle.BarWidthUI;
			}
		}
		
        protected override void OnStartUp()
        {
            if (ChartControl == null || Bars == null)
                return;
            savePenColor                        = Bars.BarsData.ChartStyle.Pen.Color;
            savePen2Color                       = Bars.BarsData.ChartStyle.Pen2.Color;
            saveUpColor                         = Bars.BarsData.ChartStyle.UpColor;
            saveDownColor                       = Bars.BarsData.ChartStyle.DownColor;
            Bars.BarsData.ChartStyle.Pen.Color  = Color.Empty;
            Bars.BarsData.ChartStyle.Pen2.Color = Color.Empty;
            Bars.BarsData.ChartStyle.DownColor  = Color.Empty;
            Bars.BarsData.ChartStyle.UpColor    = Color.Empty;
            m_barPen                            = new Pen(m_barColor, GetBarWidth());
       }

        protected override void OnTermination()
        {
            if (ChartControl != null && Bars != null)
            {
                Bars.BarsData.ChartStyle.Pen.Color = savePenColor;
                Bars.BarsData.ChartStyle.Pen2.Color = savePen2Color;
                Bars.BarsData.ChartStyle.UpColor = saveUpColor;
                Bars.BarsData.ChartStyle.DownColor = saveDownColor;
            }

            if (m_barPen != null) m_barPen.Dispose();
       }

        public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
        {
			if (Bars == null || ChartControl == null)
                return;

			if ( GetBarWidth() != m_barPen.Width ) {
				m_barPen.Dispose();
				m_barPen = new Pen(m_barColor, GetBarWidth());
			}
			
			int tickWidth = Math.Max(3, 2 + 3 * (GetBarWidth() - 1));
			
            for (int idx = FirstBarIndexPainted; idx <= LastBarIndexPainted; idx++)
            {
                if (idx - Displacement < 0 || idx - Displacement >= BarsArray[0].Count || (!ChartControl.ShowBarsRequired && idx - Displacement < BarsRequired))
                    continue;
                double valH = MHigh.Get(idx);
                double valL = MLow.Get(idx);
                double valC = MClose.Get(idx);
                int x = ChartControl.GetXByBarIdx(BarsArray[0], idx);
                int y2 = ChartControl.GetYByValue(this, valH);
                int y3 = ChartControl.GetYByValue(this, valL);
                int y4 = ChartControl.GetYByValue(this, valC);

                graphics.DrawLine(m_barPen, x, y2, x, y3);
				graphics.DrawLine(m_barPen, x, y4, x + tickWidth, y4);
            }
        }

    }
}

#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 HLCBars[] cacheHLCBars = null;

        private static HLCBars checkHLCBars = new HLCBars();

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public HLCBars HLCBars()
        {
            return HLCBars(Input);
        }

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public HLCBars HLCBars(Data.IDataSeries input)
        {
            if (cacheHLCBars != null)
                for (int idx = 0; idx < cacheHLCBars.Length; idx++)
                    if (cacheHLCBars[idx].EqualsInput(input))
                        return cacheHLCBars[idx];

            lock (checkHLCBars)
            {
                if (cacheHLCBars != null)
                    for (int idx = 0; idx < cacheHLCBars.Length; idx++)
                        if (cacheHLCBars[idx].EqualsInput(input))
                            return cacheHLCBars[idx];

                HLCBars indicator = new HLCBars();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                HLCBars[] tmp = new HLCBars[cacheHLCBars == null ? 1 : cacheHLCBars.Length + 1];
                if (cacheHLCBars != null)
                    cacheHLCBars.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheHLCBars = tmp;
                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>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.HLCBars HLCBars()
        {
            return _indicator.HLCBars(Input);
        }

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public Indicator.HLCBars HLCBars(Data.IDataSeries input)
        {
            return _indicator.HLCBars(input);
        }
    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.HLCBars HLCBars()
        {
            return _indicator.HLCBars(Input);
        }

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public Indicator.HLCBars HLCBars(Data.IDataSeries input)
        {
            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.HLCBars(input);
        }
    }
}
#endregion

Reply With Quote
  #16 (permalink)
 
madLyfe's Avatar
 madLyfe 
Des Moines, Iowa
 
Experience: None
Platform: Ninja, TOS
Broker: AMP/CQG, TOS
Trading: CL, TF, GC
Posts: 1,641 since Feb 2011
Thanks Given: 9,220
Thanks Received: 1,020


danjuma View Post
Hello,

Code below is the code for the modified version (to work on NT7) of the original HLC Bars (the NT 6.5 version from the NT Forum). I prefer the look of this, only problem is the bars are not coloured (green for up, red for down), just grey. Would somebody be kind enough to modify this so it colours (or advise me what to change in the code so it colours)?

Many thanks
Dan

 
Code
//
// Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//
// Modified by MrJoe
//   14.may.2011 - first release
//   15.may.2011 - automatic resize of the closing tick line 
//

#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>
    /// HLC Bars for VSA.
    /// </summary>
    [Description("HLC Bars for VSA")]
    public class HLCBars : Indicator
    {
        #region Variables
        private Color           savePenColor         = Color.Transparent;
        private Color           savePen2Color        = Color.Transparent;
        private Color           saveDownColor        = Color.Empty;
        private Color           saveUpColor          = Color.Empty;
        private Color           m_barColor           = Color.Gray;
        private Pen				m_barPen		     = null;
		private int             m_barWidth           = 0;
        #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(Color.Gray, PlotStyle.Line, "MOpen"));
            Add(new Plot(Color.Gray, PlotStyle.Line, "MHigh"));
            Add(new Plot(Color.Gray, PlotStyle.Line, "MLow"));
            Add(new Plot(Color.Gray, PlotStyle.Line, "MClose"));
			ZOrder				= 1;
            PaintPriceMarkers   = false;
            CalculateOnBarClose = false;
            PlotsConfigurable   = false;
            Overlay             = true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			MClose.Set(Close[0]);
            MHigh.Set(High[0]);
            MLow.Set(Low[0]);
        }

        #region Properties


        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MOpen
        {
            get { return Values[0]; }
        }

        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MHigh
        {
            get { return Values[1]; }
        }

        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MLow
        {
            get { return Values[2]; }
        }

        [Browsable(false)]
        [XmlIgnore]
        public DataSeries MClose
        {
            get { return Values[3]; }
        }	
		
        [Description("Forced HLC bar width (0 = use Data Series settings).")]
        [Category("Settings")]
        [Gui.Design.DisplayNameAttribute("Bar width")]
        public int HLCBarWidth
        {
            get { return m_barWidth; }
            set { m_barWidth = value; }
        }

        [XmlIgnore]
        [Description("Color of bars.")]
        [Category("Settings")]
        [Gui.Design.DisplayNameAttribute("Color of bars")]
        public Color HLCBarColor
        {
            get { return m_barColor; }
            set { m_barColor = value; }
        }

        [Browsable(false)]
        public string HLCBarColorSerialize
        {
            get { return Gui.Design.SerializableColor.ToString(m_barColor); }
            set { m_barColor = Gui.Design.SerializableColor.FromString(value); }
        }


        #endregion

		private int GetBarWidth()
		{
			if ( m_barWidth != 0 ) {
				return m_barWidth;
			}
			else {
				return Bars.BarsData.ChartStyle.BarWidthUI;
			}
		}
		
        protected override void OnStartUp()
        {
            if (ChartControl == null || Bars == null)
                return;
            savePenColor                        = Bars.BarsData.ChartStyle.Pen.Color;
            savePen2Color                       = Bars.BarsData.ChartStyle.Pen2.Color;
            saveUpColor                         = Bars.BarsData.ChartStyle.UpColor;
            saveDownColor                       = Bars.BarsData.ChartStyle.DownColor;
            Bars.BarsData.ChartStyle.Pen.Color  = Color.Empty;
            Bars.BarsData.ChartStyle.Pen2.Color = Color.Empty;
            Bars.BarsData.ChartStyle.DownColor  = Color.Empty;
            Bars.BarsData.ChartStyle.UpColor    = Color.Empty;
            m_barPen                            = new Pen(m_barColor, GetBarWidth());
       }

        protected override void OnTermination()
        {
            if (ChartControl != null && Bars != null)
            {
                Bars.BarsData.ChartStyle.Pen.Color = savePenColor;
                Bars.BarsData.ChartStyle.Pen2.Color = savePen2Color;
                Bars.BarsData.ChartStyle.UpColor = saveUpColor;
                Bars.BarsData.ChartStyle.DownColor = saveDownColor;
            }

            if (m_barPen != null) m_barPen.Dispose();
       }

        public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
        {
			if (Bars == null || ChartControl == null)
                return;

			if ( GetBarWidth() != m_barPen.Width ) {
				m_barPen.Dispose();
				m_barPen = new Pen(m_barColor, GetBarWidth());
			}
			
			int tickWidth = Math.Max(3, 2 + 3 * (GetBarWidth() - 1));
			
            for (int idx = FirstBarIndexPainted; idx <= LastBarIndexPainted; idx++)
            {
                if (idx - Displacement < 0 || idx - Displacement >= BarsArray[0].Count || (!ChartControl.ShowBarsRequired && idx - Displacement < BarsRequired))
                    continue;
                double valH = MHigh.Get(idx);
                double valL = MLow.Get(idx);
                double valC = MClose.Get(idx);
                int x = ChartControl.GetXByBarIdx(BarsArray[0], idx);
                int y2 = ChartControl.GetYByValue(this, valH);
                int y3 = ChartControl.GetYByValue(this, valL);
                int y4 = ChartControl.GetYByValue(this, valC);

                graphics.DrawLine(m_barPen, x, y2, x, y3);
				graphics.DrawLine(m_barPen, x, y4, x + tickWidth, y4);
            }
        }

    }
}

#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 HLCBars[] cacheHLCBars = null;

        private static HLCBars checkHLCBars = new HLCBars();

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public HLCBars HLCBars()
        {
            return HLCBars(Input);
        }

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public HLCBars HLCBars(Data.IDataSeries input)
        {
            if (cacheHLCBars != null)
                for (int idx = 0; idx < cacheHLCBars.Length; idx++)
                    if (cacheHLCBars[idx].EqualsInput(input))
                        return cacheHLCBars[idx];

            lock (checkHLCBars)
            {
                if (cacheHLCBars != null)
                    for (int idx = 0; idx < cacheHLCBars.Length; idx++)
                        if (cacheHLCBars[idx].EqualsInput(input))
                            return cacheHLCBars[idx];

                HLCBars indicator = new HLCBars();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                HLCBars[] tmp = new HLCBars[cacheHLCBars == null ? 1 : cacheHLCBars.Length + 1];
                if (cacheHLCBars != null)
                    cacheHLCBars.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheHLCBars = tmp;
                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>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.HLCBars HLCBars()
        {
            return _indicator.HLCBars(Input);
        }

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public Indicator.HLCBars HLCBars(Data.IDataSeries input)
        {
            return _indicator.HLCBars(input);
        }
    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.HLCBars HLCBars()
        {
            return _indicator.HLCBars(Input);
        }

        /// <summary>
        /// HLC Bars for VSA
        /// </summary>
        /// <returns></returns>
        public Indicator.HLCBars HLCBars(Data.IDataSeries input)
        {
            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.HLCBars(input);
        }
    }
}
#endregion

couldnt you just color them in the data series settings..

dont believe anything you hear and only half of what you see

¯\_(ツ)_/¯

(╯°□°)╯︵ ┻━┻
Visit my NexusFi Trade Journal Reply With Quote
  #17 (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


danjuma View Post
Hello,

Code below is the code for the modified version (to work on NT7) of the original HLC Bars (the NT 6.5 version from the NT Forum). I prefer the look of this, only problem is the bars are not coloured (green for up, red for down), just grey. Would somebody be kind enough to modify this so it colours (or advise me what to change in the code so it colours)?

Many thanks
Dan

look for the word 'Gray' replace it with 'Red' for red color.

Reply With Quote
  #18 (permalink)
 danjuma 
London, UK
 
Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker: IB, Kinetic
Trading: Stocks, Forex
Posts: 98 since Nov 2011
Thanks Given: 47
Thanks Received: 16


madLyfe View Post
couldnt you just color them in the data series settings..

There does not seem to be an option for this?

Thanks

Reply With Quote
  #19 (permalink)
 danjuma 
London, UK
 
Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker: IB, Kinetic
Trading: Stocks, Forex
Posts: 98 since Nov 2011
Thanks Given: 47
Thanks Received: 16


cory View Post
look for the word 'Gray' replace it with 'Red' for red color.

Thanks for you reply cory. I followed your suggestion and changed 'Gray' to 'Red'. but now all bars are coloured red. What I want is red for down bars and green for up bars if you know what I mean. I am struggling to identify which are for up bars and which are for down bars in the code so as to change the colour accordingly. Any assistance please?

Thanks
Dan

Reply With Quote
  #20 (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



danjuma View Post
Thanks for you reply cory. I followed your suggestion and changed 'Gray' to 'Red'. but now all bars are coloured red. What I want is red for down bars and green for up bars if you know what I mean. I am struggling to identify which are for up bars and which are for down bars in the code so as to change the colour accordingly. Any assistance please?

Thanks
Dan

after ( note the left bracket)
......
protected override void OnBarUpdate()
{

add this;

if(Close[0]>Open[0])
{
PlotColors[0][0] = Color.Blue;
PlotColors[1][0] = Color.Blue;
PlotColors[2][0] = Color.Blue;
PlotColors[3][0] = Color.Blue;
}
if(Close[0]<Open[0])
{
PlotColors[0][0] = Color.Red;
PlotColors[1][0] = Color.Red;
PlotColors[2][0] = Color.Red;
PlotColors[3][0] = Color.Red;
}
else
{
PlotColors[0][0] = Color.Gray;
PlotColors[1][0] = Color.Gray;
PlotColors[2][0] = Color.Gray;
PlotColors[3][0] = Color.Gray;
}

Reply With Quote




Last Updated on January 13, 2013


© 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