Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
High/Low bar highlights
Collapse
X
-
High/Low bar highlights
Hey I am curious if its possible to get specific candlestick bars to be highlighted, like, green for a bar whose wick is higher than the two to either side of it?Tags: None
-
Hello Columbcille,
Thank you for your post.
Yes, this is possible. You would need to calculate your logic to detect this and then you can use BarColor to change the color.
http://www.ninjatrader.com/support/h...l?barcolor.htm
Let me know if I can be of further assistance.Cal H.NinjaTrader Customer Service
-
ok thanks, i forgot about strategies, i see that i can make
"When the High of current bar is greater than high of 2 bars ago/1 bar ago..."
how can i add bars ahead of it as well?
Comment
-
NVM just thought of using -1 and -2 and it seems to work, now the question is how can i have this run on a chart that i plant to use chart trader on or is that not able to be done at all?
Comment
-
-
Columbcille,
I have attached a sample script of how this is setup in the code.
* Download the indicator to your desktop, keep them in the compressed .zip file.
* From the Control Center window select the menu File> Utilities> Import NinjaScript
* Select the downloaded .zip file
* NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some indicators, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'Attached FilesCal H.NinjaTrader Customer Service
Comment
-
i Tried to copy the code from the strategy and paste it as an indicator, however it doesnt show, the scrit also looks different from the one you provided but that may not mean anything from wha ti know about scripting there are 1000 ways to skin a cat here is what i have
HTML 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> /// Displays the Highs and Lows /// </summary> [Description("Displays the Highs and Lows")] public class HighLows : Indicator { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // User defined variables (add any user defined variables below) #endregion /// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { CalculateOnBarClose = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (High[0] > High[1] && High[0] > High[-1] && High[0] > High[2] && High[0] > High[-2]) { BarColor = Color.Green; } // Condition set 2 if (Low[0] < Low[1] && Low[0] < Low[-1] && Low[0] < Low[2] && Low[0] < Low[-2]) { BarColor = Color.Red; } } #region Properties [Description("")] [GridCategory("Parameters")] public int MyInput0 { get { return myInput0; } set { myInput0 = 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 HighLows[] cacheHighLows = null; private static HighLows checkHighLows = new HighLows(); /// <summary> /// Displays the Highs and Lows /// </summary> /// <returns></returns> public HighLows HighLows(int myInput0) { return HighLows(Input, myInput0); } /// <summary> /// Displays the Highs and Lows /// </summary> /// <returns></returns> public HighLows HighLows(Data.IDataSeries input, int myInput0) { if (cacheHighLows != null) for (int idx = 0; idx < cacheHighLows.Length; idx++) if (cacheHighLows[idx].MyInput0 == myInput0 && cacheHighLows[idx].EqualsInput(input)) return cacheHighLows[idx]; lock (checkHighLows) { checkHighLows.MyInput0 = myInput0; myInput0 = checkHighLows.MyInput0; if (cacheHighLows != null) for (int idx = 0; idx < cacheHighLows.Length; idx++) if (cacheHighLows[idx].MyInput0 == myInput0 && cacheHighLows[idx].EqualsInput(input)) return cacheHighLows[idx]; HighLows indicator = new HighLows(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.MyInput0 = myInput0; Indicators.Add(indicator); indicator.SetUp(); HighLows[] tmp = new HighLows[cacheHighLows == null ? 1 : cacheHighLows.Length + 1]; if (cacheHighLows != null) cacheHighLows.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheHighLows = 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> /// Displays the Highs and Lows /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.HighLows HighLows(int myInput0) { return _indicator.HighLows(Input, myInput0); } /// <summary> /// Displays the Highs and Lows /// </summary> /// <returns></returns> public Indicator.HighLows HighLows(Data.IDataSeries input, int myInput0) { return _indicator.HighLows(input, myInput0); } } } // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { public partial class Strategy : StrategyBase { /// <summary> /// Displays the Highs and Lows /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.HighLows HighLows(int myInput0) { return _indicator.HighLows(Input, myInput0); } /// <summary> /// Displays the Highs and Lows /// </summary> /// <returns></returns> public Indicator.HighLows HighLows(Data.IDataSeries input, int myInput0) { 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.HighLows(input, myInput0); } } } #endregion
Last edited by Columbcille; 05-04-2014, 04:35 PM.
Comment
-
these might help
I found two indicators which might assist you. between these two you might be able to build your own indicator with the features you are looking for.
1. BW fractals, it will paint a text message above/below the bar on a high/low confirmed swings (the lowest low or highest high within 5 bars). As this is a free indicator I can attach it for download.
2. neoFractalHighLow, it will paint arrows above/below the bar. It is a free indicator once you register for Neoharmonics newsletter on their site.
I personaly prefer the bwfractals as the neofractal gives too many signals.Attached Files
Comment
-
Comment
-
-
hi no there were no errors, i pplied the first solution in your link and checked again and only the minute charts work still
Comment
-
so i had finally got it working, decided the bar color was becoming more distracting and decided to add triangles, but now thats not showing up :-p when i change false to true they show up but not on the bars themselves.. any ideas?
#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>
/// Displays the High and Low Bars
/// </summary>
[Description("Displays the Highs and Lows")]
public class HighLows : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar<1)
return;
// Condition set 1
if (High[0] > High[1]
&& High[0] > High[-1]
&& High[0] > High[2]
&& High[0] > High[-2])
{
DrawTriangleUp("High" + CurrentBar, false, 0, 0, Color.Lime);
}
// Condition set 2
if (Low[0] < Low[1]
&& Low[0] < Low[-1]
&& Low[0] < Low[2]
&& Low[0] < Low[-2])
{
DrawTriangleDown("Low" + CurrentBar, false, 0, 0, Color.Red);
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = 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 HighLows[] cacheHighLows = null;
private static HighLows checkHighLows = new HighLows();
/// <summary>
/// Displays the Highs and Lows
/// </summary>
/// <returns></returns>
public HighLows HighLows(int myInput0)
{
return HighLows(Input, myInput0);
}
/// <summary>
/// Displays the Highs and Lows
/// </summary>
/// <returns></returns>
public HighLows HighLows(Data.IDataSeries input, int myInput0)
{
if (cacheHighLows != null)
for (int idx = 0; idx < cacheHighLows.Length; idx++)
if (cacheHighLows[idx].MyInput0 == myInput0 && cacheHighLows[idx].EqualsInput(input))
return cacheHighLows[idx];
lock (checkHighLows)
{
checkHighLows.MyInput0 = myInput0;
myInput0 = checkHighLows.MyInput0;
if (cacheHighLows != null)
for (int idx = 0; idx < cacheHighLows.Length; idx++)
if (cacheHighLows[idx].MyInput0 == myInput0 && cacheHighLows[idx].EqualsInput(input))
return cacheHighLows[idx];
HighLows indicator = new HighLows();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.MyInput0 = myInput0;
Indicators.Add(indicator);
indicator.SetUp();
HighLows[] tmp = new HighLows[cacheHighLows == null ? 1 : cacheHighLows.Length + 1];
if (cacheHighLows != null)
cacheHighLows.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheHighLows = 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>
/// Displays the Highs and Lows
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.HighLows HighLows(int myInput0)
{
return _indicator.HighLows(Input, myInput0);
}
/// <summary>
/// Displays the Highs and Lows
/// </summary>
/// <returns></returns>
public Indicator.HighLows HighLows(Data.IDataSeries input, int myInput0)
{
return _indicator.HighLows(input, myInput0);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Displays the Highs and Lows
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.HighLows HighLows(int myInput0)
{
return _indicator.HighLows(Input, myInput0);
}
/// <summary>
/// Displays the Highs and Lows
/// </summary>
/// <returns></returns>
public Indicator.HighLows HighLows(Data.IDataSeries input, int myInput0)
{
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.HighLows(input, myInput0);
}
}
}
#endregion
Comment
-
They would not show up in this config as you draw them at a Y axis price value of 0, so with AutoScale false this would definitely not be seen. Please try to substitute the bar Low / High here for the 0 potentially with an offset of TickSize added so you can better see / distinguish them.BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Aviram Y, Today, 05:29 AM
|
0 responses
1 view
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
25 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
34 views
0 likes
|
Last Post Today, 05:15 AM | ||
Started by cls71, Today, 04:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by cls71
Today, 04:45 AM
|
||
Started by mjairg, 07-20-2023, 11:57 PM
|
3 responses
216 views
1 like
|
Last Post
by PaulMohn
Today, 04:22 AM
|
Comment