Thanks for sharing your linguistic questions with the Lingvist community!
Regarding your post, the word orden in its masculine form is correct in the context provided: it matches sense 3 of the word's definition in the Diccionario de la Real Academia Española (RAE), which, like the first 15 acceptations, is masculine (m.) :
3. m Regla o modo que se observa para hacer las cosas. (which usually translates into English as "order").
The feminine acceptations of the term are those with an "f" at the beginning of the definition (numbers 16 - 20), which, as you can see, do not match the example sentence. In this case, the most common feminine sense is number 17, which translates into English as "order" or "command".