Announcement

Collapse
No announcement yet.

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.

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      49 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      141 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      275 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X