Ordersend with stoploss and take profit less than the spread

 

hey, I am a beginner with mql4, and I am trying to develope an ea. I have written a code that sometimes enters a trade and sometime don't. when it doesn't enter a trade, the code specifies "130 error" i.e. Invalid stops.

is it possible that the stops are invalid due to the fact that the spread is larger than the stops?

appriciate all help. 

 
There are no mind readers here, we can't see your code. Likely:
  1. Stops set closer than stop level Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
  2. You are putting the stops relative to the order open price rather than order close price .
Reason: