Announcement

Collapse
No announcement yet.

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
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Great Support!

          Thank you very much,

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          34 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          124 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          64 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X