Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

peak indicator not working

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

    peak indicator not working

    Hi guys,

    I'm trying to design a 2 up, 1 down indicator for a peak but its not working. Could any help me??? thanks in advance. Theres no error code just that the lines won't plot.

    Code:
    protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                
                if (CurrentBar < 5) {return;}
                
                bool PeakConditionOne = Close[1] > Close[0];
                bool PeakConditionTwo = Close[2] < Close[1];
                bool PeakConditionThree = Close[3] < Close[1];
                
                if (PeakConditionOne == true && PeakConditionTwo == true && PeakConditionThree == true)
                {    
                    int i = 0;
                    
                    for (i = 0; i < 4; i++)
                    {
                        INDLINE.Set(Close[i]);
                    }
                    
                }
            }

    #2
    It seems you want to identify when the pattern occurs. The code below makes a bar green when the pattern you have defined is identified. I dont really understand how you were trying to plot it before but this should provide the solution you need.

    Cheers.


    Code:
    
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Plot0"));
                Overlay				= true;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
    			if (CurrentBar < 5)return;
                
                bool PeakConditionOne = Close[1] > Close[0];
                bool PeakConditionTwo = Close[2] < Close[1];
                bool PeakConditionThree = Close[3] < Close[1];
    			
               if (PeakConditionOne == true && PeakConditionTwo == true && PeakConditionThree == true)
                {    
                       BarColorSeries[0] = Color.Green; 
                }
    			
    		}
    Attached Files
    Last edited by marty087; 03-14-2015, 05:48 PM.

    Comment


      #3
      ok thanks for that what I was trying to do, sorry should have been more clear, was create a sort of arc line over the 4 bars I was using to measure peaks and troughs.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      332 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