Hi, and sorry if my question is really silly.
I have a very simple system:
// Medias
Periodo_Media_Rapida = 10;
Periodo_Media_Lenta = 30;
//Canal de Donchian
Periodo_Canal_Superior = 20;
Periodo_Canal_Inferior = 20;
// Para el desempate en Score
Periodo_ROC = 25;
////////// INDICADORES
// Medias
Media_Rapida = MA(Close,Periodo_Media_Rapida);
Media_Lenta = MA(Close,Periodo_Media_Lenta);
//Canal de Donchian
Canal_Superior = HHV(Ref(High,-1), Periodo_Canal_Superior);
Canal_Inferior = LLV(Ref(Low,-1), Periodo_Canal_Inferior);
// Para el desempate
Momentum = ROC(Close,Periodo_ROC);
Volatilidad = ATR(20);
/////////// SETUPS
// Medias
Medias_Alcistas = Media_Rapida > Ref(Media_Lenta,-5);
Medias_Bajistas = Media_Rapida < Ref(Media_Lenta,-5);
Cruce_Alcista = Cross(Media_Rapida,Media_Lenta);
Cruce_Bajista = Cross(Media_Lenta,Media_Rapida);
//Canal de Donchian
Ruptura_Canal_Superior = High > Canal_Superior;
Ruptura_Canal_Inferior = Low < Canal_Inferior;
// Para el desempate
Score = Momentum/Volatilidad;
//////////// REGLAS DEL SISTEMA
//CONDICIONES DE ENTRADA
BuySetup= Ref(Medias_Alcistas,-1) AND Ref(Ruptura_Canal_Superior,-1) AND Ref(Mercado_Acista,-1);
Buy = BuySetup;
BuyPrice = Open;
// Para el desempate
PositionScore = Score;
//CONDICIONES DE SALIDA
//SellSetup = Ref(Cruce_Bajista,-1);
SellSetup = Ref(Cross(Media_Lenta,Close),-1);
Sell = SellSetup;
SellPrice = Open;
//Limpieza de Señales Extra
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
And in the Explorer, I want to see Buy or Sell signals that fall within the selected range. I don't want to see Sell signals that originate from Buy signals placed before the selected range (I'm not sure if I'm explaining myself clearly).
In Explorer, I've gotten this far so far:
if( Status("action") == actionExplore )
{
bi = BarIndex(); //genera un array que contiene el nĂşmero o Ăndice de cada barra del gráfico
SFBIR = Status( "firstbarinrange" );
SLBIR = Status( "lastbarinrange" );
InRange = bi >= SFBIR AND bi <= SLBIR;
ValidBuy = Buy AND InRange;
ValidSell = Sell AND InRange;
Filter = ValidBuy OR ValidSell;
AddColumn(Buy, "Buy");
AddColumn(Sell, "Sell");
AddColumn(Score, "Score");
}
But that doesn't work.
I would appreciate any help.
To be more specific, what I'm looking for is:
That the explorer starts with signals within the selected range, but if they are Sell signals (i.e., they come from a Buy signal prior to the range), it doesn't show them.
