Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

            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 cre8able, Today, 03:20 PM
              1 response
              9 views
              0 likes
              Last Post cre8able  
              Started by fiddich, Today, 05:25 PM
              0 responses
              3 views
              0 likes
              Last Post fiddich
              by fiddich
               
              Started by gemify, 11-11-2022, 11:52 AM
              6 responses
              804 views
              2 likes
              Last Post ultls
              by ultls
               
              Started by ScottWalsh, Today, 04:52 PM
              0 responses
              4 views
              0 likes
              Last Post ScottWalsh  
              Started by ScottWalsh, Today, 04:29 PM
              0 responses
              7 views
              0 likes
              Last Post ScottWalsh  
              Working...
              X