Upon reviewing the records, I noticed that this only happens when there is 0.0 pips slippage. When there is slippage, the EA would modify the order and it won't have time to open a duplicate order.
Yes better to use a variable because a constant is a value that you would enter manually into the parameters and that is most of the time not changed by the EA or by indicator. Variables are made to change all the time during the EA is running. I am sure you can find many example how to use variable in the forum