Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Newbie Strategy help

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

    Newbie Strategy help

    Hi there

    Im a newbie to Ninjatrader (have used other platforms before this) for strategy analysis.

    Please bear with me if I am asking a silly question

    I would like to test a strategy along the lines of the following and am having a hard time getting NT to understand what I am trying to say.

    Requirement:
    Create a simple MA crossover strategy, lets start with a 128 tick chart on /NQ.

    When the 21MA cross the 55MA AND the closing price of the candle is above the 200 MA and 21MA, only then enter a long trade.

    Use a 50 tick stop loss and leave the take profit to whenever the MA crossover happens (i.e. when the 55MA crosses below the 21MA).

    I tried using strategy builder to build this strategy that resulted in the following code.

    Problem1: I cant figure out how to set the take profit for this trade to whenever the crossover happens in strategy builder

    Problem2: When executing this code against todays data 07/27/2023, the strategy is executed correctly on the first crossover of the MA's but the take profit order is not filled and therefore the order just sits there till the close of the session.

    Can someone suggest if Strategy Analyzer / Builder are capable of this kind of logic? If yes what am I missing

    Feel free to point me to a RTFM resource as well.

    Thank you for reading thus far!
    Link to code (as I couldnt paste the code in within the code tags): https://pastebin.com/GZ4xbFCt

    #2
    Hello that_dude,

    You can use the stops and targets page of the builder to set up stops or targets. Those orders submit based on the associated entries fill. You tie orders together based on the entries signal name. When your crossover happens the entry would be submitted, once filled the targets would be submitted.

    If your profit target was unfilled that would leave the position open, the strategy has the option to exit on close if your still in a position. If you see your target is not being filled you may need to use less offset so it falls within the markets price range.

    Comment


      #3
      Thanks for the super quick response! Makes sense!

      Comment


        #4
        I have two follow up questions if you dont mind.

        1)I would like the strategy to stop taking any more trades for the trading if it hits a max loss of a fixed amount (say 2000$) in a single day. Is this possible to state in the strategy builder as well?

        2) Instead of a trailstop, I would like to make the stop an autobreakeven stop once a certain profit target is hit and trail it from that point onwards.

        Asking this specifically in the context of being able to backtest this using strategy analyzer

        Thank you again!
        Last edited by that_dude; 07-28-2023, 05:34 PM.

        Comment


          #5
          Hello that_dude,

          You can do both of those type of concepts. There are samples of using a daily loss limit and also a break even in the following posts:

          Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader


          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          53 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X