I am contacting you because I made script for a volume indicator which has colored bars if the volume reaches a certain thershold and draws rectangles on the price panel around the concerned candlesticks, basically. It compiled ok and seems to work perfectly on the FDAX and FDXM futures. However on the FSEX future it plots nothing and the indicator appears blank, no bars at all. I do not understand why (see the attached picture).
What I did is I created a new indicator and then copied the script lines of the VOL indicator, and then added the necessary lines to color the bars for values bigger than a certain limit, and then those to draw the rectangles around the price sticks. Its pretty simple.
Another thing I'd like to ask is why the soooo long name with the false,true statments and the #F00.. infos. Why is it appearing like that? I am doing something wrong with the script below? (see fragment attached)
Thank you very much.
namespace NinjaTrader.NinjaScript.Indicators
{
public class AlexVolv2 : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = Custom.Resource.NinjaScriptIndicatorDescriptionVOL ;
Name = "AlexVolv2";
BarsRequiredToPlot = 0;
Calculate = Calculate.OnEachTick;
DrawOnPricePanel = false;
IsSuspendedWhileInactive = true;
AddPlot(new Stroke(Brushes.DodgerBlue, 2), PlotStyle.Bar, Custom.Resource.VOLVolume);
AddLine(Brushes.DarkGray, 0, Custom.Resource.NinjaScriptIndicatorZeroLine);
VolRel1 = 500; <-- first volume threshold, this can be then modified in the indicator properties
VolRel2 = 1200; <-- first volume threshold, this can also be then modified in the indicator properties
ColorVolRel1 = Brushes.Yellow;
ColorVolRel2 = Brushes.Red;
ActivarZonas = true;
ColorMarcoZonaUp = Brushes.Transparent;
ColorMarcoZonaDown = Brushes.Transparent;
ColorFondoZonaUp = Brushes.Lime;
ColorFondoZonaDown = Brushes.Red;
OpacidadFondoZona = 18;
LongitudZona = 50;
ActivarAlertas = true;
SonidoAlertaVol1 = "";
SonidoAlertaVol2 = "";
TiempoRearmeAlarmas = 15;
}
else if (State == State.Historical)
{
if (Calculate == Calculate.OnPriceChange)
{
Draw.TextFixed(this, "NinjaScriptInfo", string.Format(Custom.Resource.NinjaScriptOnPriceCh angeError, Name), TextPosition.BottomRight);
Log(string.Format(Custom.Resource.NinjaScriptOnPri ceChangeError, Name), LogLevel.Error);
}
}
AllowRemovalOfDrawObjects = true;
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
Value[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
if (Value[0] >= VolRel1)
{
if (ActivarAlertas && SonidoAlertaVol1 != "") // && IsFirstTickOfBar) { //&& doOnce==false) {
{
//PlaySound(SonidoAlertaVol1);
Alert("alerta1", Priority.High, "", SonidoAlertaVol1, TiempoRearmeAlarmas, Brushes.Transparent, Brushes.Transparent);
//doOnce = true;
}
PlotBrushes[0][0] = ColorVolRel1;
if (Close[0] > Open[0] && ActivarZonas)
{
DrawOnPricePanel = true;
Draw.Rectangle(this, "tag1" + CurrentBar, false, 4, Low[0], LongitudZona*-1, High[0], ColorMarcoZonaUp, ColorFondoZonaUp, OpacidadFondoZona);
}
etc
...
...
...

Comment