Effect of annealing conditions on the structure and phase transition temperatures for polycrystalline Ni50Mn29Ga21 alloy was studied. The final structure strongly depends on the annealing temperature and cooling rate. Ordering of the austenitic phase, performed by annealing at elevated temperatures, plays an important role in formation of the proper martensitic structure. For the Ni50Mn29Ga21 alloy annealing below the ordering temperature (1033 K) forms 5M modulated martensitic structure, irrespective of the cooling rate. The 7M modulated martensitic structure can be produced after annealing above the ordering temperature, followed by slow cooling.