• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OnBarUpdate error

    I have coded a new strategy for NT8 that is giving the following error "Error calling 'OnBarUpdate' method on bar 4808: the given path format is not supported."

    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 ) );
    }
    }
    }

    #2
    It might be that it doesn't like where the @ symbol is placed

    instead, try something like

    Code:
    PlaySound( NinjaTrader.Core.Globals.InstallDir + @"sounds\" + SignalSignalSoundFile );
    OR

    Code:
    PlaySound( string.Format( "{0}sounds\\{1}", NinjaTrader.Core.Globals.InstallDir, SignalSignalSoundFile ) );
    I hope that helps

    Comment


      #3
      Originally posted by gubbar924 View Post
      It might be that it doesn't like where the @ symbol is placed

      instead, try something like

      Code:
      PlaySound( NinjaTrader.Core.Globals.InstallDir + @"sounds\" + SignalSignalSoundFile );
      OR

      Code:
      PlaySound( string.Format( "{0}sounds\\{1}", NinjaTrader.Core.Globals.InstallDir, SignalSignalSoundFile ) );
      I hope that helps
      Thank you Gubbar924, I tried both changes, none of them worked...

      Comment


        #4
        Are you still getting the same error message? If it is different, what does it say?

        Would you mind posting the script here or sending it to me directly? I can take a look for you.

        In the meantime, check out this sample I put together.
        It allows you to pick a .wav file from within the strategy's properties window.

        It is set to sound an alert when connection is lost.
        To test it, just make sure you're connected to your data feed/connection and that the strategy is enabled; tthen use your firewall to block all connections, or disconnect the ethernet/wireless from your computer, wait about 10 seconds for NinjaTrader to see it as connection lost. At this point it should play the .wav that you've selected.
        Attached Files

        Comment


          #5
          Hi gubbar924, I still getting the same log error (it is not a compiling error), if you give me your e-mail address I can send you the script, thanks

          Comment


            #6
            Thank you for your assistance, gubbar924.

            futuros,

            Thank you for your patience.

            We can look into this further on our end as well. You can export your indicator by going to Tools > Export > NinjaScript Add On > Add > select your indicator > OK > Export > name the file 'NTsupport' > Save. The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript. Please attach the file to your response. You can attach the file to your response or send it to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              Hi Patrick, it is a strategy, not an indicator...I already sent the strategy by email to your attention, thanks for your help!
              Last edited by futuros; 04-14-2017, 02:10 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by darkgreen, Today, 03:35 PM
              0 responses
              6 views
              0 likes
              Last Post darkgreen  
              Started by GTBrooks, Today, 02:44 PM
              2 responses
              13 views
              0 likes
              Last Post GTBrooks  
              Started by GLFX005, Today, 12:22 PM
              4 responses
              41 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by AspenHiker, Today, 08:37 AM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by MartinT, Yesterday, 01:12 PM
              3 responses
              17 views
              0 likes
              Last Post MartinT
              by MartinT
               
              Working...
              X