Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry after flat position

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

    Entry after flat position

    Hello,

    I have a strategy which enters a trade after a few different indicators are triggered within the first condition. I than have set a profit target, if the position reaches the targt it's closes out. However, I would like to reenter the position and I set a very simple entry to do so.

    My problem is that I cannot get the second entry to work. I have enclosed the strategy. Obviously, my condition 2 set is not right and I have tried to hunt around in the help forum but with no luck. Can someone tell me what I'm doing wrong? Thank you.

    // Condition set 1
    if (CrossAbove(EMA(Fast), SMA(Slow), 1)
    && Rising(Momentum(
    10)) == true
    && MACD(12, 26, 9).Avg[1] >= 0)
    {
    EnterLong(
    1, "Long 1");
    }
    // Condition set 2
    if (Position.MarketPosition == MarketPosition.Flat
    && Close[
    1] > Fast)
    {
    EnterLong(
    1, "Long 2");

    #2
    Hello,

    I do not see anything wrong with your code. You will need to debug it. This link will help:


    Try printing out the Fast variable right before the condition 2: Print("fast " + Fast);
    DenNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    566 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X