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

Delay in order execution

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

    Delay in order execution

    Hi,

    I have a strategy that uses 2 series. The first series is a 10-tick series while the second is a 480-minute one (Note: I selected the 10-tick series as an attempt to catch the price movement as fast as possible. If there’s a better way, kindly suggest).

    My buy condition is a straightforward one. Simply the moment current price (high of the first series 10-tick) is higher than the High of the 480-minute candle (second series), take a buy position. So, here’s how I described it in the code:

    else if (State == State.Configure)
    {
    AddDataSeries(FirstSeries);
    AddDataSeries(SecondSeries);
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1 || BarsInProgress == 2)
    return;
    if (CurrentBars[1] < 2)
    return;
    if (CurrentBars[2] < 2)
    return;

    If (Highs[1][0]>Highs[2][0])
    {
    EnterLong();
    }

    The problem is that the code doesn’t always execute my condition (when the current price is higher than 480 minute high). In so many cases, it does. However, not all the time. There were times when the current price exceeded with 20 ticks difference, and the buy position was not placed!! I intend to make my profit target as 20-ticks

    Is this attributed to the volatility of the market?
    Is this a little problem in the code?
    How can I ensure there’s no delay in placing my order?


    Thanks

    #2
    Hello Abdullah_KSA,

    If the bar type supports TickReplay, using Calculate.OnPriceChange would be a good solution for triggering an action when the price changes.
    TickReplay allows this to work in historical data.



    To understand the behavior, enable TraceOrders and use Print().
    Below is a link to a forum post that demonstrates how to use prints to understand behavior.


    Print the time of the bar with a message that states this condition evaluated as true.

    Is the order being ignored with a message from TraceOrders?

    Is the condition evaluating as true at the time you are expecting?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Today, 12:02 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by GLFX005, Today, 03:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by nandhumca, Yesterday, 03:41 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by The_Sec, Yesterday, 03:37 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by vecnopus, Today, 06:15 AM
    0 responses
    1 view
    0 likes
    Last Post vecnopus  
    Working...
    X