Visibility in Moving average, Visibility in MA, visibility function in MA

I need MA to be visible in weekly time frame only but not on other Timeframes

  1. Moving Average 30 (weely close) should be visible only in weekly time frame, not on Daily, Hourly,Mins (which is avilable in Trading view)

Also Give option to change the parameter for weekly & MA Number to change

p0 = 366;//daily
p1 = 52;// weekly
p2 = 12;// monthly

inter_val = "Daily,Weekly,Monthly";

if ( Interval(2) == "Weekly" ) 
	Plot(MA(C,30), "MA30", colorOrange, styleLine);

for ( i = 0; i < 3; i++ ) {
  if ( Interval(2) == StrExtract(inter_val, i) ){
	Plot(MA(C,VarGet("p"+i)), "MA"+VarGet("p"+i), colorRed, styleLine);
	break;
  }
}

Watch your language. I'm not your bro.

It does what you posted! Ma30 visible in weekly only.
And MA52 in weekly.
If you don't need Ma30 plot all of sudden then remove it. Simple.

It is already there!

You can do that yourself in p0, p1, p2!
Use Param function three times. Simple.

Thank you helping sir

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.