Hi,
When you say:
Quote:
I need that only one position is going to be opened.
there is some information missing: Will you need a single open position per trading session (every time you start the strategy?) OR every candle period (then what period would you wish to use) OR per price ??
The example sent above by Vadim is showing you the way to trade one single position at a time: that means that the strategy will only open a position
IF the previous one is closed.
Here is another example showing how to trade a unique position. The strategy will trade again if you restart it otherwise once this position is closed, nothing will happen anymore.
Cheers