Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

One trade per "event".

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

    One trade per "event".

    Breaking my brain on this-help please.
    In Strategy Builder (NT8), I created the signal: Go long when price crosses above HULL50, then (within a lookback period of 10) drops to touch the HULL30. What I can't figure out is how to do, is make the strategy stop trading after (X) amount of trades. Then, after a Short position has triggered and closed (after same (X) amount of trades), a long position can be triggered again. Make sense? BTW - I am trading intra-day so a simple "bars since exit" doesn't seem to work here.
    Thanks in advance...

    #2
    Hello White Fork,

    Thanks for your post and welcome to the NinjaTrader forums!

    To accomplish one trade per event you can create a bool variable that flip-flops between events. A bool is a variable that can only be true or false.

    For example, using pseudo code:

    if (crossabove event and bool is false)
    place long trade
    set bool to true // this will prevent a reentry in the cross above and prepares for
    crossbelow

    if (crossbelow event and bool is true)
    place short trade
    set bool to false// this prevent a reentry in the cross below and prepares for
    crossabove

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Perfect, thank you Paul.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      148 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      5 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      5 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,283 views
      0 likes
      Last Post Leafcutter  
      Working...
      X