This is a question I have been asked more than once, by authors whose primary language is not English, and there are many different answers, depending on why, what and how you are writing. In some ways, it is a wonderful predicament to be in, as most writers are only able to write in one language and do not have a choice.
So, first of all, why are you writing? If it is purely for personal enjoyment, then you should write in whichever language gives you the most pleasure. I know that my own written Russian, French or German are far from perfect, even though I read them very well, but I have occasionally penned a few lines in a journal, or written letters to friends, just for fun. On the other hand, if your writing is intended for publication and sales, the question requires more careful consideration. In this case, you need to adopt a realistic approach. How fluent is your written English, really? Speaking a language fluently and writing it are two very different skills, and a person who has mastered one of them is not necessarily equally skilled at the other. Would your written English require heavy editing to bring it to a publishable standard, which may cost a lot of time and money? If you are unsure, it may be worth showing a sample to an editor or other native speaker and asking their advice. Alternatively, would you feel more comfortable writing in another language and sharing your work with speakers of that language instead? Then you would have the option of having your writing translated into English later by a professional.
Secondly, what are you writing? The best solution for someone writing a business contract or scientific paper may not be the same as for the author of a novel. What matters most in a technical or business text is factual accuracy. This kind of document is intended to communicate information correctly and efficiently. As long as the details are conveyed effectively, and the reader is able to understand the content, then the writer has succeeded. A work of literature, though, requires much more. Readers will not want to buy a book if it is boring. A novel with style, flair, and natural, flowing language has a far better chance of selling well than something that feels awkward and artificial, no matter how accurate the grammar and spelling might be. That does not mean, of course, that you should not write in English, but do bear in mind that some extra input from native speakers may be a valuable ingredient to add to your mixture.
How you write could also indicate which language to write in. Do ideas come to you in a different language, and then you have to translate them into English in order to commit them to paper? If so, unless you have specifically been asked to write in English, or wish to set yourself an intellectual challenge, writing directly in your principle language may be easier, and therefore a much pleasanter experience with fewer potential headaches.
Many non-native speakers are tempted to write in English for financial reasons. English is the most widely-spoken language in the world, which means that the market for English-language writing is huge. However, it is also true that this market is already being supplied by a vast community of highly able writers and the competition is fierce. Fame and fortune are elusive treats reserved for the lucky few, and even the most talented writers can struggle to make money from writing. So, if money is your motivation, I would urge you to write in whichever language you are able to produce the most beautiful prose or poetry, thereby giving you the best chance of standing up to the competition. However, be aware that financial success is not guaranteed, regardless of the quality of your writing.
In short, unless you have specific instructions, the language you write in should be the same language that your soul sings in. Choose the language you feel most comfortable using to express yourself, and enjoy every moment of the process. If it still needs a little polish afterwards, don’t be afraid to ask for someone else’s input. But avoid being led astray by the elusive charms of money.