init r code for ma strategy