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 cmoran13, Yesterday, 01:02 PM
    0 responses
    29 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    21 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    160 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    95 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    148 views
    2 likes
    Last Post CaptainJack  
    Working...
    X