Error in routine after upgrade in system
Error in routine after upgrade in system
06 May 2020, 17:29
Hi, good morning
This routine below was running well but have a error because the system received a upgrade and I don't know this information.
Please, can you check for me?
Thank you
Eli.
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Testeusandohoraanteriorcomoreferencia : Robot
{
[Parameter(DefaultValue = 1)]
public double VolumeToOpenOrders { get; set; }
[Parameter(DefaultValue = 1000)]
public int TakeProfitInPips { get; set; }
[Parameter("Stop Loss", DefaultValue = 2000)]
public int StopLoss { get; set; }
[Parameter("Hora Abertura H", DefaultValue = 5)]
public int LastValue { get; set; }
protected override void OnBar()
{
if (Bars.OpenTimes.LastValue.Hour == LastValue)
{
// var PreviusClose = Bars.Close.Last(5);
var PreviusClose = Bars.ClosePrices(5);
var PreviusOpen = Bars.OpenPrices(5);
if (PreviusClose != PreviusOpen)
{
if (PreviusClose > PreviusOpen)
ExecuteMarketOrder(TradeType.Buy, Symbol.Name, VolumeToOpenOrders, "", StopLoss, TakeProfitInPips);
{
if (PreviusClose < PreviusOpen)
ExecuteMarketOrder(TradeType.Sell, Symbol.Name, VolumeToOpenOrders, "", StopLoss, TakeProfitInPips);
{
}
}
}
}
}
}
}
PanagiotisCharalampous
07 May 2020, 08:37
Hi Eliezer,
You still need to use Last() for ClosePrices. See below
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous