AG
Topics
07 Oct 2020, 16:20
3
843
1
02 Jul 2020, 11:53
965
2
23 Apr 2020, 18:53
998
2
04 Apr 2020, 20:31
1507
5
04 Apr 2020, 20:29
767
1
Replies
agent.xzxz
06 Apr 2020, 16:14
RE:
Hi,
Can you run this code on your side? Select Monthly Timeframe.
using System;
using cAlgo.API;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class IndexByTimeIssue : Robot
{
protected override void OnStart()
{
double lastBarOpenPrice = Bars.OpenPrices.LastValue;
DateTime lastBarOpenTime = Bars.OpenTimes.LastValue;
int index = Bars.OpenTimes.GetIndexByTime(lastBarOpenTime);
double openPriceByIndex = Bars.OpenPrices.Last(index);
Print("Equal?: ", lastBarOpenPrice == openPriceByIndex);
}
protected override void OnTick()
{
// Put your core logic here
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
Why lastBarOpenPrice is not equal to openPriceByIndex?
I only get the index by time right? They should be equal.
@agent.xzxz
agent.xzxz
08 Apr 2020, 19:52
RE:
PanagiotisCharalampous said:
Thank you!
@agent.xzxz