Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I use the changing of color as a trading condition?

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

    How do I use the changing of color as a trading condition?

    Emaslopecolor
    This is a conversion of the NT7 indicator EMASlopeColor. Please contact the original author for any questions or comments. Colors the EMA plot when rising or falling.


    How do I use the changing of color as a trading condition?

    This isn't working:
    Code:
    if(
      (EMASlopeColor0.PlotBrushes[0][1] == Brushes.LimeGreen)
    && (EMASlopeColor0.PlotBrushes[0][0] == Brushes.Red)
    )
    EnterShort();

    #2
    Hello johnnybegoode,

    Thanks for your post.

    The indicator is simply creating an EMA with some user specified period and using the conditions IsRising() or IsFalling() to then assign the colors. You can use the same thing in your strategy (Specify the same period EMA and then use the IsRising() or IsFalling() conditions on the EMA.
    References:



    If you are using the strategy builder, here is a link to an example where those conditions (IsRising(), IsFalling(), are demonstrated: https://ninjatrader.com/support/help...sfalling_c.htm

    Comment


      #3
      I tried that first but the condition is always true or always false
      and it would keep buying and selling
      when it is Falling/Raising.
      I need the POINT when it Change from
      IsFalling to IsRaising and vice versa.

      How do I get that point
      when it Change from
      IsFalling to IsRaising and vice versa.

      Code:
      if
      (IsFalling(EMASlopeColor0))
      EnterShort();

      Comment


        #4
        Hello johnnybegoode,

        Thanks for your reply.

        You are correct regarding that it would assert true or false on each bar and be either rising or falling on each bar and thus placing entry orders.

        What you can do is use the IsRising and IsFalling conditions to set a bool you create to be either true or false. By checking the opposite state of the bool in the rising or falling condition you can then enter an order when the condition has changed.

        For example, assume we create a bool called goingUp. and using a simple EMA

        if (IsRising(EMA(15))
        {
        if (!goingUp) // check to see if we were previously falling and if so, place an order (Note the ! operator means if the bool is not true).
        {
        EnterLong();
        goingUp = true; // now we set it true because we are now rising and this will prevent further orders.
        }
        }

        if (IsFalling(EMA(15))
        {
        if (goingUp) // check to see if we were going up and if so place a short order
        {
        EnterShort();
        goingUp = false; // set false because now we are going down and this prevent further short orders
        }
        }




        Comment


          #5
          Hello sir can you help me with the code please i want to make the same strategy for the EMA

          Comment


            #6
            Hello Marwan,

            Thanks for your post and welcome to the NinjaTrader forums!

            I have received your e-mail to PlatformSupport and will work with you through that means.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            54 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
            71 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