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 to have a running stop order

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

    How to have a running stop order

    I am trying to create a strategy where once the price crosses a certain level I am entered into the position. Thus I do not want to enter at market or something on the next bar but I instead would be looking for something like a rolling stop order. Just for example, let's assume that I want to take a long position as soon as price crosses above a 50 period EMA. Is there a way that I can have a stop order resting on the EMA so that as soon as the price crosses above it (not closes above it) then I'll be entered, even if it is intra-bar?

    #2
    Hello JVP3122

    Thanks for your post and questions.

    To assure intrabar response you will need to set CalculateOnBarClose to false so that your code is evaluated on each tick and so that when the order condition is true that your order is immediately placed.

    Next concerning the code would be to place a stop order at the EMA(50) level, continually adjusting on each tick.

    In the case of price coming up to the EMA 50 and you want to go long when it touches the EMA(50) you would code:

    if (High[0] < EMA(50)[0])
    {
    EnterLongstop(1, EMA(50)[0], "EMACrossUpEntry"); // Set at price of EMA(50)
    }

    Here is the help guide on EnterLongStop: http://www.ninjatrader.com/support/h...erlongstop.htm

    Alternatively you can use EnterLongStopLimit which gives you tighter control, here is the help guide reference: http://www.ninjatrader.com/support/h...gstoplimit.htm

    Please let me know if I can be of further assistance.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Today, 08:14 AM
    2 responses
    3 views
    0 likes
    Last Post funk10101  
    Started by samish18, Yesterday, 08:57 AM
    11 responses
    28 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by yertle, Today, 08:38 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by love2code2trade, Yesterday, 01:45 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by trilliantrader, Today, 08:16 AM
    2 responses
    7 views
    0 likes
    Last Post trilliantrader  
    Working...
    X