right now all doji bars have a green volume bar
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Need black volume bar for doji bars
Collapse
X
-
Need black volume bar for doji bars
can some one add that a doji bar (a price bar where it closes on its open) can have a black color for its volume bar?
right now all doji bars have a green volume barTags: None
-
Hi, streetffightingman, thanks for your post.
For normal plotting, you can use the PlotBrushes array to change the color of a specific brush. e.g.
Code:if(Open[0] == Close[0]) { PlotBrushes[0][0] = Brushes.Black; PlotBrushes[1][0] = Brushes.Black; } else { PlotBrushes[0][0] = Brushes.LimeGreen; PlotBrushes[1][0] = Brushes.Red; }
Please let me know if this does not resolve your inquiry.Chris L.NinjaTrader Customer Service
-
The problem is I do not know how to code. If you could tell me where to copy and paste code into the editor I would be so grateful cause Im an idiot to code.
Comment
-
maybe it would be easier to change this indicator in NT8
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
namespace NinjaTrader.NinjaScript.Indicators
{
public class VolumeUpDown : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Calculate = Calculate.OnBarClose;
Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionVolumeUpDown;
DrawOnPricePanel = false;
IsOverlay = false;
IsSuspendedWhileInactive = true;
Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNa meVolumeUpDown;
AddPlot(new Stroke(Brushes.DarkCyan, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.VolumeUp);
AddPlot(new Stroke(Brushes.Crimson, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.VolumeDown);
AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZe roLine);
}
else if (State == State.Historical)
{
if (Calculate == Calculate.OnPriceChange)
{
Draw.TextFixed(this, "NinjaScriptInfo", string.Format(NinjaTrader.Custom.Resource.NinjaScr iptOnPriceChangeError, Name), TextPosition.BottomRight);
Log(string.Format(NinjaTrader.Custom.Resource.Ninj aScriptOnPriceChangeError, Name), LogLevel.Error);
}
}
}
protected override void OnBarUpdate()
{
if (Close[0] >= Open[0])
{
UpVolume[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
DownVolume.Reset();
}
else
{
UpVolume.Reset();
DownVolume[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
}
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> DownVolume
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> UpVolume
{
get { return Values[0]; }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private VolumeUpDown[] cacheVolumeUpDown;
public VolumeUpDown VolumeUpDown()
{
return VolumeUpDown(Input);
}
public VolumeUpDown VolumeUpDown(ISeries<double> input)
{
if (cacheVolumeUpDown != null)
for (int idx = 0; idx < cacheVolumeUpDown.Length; idx++)
if (cacheVolumeUpDown[idx] != null && cacheVolumeUpDown[idx].EqualsInput(input))
return cacheVolumeUpDown[idx];
return CacheIndicator<VolumeUpDown>(new VolumeUpDown(), input, ref cacheVolumeUpDown);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.VolumeUpDown VolumeUpDown()
{
return indicator.VolumeUpDown(Input);
}
public Indicators.VolumeUpDown VolumeUpDown(ISeries<double> input )
{
return indicator.VolumeUpDown(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.VolumeUpDown VolumeUpDown()
{
return indicator.VolumeUpDown(Input);
}
public Indicators.VolumeUpDown VolumeUpDown(ISeries<double> input )
{
return indicator.VolumeUpDown(input);
}
}
}
#endregion
Comment
-
Hello streetffightingman,
Thanks for your reply.
Even modifying a simple script involves a number of steps.
To get you going, as this was a simple modification, I've modified the VolumeUpDown indicator (Renamed as VolumeUpDownDoji) to meet your request. Please note that this is provided as a courtesy and that it is against our policy make custom modifications.
If in the future you have similar needs, we recommend that you either take the time to learn C#/Ninjascript or seek 3rd party programmer's to create what you need.
Here is a screenshot of the indicator comparing the standard Volume Up down with the VolumeUpDownDoji. Below the screenshot is a link to download the indicator.
Link: [ATTACH]n1076900[/ATTACH]Paul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by benmarkal, Yesterday, 12:52 PM
|
3 responses
23 views
0 likes
|
Last Post Today, 05:22 AM | ||
Started by helpwanted, Today, 03:06 AM
|
1 response
19 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
11 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
244 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
388 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
Comment