Announcement

Collapse
No announcement yet.

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.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X