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

Save chart as image from strategy?

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

    Save chart as image from strategy?

    In strategy, we can programatically setup a chart,
    add indicators and so on... such Chart is then visible in the Strategy analyzer / Chart.

    I would like to code a strategy, that will trade as usually, but also saves chart when needed (mostly when opening and closing trade).

    This is useful, so I do not have to manually search for each trade to check it - but strategy exports images with trades, which will be much faster to look at.

    Please guide me to some functions / examples, how can I save chart into image from strategy (by NinjaScript) during running backtest?

    Best regards
    M.
    Last edited by misova; 01-01-2018, 03:29 PM.

    #2
    Hello misova,

    I will follow up with you tomorrow.

    Thank you for your patience.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello misova,

      Thank you for your patience.

      Within a strategy, any indicators added with AddChartIndicator will appear on the chart displayed through the strategy analyzer. Outside of AddChartIndicator, there is no supported means to programatically set up a chart.

      See addchartindicator.


      Regarding a screen shot of the strategy analyzer chart at the time of each trade, I’m not sure of a supported means of accomplishing this, as the SA chart is populated with signals after the analyzer has run, not one by one such as if trading live. While you can take a screen shot of the chart in the SA, how you would programmicaly loop back through the chart and take screen shots of each entry would be difficult.

      A solution for what you’re looking to do could be to run your strategy in Market Replay on a chart, and use the logic in the attached strategy, which will take a screen shot when an entry trade is made.

      The sample will enter a long position, which when filled, will take a screen shot and save it to My Docs>NT8 Folder as MyScreenshot.png.

      Please see attached and let us know if you need further assistance.
      Attached Files
      Alan P.NinjaTrader Customer Service

      Comment


        #4
        Alan, I really appreciate your support.
        Thank you for your help!

        I will test the code immediately in the morning.

        Best regards
        Misova

        Comment


          #5
          Alan,
          I tested it thoroughly and I can confirm it works really great.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          3 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X