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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X