Topics
Replies
MHBB
25 Jun 2018, 17:06
Hi Panagiotis, thanks for the reply
Now I understand the problem, I was calculating my custom RSI in a cbot and not an indicator, so the data was different
Can you explain to me why Indicators Calculate on every index, example
244031
244032
244033
244034
244035
244036
244037
244038
244039
244040
244041
244042
.....
Code example
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; using System.IO; using System.Text; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class indexTest : Indicator { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } StreamWriter log = new StreamWriter("c:/testIndicator.txt", true, Encoding.ASCII, 0x10000); protected override void Initialize() { } public override void Calculate(int index) { log.WriteLine(index); log.Flush(); } public void Close() { log.Close(); } } }
But cBots don't calculate on every index, for example when I log every tick I get this:
244031
244039
244041
244043
244045
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; using System.IO; using System.Text; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class NewcBot : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } private StreamWriter log = new StreamWriter("c:/indexTest.txt", true, Encoding.ASCII, 0x10000); private indexTest indexTest; protected override void OnStart() { indexTest = Indicators.GetIndicator<indexTest>(0); } protected override void OnTick() { indexTest.Result.Last(0); log.WriteLine(MarketSeries.Close.Count); log.Flush(); } protected override void OnStop() { log.Close(); indexTest.Close(); } } }
@MHBB
MHBB
18 May 2018, 11:38
RE:
hans177 said:
Ok, I managed to do it, without really understanding what I'm doing of course ;)
1. Subscribe to quote updates
2.
private AsyncCallback quoteReceived; ... quoteReceived = new AsyncCallback(OnTick); ... _priceStream.BeginRead(buffer, 0, 1024, quoteReceived, null);3.
private void OnTick(IAsyncResult ar) { int bytesRead = _priceStream.EndRead(ar); if (bytesRead > 0) { Console.WriteLine(Encoding.ASCII.GetString(buffer, 0, bytesRead)); _priceStream.BeginRead(buffer, 0, 1024, quoteReceived, null); } }
Could you share your code on how to get market data after subscribing, I'm having troubles getting my head around implementing FIX
@MHBB
MHBB
15 May 2018, 16:21
RE:
Hi Panagiotis,
My code is very large and complex, so maybe there could be a problem in my code, but why would that result in calgo not processing market data?
I will setup another empty cbot and run it over the next couple of days and see if the same problem happens
Regards, Simon
@MHBB
MHBB
07 May 2018, 14:29
RE:
Hi Panagiotis,
Because of the limit of data loaded through GetSeries, there isn't enough data to calculate the TSMA
In a forum post before Spotware said they would add the feature to select how much data to load, is this still in progress?
Example:
MarketData.GetSeries("MARKET", TimeFrame.Hour, 200)
or something like
MarketData.GetSeries("MARKET", TimeFrame.Hour, TimeSpan.OneMonth)
This feature would be very useful
Thanks, Simon
@MHBB
MHBB
25 Feb 2018, 05:22
Same problem for ICMarkets cAlgo, and had this issue a couple of weeks ago at the weekend
It's frustrating, I'm sure there are several of us who work on, and backtest our algorithms at the weekend
If updates or maintenance needs to be carried out, can't they be scheduled and carried out at one go, rather than the servers being unstable all weekend
@MHBB
MHBB
04 Feb 2018, 10:37
Also having the same issue since yesterday with IC Markets, constant disconnecting and reconnecting. I talked to them using online support to ask if they were doing upgrades/maintenance and they said to contact Spotware
Seems to be an IC Market issue as not having the same problem with other brokers using cAlgo
@MHBB
MHBB
18 Dec 2016, 15:33
So I logged each time Calculate is called, and when backtesting using 1m (tick data) MarketSeries.High[index] on the dax, it gets called twice
[12/16/2016 10:41:00 AM] index:18342 / price:11387.3
[12/16/2016 10:41:00 AM] index:18342 / price:11390.5
The second value is the one that corresponds to those shown in cTrader
So unless I set the IndicatorDataSeries like this:
namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { [Output("Main")] public IndicatorDataSeries Result { get; set; } private int lastIndex = 0; protected override void Initialize() { } public override void Calculate(int index) { Result[index] = 123; } } }
And not like this, which would allow me to get the value I want
namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { [Output("Main")] public IndicatorDataSeries Result { get; set; } private int lastIndex = 0; protected override void Initialize() { } public override void Calculate(int index) { if (index > lastIndex) { OnBarClosed(lastIndex); lastIndex = index; } } private void OnBarClosed(int index) { Result[index] = 123; } } }
Then the Moving Average indicator only produces Nan
Confused...
@MHBB
MHBB
03 Nov 2015, 04:44
Some symbols download and load without problem, such as
#Germany30
#USNDAQ100
While others cause the exception mentioned above,
#ASX200
#HongKong50
When trying in Optimization mode, I get the following exception for these symbols
Exception #16308131
It appears to download the data, as it says loading data, but then when trying to parse the data it comes up with the error.
I tried using another computer with the same results, I also tried deleting the cache, also copying a working symbol such as #Germany30_Minute.ctb and renaming it #ASX200_Minute.ctb in /AppData/Roaming/BacktestingCache/ but all no use
Would appreciate you resolving the issue as I am wanting to backtest on the problematic symbols
@MHBB
MHBB
25 Jun 2018, 17:48
Thanks for the clarification Panagiotis
@MHBB