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

EntriesPerDirection limit doubt.??!!!

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

    EntriesPerDirection limit doubt.??!!!

    i set
    EntriesPerDirection = 2;
    EntryHandling = EntryHandling.AllEntries;

    but when there are more than 2 enteries occurs it close the entry its fine but why not running the script on further upcoming bars.?????

    it running fine if number of entries are 2 or less than 2.. but when it exceed 2 its close the entry but not running the program on upcoming bars

    by using trace order i got this

    Ignored PlaceOrder() method at 03/08/2012 01:15:00 AM: Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='|' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

    **NT** Error on calling 'OnBarUpdate' method for strategy 'rainraingoaway/5c016b552bcd4ce58ba7931da65de47d': Object reference not set to an instance of an object.
    03/08/2012 01:15:00 AM CancelAllOrders: BarsInProgress=0

    #2
    Hello DealI,

    The reason why your strategy is not running anymore on upcoming bars is because there is an error that happened inside of your Strategy. The "Object reference not set to an instance of an object." is the error that you are getting that is causing your Strategy cancel all of your orders and disable your strategy.

    If your strategy is running fine except when you have more than 2 orders then you may want to take a look at the code that you are using when you have more than 2 orders that you are checking for.

    If you would like to post a snippet of your code that you are calling we can try to see if there is anything that we can help you point towards.
    JCNinjaTrader Customer Service

    Comment


      #3
      hear is my program

      override void Initialize()
      EntriesPerDirection = 2;
      EntryHandling = EntryHandling.AllEntries;
      CalculateOnBarClose = true;
      ----
      void OnBarUpdate()

      if(refhigh <= High[0])
      refhigh = (double) High[0];

      if(GetCurrentBid() <= refhigh-3 && Position.MarketPosition == MarketPosition.Flat )
      entryOrder = EnterLong(
      lastboughtprice = entryOrder.AvgFillPrice;

      if(GetCurrentBid() <= lastboughtprice-2 && Position.MarketPosition != MarketPosition.Flat)
      entryOrder = EnterLong(
      lastboughtprice = entryOrder.AvgFillPrice;

      if( GetCurrentBid() >= Position.AvgPrice )
      exitOrder = ExitLong();
      refhigh=0;

      Comment


        #4
        Hello DealI,

        Thanks for the snippets.

        My guess would be that it would have to do with your entryOrder. You may want to add a check for null inside of your entry conditions for entryOrder.
        JCNinjaTrader Customer Service

        Comment


          #5
          i have 2 different problem dont know weather its linked to each other or not...

          im using iorders if i check entryorder ==null for ones next time even i used entryorder = null(rest to null) it not resetting .....

          then im using EntriesPerDirection too i set enteries perdirection = 5 if entries less than or equal to 5 occurs it working properly if there is more than 5 enteries possible .. program close by itself.. unable to fix this problem tried all sort of ways which i got from help .., looking for a suitable solution

          Comment


            #6
            Hello DealI,

            Thanks for your reply.

            May I have your complete script to test with on my end?

            To export your script do the following:
            1. Click File -> Utilities -> Export NinjaScript
            2. Enter a unique name for the file in the value for 'File name:'
            3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
            4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


            By default your exported file will be in the following location:
            • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>

            Below is a link to the help guide on Exporting NinjaScripts.


            Once your export has been created you can either post the script here, or if you would like to keep the script private, send this in an email to support[at]ninjatrader[dot]com with Attn: Chelsea #861844 in the body of the email.

            I look forward to assisting you further.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              hello NinjaTrader_ChelseaB thanks for ur reply and as per ur direction i sent mail to support... looking for ur reply

              Comment


                #8
                Hi DealI,

                I have received your code and will be responding to you via your email moving forward.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bmartz, Today, 09:30 AM
                2 responses
                11 views
                0 likes
                Last Post bltdavid  
                Started by f.saeidi, Today, 11:02 AM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by geotrades1, Today, 10:02 AM
                4 responses
                12 views
                0 likes
                Last Post geotrades1  
                Started by rajendrasubedi2023, Today, 09:50 AM
                3 responses
                16 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by lorem, Today, 09:18 AM
                2 responses
                11 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X