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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    51 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    275 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X