Bar 4808 was the last bar/current bar on the chart, I don't know what triggers this error and what means "the given path format is not supported", I searched around the whole forum and couldn't find a similar error, could you please someone give me a hand with this? thanks.
Here is the code:
protected override void OnBarUpdate()
{
if( CurrentBar < BarsRequiredToTrade ) {
return;
}
base.OnBarUpdate();
// Check to see if we're in a time parameter
if( time2trade() == false ) {
return;
}
if( Position.MarketPosition == MarketPosition.Flat )
{
if( macd.Avg[0] > 0 // signal line above zero
&& macd[0] > macd.Upper[0]
&& macd[1] <= macd.Upper[1] ) // cross up
{
doLong();
}
else if( macd.Avg[0] < 0 // signal line below zero
&& macd[0] < macd.Lower[0]
&& macd[1] >= macd.Lower[1] ) // cross down
{
doShort();
}
}
if( isBullishSoundSignal == false
&& macd.Avg[0] > 0
&& macd[0] < macd.Upper[0] )
{
isBullishSoundSignal = true;
}
else {
isBullishSoundSignal = false;
}
if( isBearishSoundSignal == false
&& macd.Avg[0] < 0
&& macd[0] > macd.Lower[0] )
{
isBearishSoundSignal = true;
}
else {
isBearishSoundSignal = false;
}
if( SoundAlert )
{
if( isBullishSoundSignal )
{
PlaySound( string.Format( @"{0}sounds\{1}", NinjaTrader.Core.Globals.InstallDir, SignalSignalSoundFile ) );
}
if( isBearishSoundSignal )
{
PlaySound( string.Format( @"{0}sounds\{1}", NinjaTrader.Core.Globals.InstallDir, SignalSignalSoundFile ) );
}
}
}
Comment