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

Strategy not working real time

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

    Strategy not working real time

    Hello,

    I am having trouble with my strategy when I apply it to a chart in real time. The strategy seems to backtest just fine as far as entries and exits go. However when I add it to a chart in real time, most times, but not always, the strategy doesn't have any historical fills shown and immediately submits an order at the current bar. This entry at the current bar should not be happening based on my signals.

    I assume I am doing something wrong with transitioning from historical to real time orders but I am not sure what, the strategy should be flat when this is happening, so I don't think there are even any orders to transition. I am also not sure why the strategy would show no historic trades even if my transition to real time is incorrect.

    Does this sound familiar to you? Any ideas on what I should be looking at to fix this?

    Thanks,
    Nick

    #2
    Hello NickyD,

    Thank you for the post.

    From the description it would be hard to say what may be happening although the note about this working in backtest but not for historical sticks out. A backtest is a historical test so I would expect it to perform more or less the same for that portion of the chart.

    Are you able to recreate this on the Sim101 account in realtime?

    If so, I would likely suggest adding some prints into your conditions to get an idea of what specifically is changing between the backtest and the historical chart test. Checking if some of the conditions are failing to become true when placed in a chart will help to better understand the remainder of the situation you explained.

    The order being submitted immediately I would need more details about to understand. If this is being caused by one of your conditions we would need to first look into why the historical trades are not appearing. If this is submitted from one of your conditions that is likely a result of the historical test happening differently.
    If this is submitted as a market order which the strategy is not managing that would likely be the start behavior and we could look at what setting is being used to better understand why that may be.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      So I found this in the output...

      An Set() method to submit an exit order at '12/13/2019 12:04:00 PM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.

      Interestingly, this error only occurs when the strategy starts on this day... if I add more days to the chart, there is no problem around 12/13/2019 @ 12:04.

      The Help Doc says:

      Set() methods that generate orders to exit a position will be ignored if:

      A position is open and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction

      A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active


      The strategy is neither attempting to go the opposite direction, nor uses any limit exits. It's all market order exits, so am still confused at the moment.


      Is there some more verbose logging I can get than simply setting TraceOrders = True? That isn't giving me details on every order, just some.
      Last edited by NickyD; 12-19-2019, 11:07 AM.

      Comment


        #4
        Hello NickyD,

        There is not more verbose logging unfortunately. For this I would likely need to see the logic and how it is configured to get a better idea of what rule you may be running into. From the details it is not apparent to me why the rule error would be reported, as noted those are generally the only reasons which should cause that and if you are not doing any of those actions it should likely not be ignored.

        Are you able to extract the SetMethod in question and whaever entry logic is associated to reproduce this in a simplified way? If not we can still look over the larger script that can just help to identify issues if you are able to extract it. For example if you can make the SampleMACrossOver reproduce the error that would be ideal as that script is very simple.



        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jclose, Today, 09:37 PM
        0 responses
        6 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,414 views
        0 likes
        Last Post Traderontheroad  
        Started by firefoxforum12, Today, 08:53 PM
        0 responses
        11 views
        0 likes
        Last Post firefoxforum12  
        Started by stafe, Today, 08:34 PM
        0 responses
        11 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by sastrades, 01-31-2024, 10:19 PM
        11 responses
        169 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X