MarketData access broken
MarketData access broken
14 Dec 2019, 01:20
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
protected override void OnStart()
{
var eurusdBars = MarketData.GetBars(TimeFrame.Daily, "EURUSD");
}
protected override void OnBar()
{
Print(Bars.ClosePrices.LastValue);
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
when not on the EURUSD the access to the MarketData during `OnStart()` breaks execution of the bot. (silently)
Replies
mirco.kahle@gmail.com
16 Dec 2019, 14:06
Hi Panagiotis,
the bot is supposed to print the close prices of the current symbol to the log, nothing more. When I run it for the symbol mentioned in this line
var eurusdBars = MarketData.GetBars(TimeFrame.Daily, "EURUSD");
it works as expected.
But if I use it on any other symbol it won't log the messages. It seems the OnBar() event is never triggered.
Maybe the default events and accessors like `onBar`, `Bars` ... are disabled once you interact with a different symbol than the one the bot is running on?
Regards,
Mirco
@mirco.kahle@gmail.com
PanagiotisCharalampous
16 Dec 2019, 14:59
( Updated at: 21 Dec 2023, 09:21 )
Hi M K,
As I said I have tried this cBot but I do not see any issues. See below an example from GBPUSD t1
Am I missing something?
Best Regards,
Panagiotis
@PanagiotisCharalampous
mirco.kahle@gmail.com
16 Dec 2019, 16:52
( Updated at: 21 Dec 2023, 09:21 )
interesting. for me it is doing nothing:
maybe we are on different versions somehow?
Thanks to the blog post you linked in an other thread I got my other code working. just avoid the OnBar() event...
@mirco.kahle@gmail.com
PanagiotisCharalampous
17 Dec 2019, 08:15
( Updated at: 21 Dec 2023, 09:21 )
Hi M K,
I assume you are using 3.7
Best Regards,
Panagiotis
@PanagiotisCharalampous
mirco.kahle@gmail.com
18 Dec 2019, 00:25
RE:
PanagiotisCharalampous said:
Hi M K,
I assume you are using 3.7
Yes, I cant seem to find a dialog that gives me the exact build / version number, but it says "(Public beta) 3.7" in the title
@mirco.kahle@gmail.com
... Deleted by UFO ...
PanagiotisCharalampous
16 Dec 2019, 08:31
Hi M K,
I have tried this cBot but I do not see any issues. Also I cannot understand where is eurusdBars used.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous