Topics
Replies
BeardPower
03 May 2017, 22:10
You can't, as this is only a configuration setting for a server/broker, not a client/trader.
@BeardPower
BeardPower
16 Mar 2017, 17:49
RE:
But I guess you are referring to the scaling, hence OHLC would be the bar height.
No, there is no API support for chart specific settings.
@BeardPower
BeardPower
16 Mar 2017, 17:45
Are you referring to the OH/CL range?
If so, there is no function for getting the bar range. You have to calculate it yourself by using the OHCL values.
@BeardPower
BeardPower
06 Mar 2017, 02:15
Works with live data
Finally I was able to test it under market conditions and the cBot works like expected.
It's definitely an issue with backtesting.
Hope this helps.
@BeardPower
BeardPower
05 Mar 2017, 23:13
( Updated at: 21 Dec 2023, 09:20 )
Bug in cAlgo: adding non-existing bars
I made some screenshots, where you can clearly see, that cBot is adding a blue bullish bar (as seen at the data box). The next bar has also a wrong date because of that.
Screenshot from cBot:
Screenshot from Indicator (there is no blue bullish bar):
Screenshot from cBot (there is a blue bullish candle and the red bearish bar has the same date as the bar before: 28/02/2017 22:00):
Same screenshot from Indicator (no blue bullish candle and the date of the next read bearish bar is correct)
:
@BeardPower
BeardPower
05 Mar 2017, 21:24
The root of evil
Finally I found out why this issue happens.
This is the Calculate function:
public override void Calculate(int index) { Print(index); lowsMA[index] = lowsMA.Last(1); }
lowsMA is just an output parameter:
[Output("MA lows", Color = Colors.IndianRed, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries lowsMA { get; set; }
The log form the indicator:
05/03/2017 19:08:55.461 | index: 0 [...] 05/03/2017 19:08:56.975 | index: 3150
The lof from cAlgo, calling the indicator:
02/03/2017 04:10:00.000 | cAlgo calls for index 599916 02/03/2017 04:10:00.000 | index: 599916 02/03/2017 04:10:00.000 | index: 599914 02/03/2017 04:10:00.000 | index: 599915 [...] 03/03/2017 21:59:00.000 | cAlgo calls for index 602415 03/03/2017 21:59:00.000 | index: 602415 03/03/2017 21:59:00.000 | index: 602413 03/03/2017 21:59:00.000 | index: 602414 03/03/2017 21:59:00.000 | Backtesting finished
So, why is the indicator calling itself two additional times, when called from cAlgo?
@BeardPower
BeardPower
05 Mar 2017, 20:25
Forther investigation
I forgot to mention, that this behavior is occurring with backtesting.
There was no opportunity to test on live data, as the market is closed over the weekend.
After the indicator is calling itself up to index 77, it works as expected:
Sorry, that was the incorrect. I wanted to say, that it still is now working as expected.
The indicator is lacking behind, and some internal function seems to be calling it, but it should not.
I investigated further, and here is another example output. The indicator always get called two additional times, which are NOT called by cAlgo:
03/03/2017 21:48:00.000 | cAlgo calls for index 602404 03/03/2017 21:48:00.000 | indicator calculating for index 602404 count: 602404 03/03/2017 21:48:00.000 | indicator calculating for index 602402 count: 602403 03/03/2017 21:48:00.000 | indicator calculating for index 602403 count: 602404 03/03/2017 21:49:00.000 | cAlgo calls for index 602405 03/03/2017 21:49:00.000 | indicator calculating for index 602405 count: 602405 03/03/2017 21:49:00.000 | indicator calculating for index 602403 count: 602404 03/03/2017 21:49:00.000 | indicator calculating for index 602404 count: 602405 03/03/2017 21:50:00.000 | cAlgo calls for index 602406 03/03/2017 21:50:00.000 | indicator calculating for index 602406 count: 602406 03/03/2017 21:50:00.000 | indicator calculating for index 602404 count: 602405 03/03/2017 21:50:00.000 | indicator calculating for index 602405 count: 602406 03/03/2017 21:51:00.000 | cAlgo calls for index 602407 03/03/2017 21:51:00.000 | indicator calculating for index 602407 count: 602407 03/03/2017 21:51:00.000 | indicator calculating for index 602405 count: 602406 03/03/2017 21:51:00.000 | indicator calculating for index 602406 count: 602407
@BeardPower
BeardPower
05 Mar 2017, 19:33
RE: RE: There is definitely an issue with cAlgo referencing indicators
The OnBar function should be this code, of course (a semicolon was missing):
protected override void OnBar() { Print("cAlgo calls for index " + MarketSeries.Close.Count); halfTrend.Calculate(MarketSeries.Close.Count); }
This forum definitely needs some edit functionality.
Thanks!
@BeardPower
BeardPower
05 Mar 2017, 19:28
RE: There is definitely an issue with cAlgo referencing indicators
Spotware said:
Dear Traders,
We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.
Regarding Calculate(int index) and OnBar():
The Calculate(int index) method is called for each historic bar starting from the beginning of the series up to the current bar and then on each incoming tick.The index parameter, represents each bar, ranging from 0 up to the current (last) bar.
The OnBar() method is called on each incoming bar providing the user the values of incoming bar.
It's not coding related. There is definitely an issue with this. I experience the same problem. This behavior is completely messing up the indicator values. Putting the indicator on the chart works as expected.
I made an indicator, with the following Calculation method:
public override void Calculate(int index) { Print("indicator calculating for index " + index + " count: " + MarketSeries.Close.Count); }
In cAlgo I made the following OnBar method:
protected override void OnBar() { Print("cAlgo calls for index " + MarketSeries.Close.Count); halfTrend.Calculate(MarketSeries.Close.Count) }
This creates the following output:
26/07/2015 21:05:00.000 | cAlgo calls for index 77 26/07/2015 21:05:00.000 | indicator calculating for index 77 count: 77 26/07/2015 21:05:00.000 | indicator calculating for index 0 count: 1 26/07/2015 21:05:00.000 | indicator calculating for index 1 count: 2 [...] 26/07/2015 21:05:00.000 | indicator calculating for index 76 count: 77
Where is that third line coming from? cAlgo calls the indicator for calculating index 77, the indicator calculates it and automatically gets called with another index of 0 up to the index cAlgo was calling for?
After the indicator is calling itself up to index 77, it works as expected:
27/07/2015 21:05:00.000 | cAlgo calls for index 78 27/07/2015 21:05:00.000 | indicator calculating for index 78 count: 78 27/07/2015 21:05:00.000 | indicator calculating for index 76 count: 77 28/07/2015 21:00:00.000 | cAlgo calls for index 79 28/07/2015 21:00:00.000 | indicator calculating for index 79 count: 79 28/07/2015 21:00:00.000 | indicator calculating for index 77 count: 78
No more calling itself, so what is the issue here?
@BeardPower
BeardPower
07 Feb 2017, 00:43
It's not a bug
Hi,
No, this is not a bug, it's just how the actual bar on a higher timeframe is formed.
The open price is the same throughout the hour, because it will not change, but all others will.
Whithin 1 hour, there are 6 ten-minute bars created, which all form an hour-bar. While the ten-minute bars are forming, the close price of the one-hour bar is not finished yet, but every close of each ten-minute bar happens before the closing of an hour-bar. That's why you see the close price of the ten-minute bars after the open of an hour bar.
See /api/reference/dataseries/lastvalue
Remarks
The last value may represent one of the values of the last bar of the market series, e.g. Open, High, Low and Close. Therefore, take into consideration that on each tick, except the Open price, the rest of the values will most probably change.
You need to reference the index of the bar relatively to the current bar of your one-hour MarketSeries.
See /api/reference/internals/marketseries
Example 2
//Accessing historical O-H-L-C prices from Robots int index = MarketSeries.Close.Count-1; double close = MarketSeries.Close[index]; double high = MarketSeries.High[index]; double low = MarketSeries.Low[index]; double open = MarketSeries.Open[index];
Replacing MarketSeries.<> with _series1.<> will give you the last prices of one-hour bar.
@BeardPower
BeardPower
08 Feb 2016, 16:25
Try do make a clean build and rebuild your code.
Make sure you are generating debug information in the "Generate Debug Info" option.
Did you restart your program in cAlgo?
@BeardPower
BeardPower
08 Feb 2016, 15:50
Unfortunately the current API does not support object queries.
You can only delete all objects or objects with a given object name.
@BeardPower
BeardPower
22 Jun 2017, 06:03
RE: RE: RE:
skoutz.rothchild said:
I assume he was not referring to breaking AES, but normal decryption with the key, which can be grabbed.
The decryption key needs to be stored somewhere, be it a passphrase or the hash of the passphrase. The .calgo files are used by cTrader/cAlgo, so they need to load and decrypt the files. To achieve this, they need the key, which means it has to be stored somewhere. The decryped/plaintext key is at some point available in RAM and so it can be grabbed.The attack vector is not the encrypted .calgo file, but the application, which is using/decrypting it, which is cTrader/cAlgo.
@BeardPower