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

Misinterpretation of execution event?

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

    Misinterpretation of execution event?

    Hi

    I am trying to diagnose the cause of a strategy malfunction and would like clarification of my understanding.

    Please refer to the attached code for OnExecution().

    The log and trace files indicate that the first "if" block should have been executed, but it was not (because no stop loss or profit target orders were placed and other actions were not made). However, the print statement below it printed the correct output for the order that should have caused execution of the "if" block. Logically, I think this is not possible. Are there any circumstances that could cause this?

    Please note that two of us were using the same strategy code at the same time, but one malfunctioned as above and one worked correctly. I am beginning to suspect some corruption of the program, but I do not know what could cause it.

    I have struggled with this for days, so any advice would be appreciated.

    Cheers
    Tony
    Attached Files

    #2
    Hi Tony, I can understand where you're coming from with the info posted - were you both using the same NT7 release version in your testing? Have you checked if this would be reproducible in one install via Market Replay? If it was you could better correlate the print to the TraceOrders output to better understand the sequence seen.

    Is this only happening for one market / series in your script?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand

      Thanks for your suggestions. In answer...

      Both of us were/are using 64-bit 7.0.1000.10. We did not upgrade to release 12 because we use CQG and preferred to wait for the CQG adapter to be out of beta. I see today release 13 is available. Do you regard the CQG adapter to be out of beta now?

      Today we ran the strategy on Market Replay data but were not able to reproduce the malfunction.

      We are running this strategy only on TF 1-min series with the strategy applied in the Control Center, i.e. not on a chart.

      Incidentally, this is not testing, it is live trading. We both run the NT installation on Amazon VPS to reduce the likelihood of problems due to lost connection or local power outage. However, they are "micro" VPS instances and have only 640 MB RAM. I know NT state the system requirements are 2 GB RAM, but we watch the memory usage and we have never seen it exceed about 520 MB. However, what happens if the server does run out of memory?

      I think my only remaining approach is to write some self-monitoring code to detect unexpected situations. I would appreciate any advice or references to help with this.

      Cheers
      Tony

      Comment


        #4
        Hi Tony, yes the CQG adapter would be out of beta now with R13 being released.

        Can you please forward me the trace and logs files from the day of the issue for review?

        When the application would run out of memory you would see an out of memory exception in the trace file with a shutdown, so if possible please ensure to have more than enough resources.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bertrand

          I have sent the log and trace files by email. Thank you.

          I cannot find any reference to memory problems, so I think that was not the cause.

          Another point that may be relevant is the location of my SetStopLoss() & SetProfitTarget() calls. These were in OnExecution().

          The entry is by market order and we require the stop loss to use CalculationMode.Price based on a distance from the entry price. However, I now realise that SetStopLoss() & SetProfitTarget() could be called as soon as the entry level is determined, even before the entry order is sent. (I have just made this change.)

          Could this be relevant?

          Cheers
          Tony

          Comment


            #6
            Thanks for the files Tony, will review and then be in touch. The Set()'s would be sent on the execution seen and should be in place before your trade is actually triggered.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by StockTrader88, 03-06-2021, 08:58 AM
            45 responses
            3,992 views
            3 likes
            Last Post johntraderuser2  
            Started by TAJTrades, Today, 09:46 AM
            0 responses
            7 views
            0 likes
            Last Post TAJTrades  
            Started by rhyminkevin, Yesterday, 04:58 PM
            5 responses
            62 views
            0 likes
            Last Post dp8282
            by dp8282
             
            Started by realblubb, Today, 09:28 AM
            0 responses
            8 views
            0 likes
            Last Post realblubb  
            Started by AaronKoRn, Yesterday, 09:49 PM
            1 response
            19 views
            0 likes
            Last Post Rikazkhan007  
            Working...
            X