Selective laser melting (SLM) technology is currently one of the most promising additive manufacturing technologies for complex metal components. NiTi alloy has been highly regarded in advanced applications due to its excellent shape memory and good biocompatibility. However, as a new material, SLM-NiTi alloy is far from being applied in actual advanced fields. In the actual processing, such as grinding, turning, polishing, electrical discharge machining, all involve changes in temperature and stress, Therefore, it is very important to study the martensitic phase transition caused by temperature and stress changes in the precision machining process of SLM-NiTi alloy. However, it is difficult to observe the martensitic phase transition changes directly in the actual processing, so the method of molecular dynamics is adopted in this paper. Moreover, in the process of preparing NiTi alloy by selective laser melting, the ratio of Ni to Ti is very important, which determines the final forming quality. Therefore, this paper studied the martensitic transformation behavior induced by temperature and stress under different nickel proportions, different initial temperatures and different model sizes, and expounded the variation laws of stress-strain, potential energy, volume and dislocation. The microstructure and shear strain were demonstrated on the atomic scale. The results show that temperature plays an important role in the martensite transformation of SLM-NiTi alloy, low temperature will largely inhibit martensite transformation, and high temperature will promote martensite transformation. The stress induced martensite reorientation in SLM-NiTi alloy is accomplished by the migration of the interface between different martensite variants. When the nickel content is 52% and 55%, there is no inflection point between volume and potential energy with the change of temperature, when the nickel content is 50.8%, there is an obvious jump between volume and potential energy.