I am trying to create a strategy. It is done but I can't add a %stop and I would like to use draw dots in the stopl loss level. This is what I have:
protected override void OnBarUpdate()
{
//Registramos el numero total de operaciones en el iniciio de la sesion
if (Bars.FirstBarOfSession)
{
NumAntOperaciones = Performance.AllTrades.Count;
}
//Comprobamos que no se ha alcanzado el maximo numero de operaciones diario.
if (Performance.AllTrades.Count - NumAntOperaciones >= NTrades)
{
return;
}
double SRLargos = Position.AvgPrice - Position.AvgPrice * (stopRisk / 100);
double SRCortos = Position.AvgPrice + Position.AvgPrice * (stopRisk / 100);
Then I have my conditions
And finally this:
//Stop Largos
ExitLongStop(SRLargos,"Stop PCT", "");
DrawDot(CurrentBar.ToString() + "largos",true, 0,SRLargos, Color.Red);
//Stop Cortos
ExitShortStop(SRCortos,"Stop PCT", "");
DrawDot(CurrentBar.ToString() + "cortos" ,true,0,SRCortos, Color.Green);
When I do the backtest this is what I got, and I realzie the Stop loss is not working because I have huge losses and they shouldn't be that size thanks to the stop. Also in the chart tab the chart is so small...you will see. I attach the picture
Thanks
Comment