coding help

 
The robot I work on opens multiple deals about the same price, I want to stop repeating trades from the same point. For example, if the price of 1.200 opens only one transaction regardless of its type, and continues until the condition is met again and opens one deal at the new price.
Question 2: I want to determine the maximum spread not exceeding 2 cents to open transactions, I wrote the condition as follows without benefit if (MarketInfo (Symbol), MODE_SPREAD) P> MaxSpread && MaxSpread! = 0) return; How this problem is resolved. Please help me quickly and thank you very much
 

We can't help you if you don't show the relevant code

MarketInfo( _Symbol, MODE_SPREAD)

returns the spread in points, not pips (necessarily) and not a decimal.
 

Question 1 : just a simple bool variable that you set to true when you open an order and to false when the order is closed.

 
ionone: just a simple bool variable that you set to true when you open an order and to false when the order is closed.
EAs must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV+flush or files) of ticket numbers required.
 

i think this code can help you ^^

Reason: