NexusFi: Find Your Edge


Home Menu

 





plot color dot on High/low


Discussion in NinjaTrader

Updated
    1. trending_up 3,893 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

plot color dot on High/low

  #1 (permalink)
 edi025 
stuttgart
 
Experience: Advanced
Platform: NinjaTrader, TradeStation
Posts: 20 since Nov 2009
Thanks Given: 30
Thanks Received: 23

Hi,

I need your help in programming an indicator.
And I wish that I display by a color dot the High and Low Close vin. I have it already but it only shows me one by one color. But I want two colors.
So it should look something ..

https://img705.imageshack.us/img705/7481/bild4zh.png

this is the code of dot plot .
Thank you

 
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>
    /// Plots Dots On OHLC
    /// </summary>
    
[Description("Plots Dots On OHLC")]
    public class 
PlotDot Indicator
    
{
        
#region Variables
        // Wizard generated variables
            
private string tag = @"Dots"// Default setting for Tag
            
private bool autoscale true// Default setting for Autoscale
            
private int barsago 0// Default setting for Barsago
            
private double y 0// Default setting for Y
        // 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.White), PlotStyle.Dot"Plot0"));
            
CalculateOnBarClose    true;
            
Overlay                true;
            
PriceTypeSupported    false;
        }

        
/// <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.
            
Plot0.Set(Close[0]);
        }

        
#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 Plot0
        
{
            
get { return Values[0]; }
        }

        [
Description("Marked Dots")]
        [
Category("Parameters")]
        public 
string Tag
        
{
            
get { return tag; }
            
set tag value; }
        }

        [
Description("")]
        [
Category("Parameters")]
        public 
bool Autoscale
        
{
            
get { return autoscale; }
            
set autoscale value; }
        }

        [
Description("")]
        [
Category("Parameters")]
        public 
int Barsago
        
{
            
get { return barsago; }
            
set barsago Math.Max(0value); }
        }

        [
Description("")]
        [
Category("Parameters")]
        public 
double Y
        
{
            
get { return y; }
            
set Math.Max(0value); }
        }
        
#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 
PlotDot[] cachePlotDot null;

        private static 
PlotDot checkPlotDot = new PlotDot();

        
/// <summary>
        /// Plots Dots On OHLC
        /// </summary>
        /// <returns></returns>
        
public PlotDot PlotDot(bool autoscaleint barsagostring tagdouble y)
        {
            return 
PlotDot(Inputautoscalebarsagotagy);
        }

        
/// <summary>
        /// Plots Dots On OHLC
        /// </summary>
        /// <returns></returns>
        
public PlotDot PlotDot(Data.IDataSeries inputbool autoscaleint barsagostring tagdouble y)
        {
            
checkPlotDot.Autoscale autoscale;
            
autoscale checkPlotDot.Autoscale;
            
checkPlotDot.Barsago barsago;
            
barsago checkPlotDot.Barsago;
            
checkPlotDot.Tag tag;
            
tag checkPlotDot.Tag;
            
checkPlotDot.y;
            
checkPlotDot.Y;

            if (
cachePlotDot != null)
                for (
int idx 0idx cachePlotDot.Lengthidx++)
                    if (
cachePlotDot[idx].Autoscale == autoscale && cachePlotDot[idx].Barsago == barsago && cachePlotDot[idx].Tag == tag && Math.Abs(cachePlotDot[idx].y) <= double.Epsilon && cachePlotDot[idx].EqualsInput(input))
                        return 
cachePlotDot[idx];

            
PlotDot indicator = new PlotDot();
            
indicator.BarsRequired BarsRequired;
            
indicator.CalculateOnBarClose CalculateOnBarClose;
            
indicator.Input input;
            
indicator.Autoscale autoscale;
            
indicator.Barsago barsago;
            
indicator.Tag tag;
            
indicator.y;
            
indicator.SetUp();

            
PlotDot[] tmp = new PlotDot[cachePlotDot == null cachePlotDot.Length 1];
            if (
cachePlotDot != null)
                
cachePlotDot.CopyTo(tmp0);
            
tmp[tmp.Length 1] = indicator;
            
cachePlotDot 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>
        /// Plots Dots On OHLC
        /// </summary>
        /// <returns></returns>
        
[Gui.Design.WizardCondition("Indicator")]
        public 
Indicator.PlotDot PlotDot(bool autoscaleint barsagostring tagdouble y)
        {
            return 
_indicator.PlotDot(Inputautoscalebarsagotagy);
        }

        
/// <summary>
        /// Plots Dots On OHLC
        /// </summary>
        /// <returns></returns>
        
public Indicator.PlotDot PlotDot(Data.IDataSeries inputbool autoscaleint barsagostring tagdouble y)
        {
            return 
_indicator.PlotDot(inputautoscalebarsagotagy);
        }

    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public 
partial class Strategy StrategyBase
    
{
        
/// <summary>
        /// Plots Dots On OHLC
        /// </summary>
        /// <returns></returns>
        
[Gui.Design.WizardCondition("Indicator")]
        public 
Indicator.PlotDot PlotDot(bool autoscaleint barsagostring tagdouble y)
        {
            return 
_indicator.PlotDot(Inputautoscalebarsagotagy);
        }

        
/// <summary>
        /// Plots Dots On OHLC
        /// </summary>
        /// <returns></returns>
        
public Indicator.PlotDot PlotDot(Data.IDataSeries inputbool autoscaleint barsagostring tagdouble y)
        {
            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.PlotDot(inputautoscalebarsagotagy);
        }

    }
}
#endregion 

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
 
  #3 (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


repeat plot0 and change its name to plot1

...
then you can plot the high, add third plot to plot the open etc...

Plot1.Set(High[0]);

Reply With Quote
Thanked by:
  #4 (permalink)
 edi025 
stuttgart
 
Experience: Advanced
Platform: NinjaTrader, TradeStation
Posts: 20 since Nov 2009
Thanks Given: 30
Thanks Received: 23

I'll try it.

Thank you [COLOR=white]cory [/COLOR]

Started this thread Reply With Quote




Last Updated on June 28, 2010


© 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