Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing in a strategy

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

    Printing in a strategy

    Since I don't have intraday data, I am using the Print method to print out ohlc to the output window and copying it to excel for analysis. However, when I backtest a whole watchlist at one time, sometimes the print statements get scrambled between symbols in the watchlist. I assume this is because of multithreading.

    Is there a way I can force my prints to complete before another execution of OnBarUpdate? FYI, I have created a printmydata function which I call in OnBarUpdate.

    Thanks.

    #2
    Hello,

    Thank you for the question.

    This would be expected because you are running 1 instance of that script per instrument in the Analyzer so there should be multiple prints happening at varied times in that case.

    I wanted to check, are you simply trying to export the historical data from the day for use in Excel?

    If so there are two other ways in which may be easier than the copy and paste.

    The first is a direct export of historical data into text, you can use the instruction here to do this: http://ninjatrader.com/support/helpG.../exporting.htm

    The second would be a direct export to excel, this also involves the Historical Data Manager.
    In this case, you would use the Edit tab in the Historical data manager, select the Day in question from the tree on the left. Once you see the data listed, Right click in the data grid -> Grid -> Export to Excel.

    Either case would export the OHLC data for you to use in excel, this is a more general approach so if the copy and paste works for you that is fine but the Prints not happening in a specific sequence would be expected.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      No, I am exporting one bar of day data after a particular event has occurred.

      Comment


        #4
        Hello,

        Thank you for the reply.

        In this case you would likely need to add some unique identifier to each line that is printed such as the Instrument name.

        An example would be:
        Print(Instrument.FullName + " " + Close[0]);

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I do that now. When I copy the data to excel there are some instances where I have to rearrange the data. I was hoping to avoid that.

          Thanks.

          Comment


            #6
            This is an example of the prints I am getting now.

            8/9/2014
            2/25/2015
            7/25/2014
            AFSI Open 42.81
            AER Open 46
            ABC Open 76.41
            AFSI Close 43.63
            AER Close 45.16
            ABC Close 76.79
            AFSI High 44.15
            AER High 46.07
            AFSI Low 42.58

            AER Low 45.06
            ABC High 77.06

            I was hoping there was a programmable way of blocking the next bar update until the print was finished.

            Comment


              #7
              I found a solution. The problem was I was using multiple print statements, which got interrupted by another bar update. I combined all print statements into one and I now have the output formatted the way I want.

              Thanks.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by arvidvanstaey, Today, 02:19 PM
              4 responses
              11 views
              0 likes
              Last Post arvidvanstaey  
              Started by samish18, 04-17-2024, 08:57 AM
              16 responses
              61 views
              0 likes
              Last Post samish18  
              Started by jordanq2, Today, 03:10 PM
              2 responses
              9 views
              0 likes
              Last Post jordanq2  
              Started by traderqz, Today, 12:06 AM
              10 responses
              18 views
              0 likes
              Last Post traderqz  
              Started by algospoke, 04-17-2024, 06:40 PM
              5 responses
              48 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X