• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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
    https://ninjatraderecosystem.com/use...emaslopecolor/

    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:
    https://ninjatrader.com/support/help...t8/?rising.htm
    https://ninjatrader.com/support/help...8/?falling.htm

    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
    Paul H.NinjaTrader Customer Service

    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
        }
        }




        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by learningnt, Yesterday, 10:21 PM
        0 responses
        2 views
        0 likes
        Last Post learningnt  
        Started by GMiller64, Yesterday, 01:13 PM
        3 responses
        10 views
        0 likes
        Last Post GMiller64  
        Started by itrader46, Yesterday, 12:51 PM
        5 responses
        43 views
        0 likes
        Last Post rithikanth  
        Started by hemlock, Yesterday, 11:45 AM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by gbulle, Yesterday, 11:31 AM
        4 responses
        12 views
        0 likes
        Last Post gbulle
        by gbulle
         
        Working...
        X