Spain/Spain
Posts: 6 since Feb 2016
Thanks Given: 1
Thanks Received: 0
|
Hola a todos,
necesito implementar el límite de trades diarios para una estrategia en NT8
tengo el siguiente código, que funciona bien en backtesting pero NO en real.
alguien me puede ayudar a encontrar el error?
muchas gracias
private int trades_till_today = 0;
private int _MaxEntriesDay = 2;
protected override void OnBarUpdate()
{
if ( Bars.IsFirstBarOfSession )
{
trades_till_today = SystemPerformance.AllTrades.Count;
}
int trades_today = SystemPerformance.AllTrades.Count - trades_till_today + (Position.MarketPosition != MarketPosition.Flat ? 1 : 0);
if (trades_today < _MaxEntriesDay)
{
If (Close[0] > EMA1[0])
{
EnrterLong();
}
}
|