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

Simming Strategy doesnt work tick-by-tick, but bar-by-bar.

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

    Simming Strategy doesnt work tick-by-tick, but bar-by-bar.

    I'm simming a strategy. When I run it tick-by-tick, my EnterLongStop order doesn't make it. However, when I run the strategy bar-by-bar, then my EnterLongStop is executed. The code is:

    EnterLongStop(GetCurrentAsk() + TickSize);

    In image foo1.jpg, I'm running the sim tick-by-tick. You can see the trade isn't executed. The TraceOrder output is:

    4/1/2016 8:35:00 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=13 Currency=0 Simulated=False
    4/1/2016 8:35:00 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=16 Currency=0 Simulated=False
    4/1/2016 8:35:00 AM Entered internal PlaceOrder() method at 4/1/2016 8:35:00 AM: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=2055.50 SignalName='' FromEntrySignal=''

    In image foo2.jpg, I'm running the sim bar-by-bar. This time, the trade is executed. The trace output is:

    4/1/2016 8:40:00 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=13 Currency=0 Simulated=False
    4/1/2016 8:40:00 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=16 Currency=0 Simulated=False
    4/1/2016 8:40:00 AM Entered internal PlaceOrder() method at 4/1/2016 8:40:00 AM: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=2055.75 SignalName='' FromEntrySignal=''

    Thoughts? Thanks,
    Attached Files

    #2
    Hello timmbbo,

    Thanks for opening the thread.

    EnterLongStop() will cancel if the order is not filled within that bar. It looks like the order is being placed on the 8:35:00 bar with a price at 2055.50 and that bar only reaches a price of 2055.25. The order would then be canceled on the next bar when the price ticks through. When calculating on bar close this price is submitted to the 8:40:00 bar where the price does tick through.

    Please try using the liveUntilCanceled argument in the Advanced Order Handling overload for EnterLongStop().

    From the help guide:
    Live Until Cancelled - The order will NOT expire at the end of a bar, but instead remain live until the CancelOrder() method is called or its time in force has been reached.
    Syntax:

    EnterLongStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice, string signalName)

    EnterLongStop() - https://ninjatrader.com/support/help...erlongstop.htm
    Advanced Order Handling - https://ninjatrader.com/support/help...r_handling.htm

    Please let me know if this does not resolve your inquiry.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    23 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    45 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    21 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    181 views
    0 likes
    Last Post jeronymite  
    Working...
    X