Here is a script for an example. When I run Explore on a stock portfolio (to get buy signals for tomorrow), it gives not only the necessary signals, but they too, for which positions have already been opened (for example, yesterday, the day before yesterday, etc.). How to Ignore Repeated Signals. I mean that, for example, the day before yesterday a position on XXX shares was already opened. But since the entry condition is still valid, even today we receive a signal to buy XXX. And how to make this signal no longer exist, since the position on XXX is already open and re-entry is not provided.
SetPositionSize(10, spsPercentOfEquity);
SetOption("MaxOpenPositions", 10);
SetOption("InitialEquity", 100000);
SetOption("UsePrevBarEquityForPosSizing", 1);
Equity(1, 0);
SetTradeDelays(0,1,0,0);
RoundLotSize = 1;
///////////////////////
Setup = BarCount > 20 AND
Close < MA(Close, 5);
lim = Close – ATR(10);
prior = ATR(10);
Buy = Ref(Setup, -1) AND Low < Ref(Lim, -1);
BuyPrice = Min(Ref(Lim, -1), Open);
PositionScore = prior;
Exit = Close > MA(Close, 5) AND BarCount > 20;
Sell = Exit;
////////////////////////
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
Filter = Setup;
Shares = 100000/Lim;
//AddColumn(Filter, "Buy", 1);
AddColumn(Lim, "LimitPrice");
AddColumn(Shares, "Shares", 1.0);
AddColumn(PositionScore, "Priority", 1.5);