Log chart for monthly time frame only

I am coding the AFL so that I when switch to the monthly chart, prices are presented in log scale and when I switch back to daily or weekly or any other time frame it switches back to arithmetic scale. I am using set chart option for this purpose. It presents log chart but when I switch to the weekly time frame it doesn't switch back to arithmetic scale. Please advise on how to fix this or point me in the right direction. Thanks.

in = Interval();
if( in == inDaily )
{
   Plot( MA( Close, 200 ), "MA-200", colorOrange );
}
if( in == inWeekly )
{
   Plot( MA( Close, 20 ), "MA-20", colorOrange );
}
if( in == inMonthly )
{
      Plot( MA( Close, 20 ), "MA-20", colorOrange);
      SetChartOptions(1,chartLogarithmic);
   }
   if( in == inQuarterly )
{
      Plot( MA( Close, 20 ), "MA-20", colorOrange);
      }
_SECTION_END();
_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);
in = Interval();

if( in >= inMonthly )
{
	SetChartOptions( 1, chartShowArrows | chartShowDates | chartLogarithmic);
} 
else 
{
	SetChartOptions( 1, chartShowArrows | chartShowDates );
}

Plot( MA( Close, 20 ), "MA-20", colorOrange );

6 Likes