Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

No new longs 'til I get a short signal?

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

    No new longs 'til I get a short signal?

    I thought it would be simple, but if I wanted to define the condition that I could only initiate a long trade once (at a long entry signal) and then wait for a short signal and enter short once etc etc, how might I do that?

    For instance, I'm practising with a simple "if price opens > than this MA; enter long". I don't want it to keep entering long every subsequent time a new bar opens > than the MA. The next trade must be a short at a short signal. Whether it ever comes is another matter

    If that makes any sense at all?

    The Entries per Direction works, but not for this, because as soon as my previous trade closes (stopped or take profit) that opens the door for another in the same direction.

    Many thanks for any help

    p.s. I'm only using the wizard. I'm not a code-savvy user, sadly.

    #2
    Hi 5iver, have you tried using a CrossAbove condition as entry combined with the EntriesPerDirection?

    Comment


      #3
      What you want to do is create yourself temporary variables. For your long condition you want to check for the temp variable to be true otherwise no trading (except for maybe the first entry). When you get short you set the variable to true.

      Untested code
      Code:
      if (condition && (wasShort || firstTrade))
      {
           EnterLong();
           firstTrade = false;
           wasShort = false;
      }
      
      if (short conditions)
      {
           EnterShort();
           wasShort = true;
      }
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

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