public class VOL : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = Custom.Resource.NinjaScriptIndicatorDescriptionVOL ;
Name = Custom.Resource.NinjaScriptIndicatorNameVOL;
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);
}
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);
}
}
}
protected override void OnBarUpdate()
{
Value[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
}

Comment