Topics
Replies
Spotware
12 Jun 2014, 09:31
OnPositionOpened method is obsolete. It works only for old trading API accessible through the Trade object.
In your case you need to subscribe to Positions.Opened event:
protected override void OnStart() { Positions.Opened += OnPositionsOpened; } void OnPositionsOpened(PositionOpenedEventArgs args) { ... }
@Spotware
Spotware
12 Jun 2014, 09:19
Antonma is right, you need to take previous bar. Here is some clarifications:
OnBar event happens when new bar is opened. At that moment MarketSeries collection already contains tick from new bar. It means that last bar is not formed and in general cases open = high = low = close. If you want to access to last formed bar you need take previous one.
You can use following code to access to the previous bar:
Print("Open: {0}, Close: {1}", MarketSeries.Open.Last(1), MarketSeries.Close.Last(1));
@Spotware
Spotware
10 Jun 2014, 15:28
RE:
casado said:
After you instructions ("We apologize for any inconvenience. Please press Shift+Ctrl+Alt+T. It will send us the troubleshooting information."), I pushed it a few times.
I think that ctrader sent you the troubleshooting information.
Have you notice about? I don´t use ctrader from then. It´s imposible.
Do you what happened with cTrader new version? Will it be solution to memory troubleshooting?
Thank you
We do not see any problem in your troubleshooting report. Could you please be more specific and describe what kind of problems do you observe? We can also recommend you to remove all custom indicators and try to reproduce the problem without custom indicators.
@Spotware
Spotware
10 Jun 2014, 09:34
We can recommend you to have a look at Sample Trend Robot. It uses indicators and checks their crosses.
@Spotware
Spotware
10 Jun 2014, 09:10
RE: RE: RE:
Marin0ss said:
Hi, Thank you very much! I left out te part in OnStart, as I don't want an order to be opened. (this will not cause any problems for the rest of the code?)
I would also like to Backtest this, this is not possible because of use of Server.Time; how must the code look to make this work?
I tried to replace Server.Time for MarketSeries.OpenTime.LastValue but this won't work.
Server.Time is emulated in backtesting, therefore you can backtest such cBot. Please do not forget to change TimeZones.UTC to the desired timezone.
@Spotware
Spotware
10 Jun 2014, 08:20
We do not provide such API. You can post your idea to vote.spotware.com
@Spotware
Spotware
10 Jun 2014, 08:16
1) Yes, you can use an Indicator instead of cBot. In order to do that you need to create new Indicator in cAlgo and copy your code there. Please note that Indicator doesn't have OnStart and OnTick methods. You will need to use Initialize and Calculate methods instead. In Calculate method please do not forget to check IsRealTime property in order to filter historical bars.
2) var filePath = @"C:\my folder\my file.txt";
3) There is no such method in cAlgo.API, but you can code such formatting.
@Spotware
Spotware
05 Jun 2014, 17:14
There is no such functionality at the moment. You can post your idea to vote.spotware.com
@Spotware
Spotware
12 Jun 2014, 09:33
RE: RE:
breakermind said:
index is wrong. The weeklySeries object has different indexes.
@Spotware