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

OnMarketData

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

    OnMarketData

    Hello. I am testing a strategy using OnMarketData to simulate MIT orders. I buy 4 contracts and I have put four variables, Target1 to Target4 with the sell points. I test in the OnMarketData procedure and if the price reaches every Target, in this moment I do a ExitLong of 1 contract. I have two doubts:

    1) As I have be able to see the method 'OnMarketData' works well with Market Replay but not with Strategy Analizer (I think that because the first works tick by tick and the second with OHLC). Could you confirm me this assumptions?

    2) The first ExitLong works well but the 2nd, 3rd an 4th don't work. However I know that the code is executed because I have put several Prints to trace the flow (I have attached a file with the strategy). Could you tell me which could be the reason?

    Thank you very much
    Attached Files

    #2
    Hello alibanez,

    Thanks for opening the thread.

    1) As I have be able to see the method 'OnMarketData' works well with Market Replay but not with Strategy Analizer (I think that because the first works tick by tick and the second with OHLC). Could you confirm me this assumptions?
    You are correct. This can be further referenced in the publicly available documentation on OnMartketData(). I'll provide a link below.

    2) The first ExitLong works well but the 2nd, 3rd an 4th don't work. However I know that the code is executed because I have put several Prints to trace the flow (I have attached a file with the strategy). Could you tell me which could be the reason?
    I think your code is skipping your subsequent exits because they use the same signal name. If you change the exit orders to use a different Exit Signal Name while keeping the same fromEntrySignal Name, do you get the results you are looking for?

    I.E.
    Code:
    ExitLong(1, "LongExitOrder", "LongOrder");
    ExitLong(1, "LongExitOrder2", "LongOrder");
    Please let me know if I can be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      Nowi t is workin perfectly. Thank you very much.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      31 views
      0 likes
      Last Post love2code2trade  
      Started by cls71, Today, 04:45 AM
      2 responses
      10 views
      0 likes
      Last Post eDanny
      by eDanny
       
      Started by proptrade13, Today, 11:06 AM
      0 responses
      5 views
      0 likes
      Last Post proptrade13  
      Started by kulwinder73, Today, 10:31 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by RookieTrader, Today, 09:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X