Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry price follows the value of an Indicator

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

    Entry price follows the value of an Indicator

    I'm using the following code for an entry:
    if CrossAbove(condition) (a moment in time condition)
    buyentry = EnterLongLimit(0, true, 1, EMA(20)[0] + TickSize * 0, "Buy_1");
    But this code locks in a working Limit order at the price of the EMA at the moment in time that the condition was true. How can I make the working limit entry follow the price of the EMA until it is filled instead of only looking for the specific price that the EMA was at the time the condition became true?
    Thanks
    Last edited by kenb2004; 07-09-2011, 03:00 PM.

    #2
    Hello,

    Thanks for the note.

    What you would need to do is restructure your code to call this order method on each OnBarUpdate so that you can make the change with each OnBarUpdate().

    One way you would do this is to change up your order method condition so that it is true for each bar that you want to move it up.

    Changeing the CrossAbove() method to have more bars is one way to do to do this the other is by using flags to signal when you are ready to go long then if(FlagIsTrue) { EnterLong } for example.

    Let me know if I can be of further asssitance.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    60 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    147 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    284 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X