Thanks for your response. No need to use logic, it's in the definition! I haven't run your code yet, still working on mine and I found that it's actually fine except when I try to use PlotBars. As soon as I use PlotBars (which I want to see the graph better), the graph is blank except for the dots, with the bars scrunched up to the far left side.

Code:
function indicatortest(ma_short, ma_medium, ma_long) {
  int ma_short = 15;	
  BarPeriod = 60*8;
  PlotDate = 20150105;
  //PlotBars = -100; //uncomment this and the chart is unreadable	
	
  vars Price = series(price());
  set(PLOTNOW);
  vars lowpass_MA_short = series(LowPass(Price, ma_short));
  plot("low pass short", lowpass_MA_short,LINE, ORANGE);
	
  if (valley(lowpass_MA_short)) {
    plotGraph("valley", 1, priceLow(1) ,DOT, YELLOW );
  } 
    else if (peak(lowpass_MA_short)) {
      //shows 2 dots, both at the correct bar, one at the level of
      // priceHigh, the other at the level of the trendline.
      plotGraph("peak", 1, lowpass_MA_short[1], DOT, GREEN );
      plotGraph("peak", 1, priceHigh(1), DOT, GREEN );
  } 		
}



any idea why PlotBars affects the chart in this way?

Last edited by yebit; 06/16/16 06:04.