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

How place a entry price below current price

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

    How place a entry price below current price

    Hello NT8 support,

    I'd like to place an entry order at a specific price given a set of conditions. But I am having trouble doing so. Example:

    IF (Conditions on bar close)

    {
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Close[0] - 3), "");
    }

    The above is meant to place a long entry order 12 ticks (3 points) below the close price at the time of the conditions. However, what happens when I test this is that the limit moves to be 12 ticks below the current price as it moves, so the limit never gets touched. I can confirm that the condition is not happening every bar. How can I make it so that the limit stays in place so that when it is touched by the price, there is an entry. thank you!

    #2
    Hello Austiner87, thanks for writing in.

    The best way to see if the condition is being reached would be to use a Print statement within the condition e.g.

    IF (Conditions on bar close)
    {
    Print("Condition Hit");
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Close[0] - 3), "");
    }

    If the order keeps getting updated, it means EnterLongLimit is being hit. If you can confirm the condition is being hit multiple times, you would need to either save the price level the order is submitted at and re-use that price every bar the order should be active (in the managed approach, resting orders are canceled on every bar unless they are resubmitted) or adjust your condition so that it does not get hit when not needed and use the special overload for EnterLongLimit to prevent the order from canceling at the end of every bar:

    EnterLongLimit(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double limitPrice, string signalName) //set isLiveUntilCancelled to true to keep the order alive.


    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bmartz, 03-12-2024, 06:12 AM
    4 responses
    31 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by Aviram Y, Today, 05:29 AM
    4 responses
    12 views
    0 likes
    Last Post Aviram Y  
    Started by algospoke, 04-17-2024, 06:40 PM
    3 responses
    28 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by cls71, Today, 04:45 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X