The indicator I programed works perfect with the the default dataseies instrument. Based on the default instrument, Volume variable works as a trigger to make all the extra calculations.
The problem I have is if I add an extra instrument dataseries to calculate only the Volume variable, reamaining the default instrument for the extra calculations.
I added in bold this lines to the code:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
...
...
...
else if (State == State.Configure)
{
AddDataSeries("NAME OF ADDITIONAL INSTRUMENT", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
}
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()
{
//this is the default value for Vlolume calculation with default instrument
Value[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
In the example below in the condition if (Value[1] >= VolRelev1) // "Value[1] is the "defalult instrument" volume and if condition is true then wil draw a fibo based on "defalult instrument" data.
if (Value[1] >= VolRelev1)
{
Draw.FibonacciRetracements(this, "FiboUp", true, 10, Low[Math.Max(0, Swing(SwingVRUp).SwingLowBar(0, 1, 100))], -10, High[1]);
}
But the problen is in the exmple below. If the condition if (Volumes[1][1] >= VolRelev1) // Volumes[1][1] is the "added instrument" volume and I expect that if condition is true then will draw a fibo based in "default intrument" data. But it is drawing the fibo based in the added instrument too, and I do not want that.
if (Volumes[1][1] >= VolRelev1)
{
Draw.FibonacciRetracements(this, "FiboUp", true, 10, Low[Math.Max(0, Swing(SwingVRUp).SwingLowBar(0, 1, 100))], -10, High[1]);
}
Please could you help me?
Kind regards,
Marcos L.
Comment