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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    666 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    377 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    110 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    580 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X