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

is EMA above the current pps bool

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

    #31
    I created a new indicator to start fresh, everything compiles fine now.

    The only change I made is if Close > EMA9 return 1 else return 0.

    I set two cell conditions one for green if close = 1 Red if Close = 0, again in either case true or false I'm getting all red with 0?? so the logic of this basic code is not working correctly.

    Comment


      #32
      Disregard I fixed it had MyInput over ridding the T/F value. Thanks for your help.

      Comment


        #33
        After playing with this code I have had success plotting custom signals in Market analyzer. However I need to have two indicators one for EMA Rising and another for EMA Falling which takes up two columns in MA.

        Is there a way to combine the code for both rising and falling signals in a single column?

        I have tried adding else if EMA9 < Close Plot0.Set(2) but logic seems to be incorrect on the short side. IOW, I get signals when I shouldn't and no signals when I should. Long side works ok.

        protected override void Initialize()
        {
        Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
        Overlay = false;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
        if(CurrentBar < BarsRequired)
        {
        return;
        }
        // Use this method for calculating your indicator values. Assign a value to each
        // plot below by replacing 'Close[0]' with your own formula.
        if ( EMA(9)[0] > Close[0])
        {
        Plot0.Set(1);
        }
        else
        {
        Plot0.Set(0);
        }
        }
        Last edited by gapmeister; 11-13-2014, 04:40 PM.

        Comment


          #34
          Hello,

          It looks like you are trying to make it so that when the EMA is above the price the MA column is green and when it is below red.

          If this is the case you modify your existing code to the following:

          Code:
          if (EMA(9)[0] > Close[0])
          {
              Plot0.Set(1);
          }
          else if (EMA(9)[0] < Close[0])
          {
               Plot0.Set(-1);
          }
          else
          {
                Plot0.Set(0);
          }
          In the MA, your condition would be if the price is greater than 0 color the cell green, a second condition, if the price is less than 0 red.

          Please let me know if I have read this incorrectly.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by WHICKED, Today, 12:56 PM
          2 responses
          14 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Started by Felix Reichert, Today, 02:12 PM
          0 responses
          1 view
          0 likes
          Last Post Felix Reichert  
          Started by Tim-c, Today, 02:10 PM
          0 responses
          1 view
          0 likes
          Last Post Tim-c
          by Tim-c
           
          Started by cre8able, Today, 01:16 PM
          2 responses
          9 views
          0 likes
          Last Post cre8able  
          Started by chbruno, 04-24-2024, 04:10 PM
          3 responses
          49 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X