Rounding of MA values to tick size

Fulfillment Rounding of multiples of MA numbers in accordance with the rules of the stock exchange. Thanks very muchMA%20digenepin%20Tick%20Bei

Please review this post: How to ask a good question


You mean to round off a number to the nearest multiple of Tick Size, right??? If so, then that's already answered here - Rounding to uniform integers. To add, Tomasz has already solved it for you in that thread - read this.

_SECTION_BEGIN( "Rounding-Off to nearest multiple of Tick Size" );
	 TickSz = 5; //You can also use the TickSize that you receive from your Data vendor such that you won't have to change this constant for every symbol individually
	 Ma20 = MA( C, 20 );
	 RndMa20 = TickSz * round( Ma20 / TickSz );
	 Plot( C, "", colorDefault, styleBar | styleThick );
	 Plot( Ma20, "Ma20", colorAqua, styleLine );
	 Plot( RndMa20, "Ma20", colorLightOrange, styleNoLine | styleNoLabel | styleNoRescale );
	 Filter = 1;
	 AddColumn( Ma20, "Ma20", 1.2 );
	 AddColumn( RndMa20, "RndMa20", 1.2 );
1 Like

Thanks very much and Your kindness...

My freind alredy help. Thanks


MA5= TICK * round(MA(C,5)/TICK);
MA20= TICK * round(MA(C,20)/TICK);

1 Like

Next time when you post a code in this forum please use the Code tag.

Ok., thanks verry much