Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to enter a trade when price cross an indicator

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

    #16
    is this what you are talking about?

    Comment


      #17
      and this one for the other side?

      Comment


        #18
        Hello babouin77,

        Thanks for your post.

        The exitshortstoplimit has an incorrect signal name.

        One issue you will run into is that in real time an order will not fill as fast your code will execute when using Calculate.OnPriceChange or Calculate.OnEachTick so Position.AveragePrice will not be correct until the order fills at the exchange and the exchange sends back an update to the position object with the order status and the entry price (internet transmission time delay).

        What I suggest is that in another set you check for Position.MarketPosition == MarketPosition.Long and then set the exit orders. (create another set for the short orders). You will likely need to a bool variable (one for long and short) so that you only do this once for the order. The bool would need to be true in the conditions and then set false in the actions. In the entry order set you would need to set the bool to be true so that on each new order the sets will respond but again only once per entry order.

        Comment


          #19
          it sounds more complicated than it is lol i wish we can do in strategy builder like we do the ATM strategy where it is easy and automatic

          Comment


            #20
            Good evening,

            Is it possible to set a condition based on the price where 2 emas cross using strategy builder? For example, exit the trade if the cross price is below the 50 EMA.

            Thanks

            Comment


              #21
              Hello conniejforextrader,

              As an example:

              if (CrossBelow(EMA(7), EMA(50), 1))
              {
              ExitLong();
              }

              In the Strategy Builder > Condition Builder select Indicators > EMA, set Period to 7, in the center select CrossBelow, on the right select Indicators > EMA, set Period to 50.

              Below is a link to a support article with helpful resources on getting started with NinjaScript and C#. Be sure to watch the 'Automate Your Trading with NinjaTrader's Strategy Builder' training video.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 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