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

How to run Market Analyzer on every tick?

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

    How to run Market Analyzer on every tick?

    Hi there,

    I have coded indicator which one works on Tick chart and its gives correct signals. Now I am trying to use it in Market Analyzer. I will attach screenshot where I tried explain everything and show it too.

    And also 1 thing what I want to learn is How can I protect my code. I mean in MetaTrader 4/5 there is source file mq4/mq5 and executable ex4/ex5 same way as in cTrader is cs files and executable file. So when I compile in NinjaScript in folder there is only source code cs file.

    Thanks in advanced for your help.

    #2
    Hello Revazi123,

    Thank you for your post.

    Any indicator that runs OnEachTick will run in the Market Analyzer the same way. Please see the attached example script that demonstrates an indicator that prints OnBarUpdate to the Market Analyzer for every tick. Please note that you need to update a plot to accomplish this.

    To protect your source code, you could export your indicators/strategies as a compiled assembly (DLL). A compiled assembly (DLL) of NinjaScript "hides" your source code. This can be further protected by SecureTeam's Agile.NET to prevent theft of your intellectual property.

    To export your NinjaScripts as a compiled assembly, navigate to the Export menu (Tools > Export > NinjaScript Add-On..). Add your indicator/strategy to the export menu by using the 'add' button. Then, check the 'Export as compiled assembly' box in the upper right-hand corner followed by the 'Export' button.

    Please see the help guide link for more information about exporting a NinjaScript - https://ninjatrader.com/support/help...scriptAsAssemb ly

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello Brandon,

      1) The problem is that I am not using OnBarUpdate I am using OnMarketData because I have complicated code where I use times in seconds and if I move my whole algorithm from OnMarketData to OnBarUpdate it may not work as it should.
      2) What about export I have done it and thanks.

      P.S. I am using OnMarketData to get marketDataUpdate.MarketDataType, MarketDataType.Last, marketDataUpdate.Volume, marketDataUpdate.Price
      Last edited by Revazi123; 11-19-2020, 01:26 PM.

      Comment


        #4
        Hello Revazi123,

        Thank you for that information.

        You would need to use TriggerCustomEvent to update a plot within OnMarketData.

        Please see the "Using TiggerCustomEvent to update a previously set custom Series<T> value" example in the TriggerCustomEvent help guide page. Instead of using OnRender like in the example, we would use OnMarketData. Instead of updating a Series<T> we would update Values[0][0].

        TriggerCustomEvent - https://ninjatrader.com/support/help...ustomevent.htm

        Also, please see the attached example script which demonstrates how this could be accomplished. In the example script, we set our plot to use the current close (Values[0][0] = Close[0];. We create a variable to store the current price value. Then, in OnMarketData we check if the variable is not marketDataUpdate.Price and set our bool to true. The script then checks if the bool is true followed by assigning marketDataUpdate.Price to our plot.

        And, here is a help guide link about Values - https://ninjatrader.com/support/help...nt8/values.htm

        Please let us know if you have any further questions.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Great Support!

          Thank you very much,

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by funk10101, Today, 09:43 PM
          0 responses
          6 views
          0 likes
          Last Post funk10101  
          Started by pkefal, 04-11-2024, 07:39 AM
          11 responses
          37 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Yesterday, 08:51 AM
          8 responses
          44 views
          0 likes
          Last Post bill2023  
          Started by yertle, Today, 08:38 AM
          6 responses
          26 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          24 views
          0 likes
          Last Post algospoke  
          Working...
          X