hide a plot on condition - NinjaTrader Programming | futures io social day trading
futures io futures trading


hide a plot on condition
Updated: Views / Replies:1,998 / 5
Created: by solondon 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
 

hide a plot on condition

  #1 (permalink)
Elite Member
London, UK
 
Futures Experience: Intermediate
Platform: ninja,TS,Meta,Tradeguider
Favorite Futures: FX,Metals
 
Posts: 38 since Sep 2011
Thanks: 9 given, 6 received

hide a plot on condition

Hi

i want to get the commented out section working ie. only plot if a condition is not met. Ive tried ShortProfitTarget.Reset(); but i cant see how to make the plot transparent , any ideas or an example appreciated

protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.MediumBlue), PlotStyle.Line, "LongProfitTarget"));
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ShortProfitTarget"));
Overlay = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
LongProfitTarget.Set(Close[0]+ATR(5)[0]);
ShortProfitTarget.Set(Close[0]-ATR(5)[0]);

// if ((SMA(18)[0] >= SMA(18)[1]
// && SMA(9)[0] >= SMA(9)[1])
// && (SMA(18)[1] < SMA(18)[2] ||
// SMA(9)[1] < SMA(9)[2])
// && (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))

//// PlotColors[0][0] = Color.Transparent;
//
// if ((SMA(18)[0] <= SMA(18)[1]
// && SMA(9)[0] <= SMA(9)[1])
// && (SMA(18)[1] > SMA(18)[2] ||
// SMA(9)[1] > SMA(9)[2])
// && (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))

//// PlotColors[1][0] = Color.Transparent;


}

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
Northern Germany
 
Futures Experience: Intermediate
Platform: NT
Favorite Futures: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,807 received



solondon View Post
Hi

i want to get the commented out section working ie. only plot if a condition is not met. Ive tried ShortProfitTarget.Reset(); but i cant see how to make the plot transparent , any ideas or an example appreciated

Could you perhaps describe what exactly is not working?
Also: please post the complete code, that makes it easier, and wrap code tags around it like:
 
Code
protected override void Initialize()
        {
            Add(new Plot(Color.FromKnownColor(KnownColor.MediumBlue), PlotStyle.Line, "LongProfitTarget"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ShortProfitTarget"));
            Overlay				= true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
         	LongProfitTarget.Set(Close[0]+ATR(5)[0]);
			ShortProfitTarget.Set(Close[0]-ATR(5)[0]);
			
//			if ((SMA(18)[0] >= SMA(18)[1]
//                && SMA(9)[0] >= SMA(9)[1]) 
//				&& (SMA(18)[1] < SMA(18)[2] ||
//				SMA(9)[1] < SMA(9)[2])
//				&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))

////				PlotColors[0][0] = Color.Transparent;
//
//			if ((SMA(18)[0] <= SMA(18)[1]
//                &&  SMA(9)[0] <= SMA(9)[1])
//				&& (SMA(18)[1] > SMA(18)[2] ||
//				SMA(9)[1] > SMA(9)[2])
//				&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10))) 

////				PlotColors[1][0] = Color.Transparent;


			}

vvhg

Hic Rhodos, hic salta.
Reply With Quote
 
  #4 (permalink)
Elite Member
London, UK
 
Futures Experience: Intermediate
Platform: ninja,TS,Meta,Tradeguider
Favorite Futures: FX,Metals
 
Posts: 38 since Sep 2011
Thanks: 9 given, 6 received

Hi

the following plots nothing


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

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class aaPipMaximizer1ProfitTarget : Indicator
    {
        #region Variables
        // Wizard generated variables
            private int aTRperiod = 5; // Default setting for ATRperiod
        // User defined variables (add any user defined variables below)
        #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.FromKnownColor(KnownColor.MediumBlue), PlotStyle.Line, "LongProfitTarget"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ShortProfitTarget"));
            Overlay				= true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
         	LongProfitTarget.Set(Close[0]+ATR(5)[0]);
			ShortProfitTarget.Set(Close[0]-ATR(5)[0]);
			
			if ((SMA(18)[0] >= SMA(18)[1]
                && SMA(9)[0] >= SMA(9)[1]) 
				&& (SMA(18)[1] < SMA(18)[2] ||
				SMA(9)[1] < SMA(9)[2])
				&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))
				PlotColors[0][0] = Color.MediumBlue;
			else
//				LongProfitTarget.Reset();
				PlotColors[0][0] = Color.Transparent;
//
			if ((SMA(18)[0] <= SMA(18)[1]
                &&  SMA(9)[0] <= SMA(9)[1])
				&& (SMA(18)[1] > SMA(18)[2] ||
				SMA(9)[1] > SMA(9)[2])
				&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10))) 
				PlotColors[0][0] = Color.Orange;
			else
//				ShortProfitTarget.Reset();
				PlotColors[1][0] = Color.Transparent;

			}

        #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 LongProfitTarget
        {
            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 ShortProfitTarget
        {
            get { return Values[1]; }
        }

        [Description("")]
        [GridCategory("Parameters")]
        public int ATRperiod
        {
            get { return aTRperiod; }
            set { aTRperiod = 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 aaPipMaximizer1ProfitTarget[] cacheaaPipMaximizer1ProfitTarget = null;

        private static aaPipMaximizer1ProfitTarget checkaaPipMaximizer1ProfitTarget = new aaPipMaximizer1ProfitTarget();

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(int aTRperiod)
        {
            return aaPipMaximizer1ProfitTarget(Input, aTRperiod);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(Data.IDataSeries input, int aTRperiod)
        {
            if (cacheaaPipMaximizer1ProfitTarget != null)
                for (int idx = 0; idx < cacheaaPipMaximizer1ProfitTarget.Length; idx++)
                    if (cacheaaPipMaximizer1ProfitTarget[idx].ATRperiod == aTRperiod && cacheaaPipMaximizer1ProfitTarget[idx].EqualsInput(input))
                        return cacheaaPipMaximizer1ProfitTarget[idx];

            lock (checkaaPipMaximizer1ProfitTarget)
            {
                checkaaPipMaximizer1ProfitTarget.ATRperiod = aTRperiod;
                aTRperiod = checkaaPipMaximizer1ProfitTarget.ATRperiod;

                if (cacheaaPipMaximizer1ProfitTarget != null)
                    for (int idx = 0; idx < cacheaaPipMaximizer1ProfitTarget.Length; idx++)
                        if (cacheaaPipMaximizer1ProfitTarget[idx].ATRperiod == aTRperiod && cacheaaPipMaximizer1ProfitTarget[idx].EqualsInput(input))
                            return cacheaaPipMaximizer1ProfitTarget[idx];

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

                aaPipMaximizer1ProfitTarget[] tmp = new aaPipMaximizer1ProfitTarget[cacheaaPipMaximizer1ProfitTarget == null ? 1 : cacheaaPipMaximizer1ProfitTarget.Length + 1];
                if (cacheaaPipMaximizer1ProfitTarget != null)
                    cacheaaPipMaximizer1ProfitTarget.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheaaPipMaximizer1ProfitTarget = 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>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(int aTRperiod)
        {
            return _indicator.aaPipMaximizer1ProfitTarget(Input, aTRperiod);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(Data.IDataSeries input, int aTRperiod)
        {
            return _indicator.aaPipMaximizer1ProfitTarget(input, aTRperiod);
        }
    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(int aTRperiod)
        {
            return _indicator.aaPipMaximizer1ProfitTarget(Input, aTRperiod);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(Data.IDataSeries input, int aTRperiod)
        {
            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.aaPipMaximizer1ProfitTarget(input, aTRperiod);
        }
    }
}
#endregion

if I remove the conditional attempt to make the plots transparent the code works but i get a plot above and bellow for each bar. ie. this section is causing both plots to hide for every bar

if ((SMA(18)[0] >= SMA(18)[1]
&& SMA(9)[0] >= SMA(9)[1])
&& (SMA(18)[1] < SMA(18)[2] ||
SMA(9)[1] < SMA(9)[2])
&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))
PlotColors[0][0] = Color.MediumBlue;
else
// LongProfitTarget.Reset();
PlotColors[0][0] = Color.Transparent;

what i want is to only show the plot if the condition is met, i want it to show above my entry condition bar

Sorry the logic doesnt look great but im not a great programmer.

thanks in advance


Last edited by solondon; June 29th, 2012 at 09:12 AM.
Reply With Quote
 
  #5 (permalink)
Elite Member
Northern Germany
 
Futures Experience: Intermediate
Platform: NT
Favorite Futures: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,807 received


solondon View Post
Hi

the following plots nothing


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

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class aaPipMaximizer1ProfitTarget : Indicator
    {
        #region Variables
        // Wizard generated variables
            private int aTRperiod = 5; // Default setting for ATRperiod
        // User defined variables (add any user defined variables below)
        #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.FromKnownColor(KnownColor.MediumBlue), PlotStyle.Line, "LongProfitTarget"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ShortProfitTarget"));
            Overlay				= true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
         	LongProfitTarget.Set(Close[0]+ATR(5)[0]);
			ShortProfitTarget.Set(Close[0]-ATR(5)[0]);
			
			if ((SMA(18)[0] >= SMA(18)[1]
                && SMA(9)[0] >= SMA(9)[1]) 
				&& (SMA(18)[1] < SMA(18)[2] ||
				SMA(9)[1] < SMA(9)[2])
				&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))
				PlotColors[0][0] = Color.MediumBlue;
			else
//				LongProfitTarget.Reset();
				PlotColors[0][0] = Color.Transparent;
//
			if ((SMA(18)[0] <= SMA(18)[1]
                &&  SMA(9)[0] <= SMA(9)[1])
				&& (SMA(18)[1] > SMA(18)[2] ||
				SMA(9)[1] > SMA(9)[2])
				&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10))) 
				PlotColors[0][0] = Color.Orange;
			else
//				ShortProfitTarget.Reset();
				PlotColors[1][0] = Color.Transparent;

			}

        #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 LongProfitTarget
        {
            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 ShortProfitTarget
        {
            get { return Values[1]; }
        }

        [Description("")]
        [GridCategory("Parameters")]
        public int ATRperiod
        {
            get { return aTRperiod; }
            set { aTRperiod = 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 aaPipMaximizer1ProfitTarget[] cacheaaPipMaximizer1ProfitTarget = null;

        private static aaPipMaximizer1ProfitTarget checkaaPipMaximizer1ProfitTarget = new aaPipMaximizer1ProfitTarget();

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(int aTRperiod)
        {
            return aaPipMaximizer1ProfitTarget(Input, aTRperiod);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(Data.IDataSeries input, int aTRperiod)
        {
            if (cacheaaPipMaximizer1ProfitTarget != null)
                for (int idx = 0; idx < cacheaaPipMaximizer1ProfitTarget.Length; idx++)
                    if (cacheaaPipMaximizer1ProfitTarget[idx].ATRperiod == aTRperiod && cacheaaPipMaximizer1ProfitTarget[idx].EqualsInput(input))
                        return cacheaaPipMaximizer1ProfitTarget[idx];

            lock (checkaaPipMaximizer1ProfitTarget)
            {
                checkaaPipMaximizer1ProfitTarget.ATRperiod = aTRperiod;
                aTRperiod = checkaaPipMaximizer1ProfitTarget.ATRperiod;

                if (cacheaaPipMaximizer1ProfitTarget != null)
                    for (int idx = 0; idx < cacheaaPipMaximizer1ProfitTarget.Length; idx++)
                        if (cacheaaPipMaximizer1ProfitTarget[idx].ATRperiod == aTRperiod && cacheaaPipMaximizer1ProfitTarget[idx].EqualsInput(input))
                            return cacheaaPipMaximizer1ProfitTarget[idx];

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

                aaPipMaximizer1ProfitTarget[] tmp = new aaPipMaximizer1ProfitTarget[cacheaaPipMaximizer1ProfitTarget == null ? 1 : cacheaaPipMaximizer1ProfitTarget.Length + 1];
                if (cacheaaPipMaximizer1ProfitTarget != null)
                    cacheaaPipMaximizer1ProfitTarget.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheaaPipMaximizer1ProfitTarget = 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>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(int aTRperiod)
        {
            return _indicator.aaPipMaximizer1ProfitTarget(Input, aTRperiod);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(Data.IDataSeries input, int aTRperiod)
        {
            return _indicator.aaPipMaximizer1ProfitTarget(input, aTRperiod);
        }
    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(int aTRperiod)
        {
            return _indicator.aaPipMaximizer1ProfitTarget(Input, aTRperiod);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Indicator.aaPipMaximizer1ProfitTarget aaPipMaximizer1ProfitTarget(Data.IDataSeries input, int aTRperiod)
        {
            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.aaPipMaximizer1ProfitTarget(input, aTRperiod);
        }
    }
}
#endregion

if I remove the conditional attempt to make the plots transparent the code works but i get a plot above and bellow for each bar. ie. this section is causing both plots to hide for every bar

if ((SMA(18)[0] >= SMA(18)[1]
&& SMA(9)[0] >= SMA(9)[1])
&& (SMA(18)[1] < SMA(18)[2] ||
SMA(9)[1] < SMA(9)[2])
&& (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))
PlotColors[0][0] = Color.MediumBlue;
else
// LongProfitTarget.Reset();
PlotColors[0][0] = Color.Transparent;

what i want is to only show the plot if the condition is met, i want it to show above my entry condition bar

Sorry the logic doesnt look great but im not a great programmer.

thanks in advance

OK, that happens because you set the color to transparent when the condition is met, but you don't change it back when the condition doesn't apply anymore. Though i think this will result in the entire plot being either visible or not, and not hiding parts of it (but I'm not sure).

Perhaps you want to have a look at the supertrend indy as that plot might be something similar (in principle) than what you try to achieve, if not, have a look at indicators in the download section for a plot that is similar to what you want and then have a look in the code how it is done...

vvhg

Hic Rhodos, hic salta.
Reply With Quote
The following 2 users say Thank You to vvhg for this post:
 
  #6 (permalink)
Elite Member
London, UK
 
Futures Experience: Intermediate
Platform: ninja,TS,Meta,Tradeguider
Favorite Futures: FX,Metals
 
Posts: 38 since Sep 2011
Thanks: 9 given, 6 received

actually my code want working due to a failure to check for enough bars CurrentBar > 20 , thanks for the help anyway

Reply With Quote

Reply



futures io > > > > > hide a plot on condition

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
Hide / Unhide Indicator Mindset NinjaTrader Programming 32 September 27th, 2014 02:57 PM
Is China Faking Data to Hide True Scale of Slowdown? Quick Summary News and Current Events 0 June 23rd, 2012 12:10 AM
panel condition baberg NinjaTrader Programming 9 September 7th, 2011 02:26 AM
Same condition every hour rajafx1 NinjaTrader Programming 5 August 13th, 2010 06:43 AM
Goldman helped hide some of Greeces debt Big Mike Traders Hideout 5 March 9th, 2010 10:34 AM


All times are GMT -4. The time now is 05:57 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.14 seconds with 19 queries on phoenix via your IP 54.82.79.109