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 missing trades

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

    Strategy missing trades


    From the photos attached you can see the before picture that shows nothing being taken when ran live.
    But when I refresh the data/script, it shows the after picture. Showing that all conditions were met and a trade should of been taken.
    The log doesnt show any trades being taken even though all conditions were met.

    This doesnt happen all the time as the strategy does successfully take some trades.

    Any idea whats happening?

    Attached Files

    #2
    Hello Ousher,

    Thank you for your reply.

    Is the strategy running OnBarClose, OnPriceChange Or OnEachTick? Keep in mind that if the strategy normally processes On Price Change and On Each Tick, when you reload it on historical data it can only calculate OnBarClose and may display trades different than ones that would have been triggered if the strategy was running On Price Change or On Each Tick as on historical data all that is known is the OHLC of the bar, meaning on historical data strategies can only process On Bar Close.

    That being said, the first thing I would recommend would be to turn on the Order Trace function:

    Strategy Builder > Default Properties > More Properties > Trace Orders, or:

    if (State == State.SetDefaults)
    {
    TraceOrders = true;
    }

    Once you then recompile the strategy, you can open a new NinjaScript Output window under New > NinjaScript Output. This will print a log of any orders submitted by the strategy during while it's running, along with any ignored orders. You can then look through and see what may be occurring.

    Here is a link to our help guide that goes into more detail on tracing orders:

    https://ninjatrader.com/support/help...aceorders2.htm

    Trace orders alone may not give you the full picture of whether or not a trade should have been entered on a given bar, so adding prints to your strategy that will show in the NinjaScript Output window, with information on what the variables you're using for your conditions are on a particular bar, can be helpful.

    This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

    https://ninjatrader.com/support/foru...ns-not-working

    If you run into issues like we saw here, the above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the two.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,227 views
    0 likes
    Last Post xiinteractive  
    Started by andrewtrades, Today, 04:57 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    7 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    440 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    12 views
    0 likes
    Last Post FAQtrader  
    Working...
    X