Can you use chart objects in robots?
Can you use chart objects in robots?
11 Mar 2013, 01:19
Can you use chart objects in robots?
for example: ChartObjects.DrawText
in order to show trades made on the chart...
Replies
lec0456
13 Mar 2013, 23:31
I have this line:
ChartObjects.DrawText("Trade"+(MarketSeries.Close.Count-1), "T", MarketSeries.Close.Count-1, openedPosition.EntryPrice+3*Symbol.PipSize, VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Yellow);
in the OnPositionOpened event, but it doesn't work. I was expecting it would place a "T" for trade over the bar a position was opened but nothing, no error , nothing...any clues?
@lec0456
cAlgo_Fanatic
14 Mar 2013, 15:10
Could you try a different color or modifying the y-position just in case it results outside the chart. There is nothing wrong with the code, it should normaly be displayed.
@cAlgo_Fanatic
lec0456
15 Mar 2013, 22:30
Ok, I changed the color and played with the position but nothing. The code is below, Could you see if it works by backtesting?
using System; using System.Collections.Generic; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.Indicators; using cAlgo.API.Requests; namespace cAlgo.Robots { [Robot] public class TestChartObject : Robot { private Position openedTrade; protected override void OnBar() { if (Trade.IsExecuting) return; if (openedTrade==null) { var Order = new MarketOrderRequest(TradeType.Buy, 100000) {Label="Trade",SlippagePips=1,StopLossPips=10,TakeProfitPips=10}; Trade.Send(Order); } } protected override void OnPositionOpened(Position openedPosition) { openedTrade=openedPosition; ChartObjects.DrawText("Trade"+(MarketSeries.Close.Count-1), "T", MarketSeries.Close.Count-1, openedPosition.EntryPrice+(5*Symbol.PipSize), VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Red); Print("************************{0} {1}*****************************",MarketSeries.Close.Count-1,openedPosition.EntryPrice+(5*Symbol.PipSize)); } protected override void OnPositionClosed(Position closedPosition){openedTrade=null;} } }
@lec0456
TraderM
16 Mar 2013, 15:10
Hi,
I tried to do this, but I could only get it to work in real time only, not back-testing.
One of the examples is qualified by: if(IsRealTime), so I assume that this can only be done in real time.
It would be great if this can be done backtesting, it would save so much time!
M
@TraderM
lec0456
16 Mar 2013, 21:42
TraderM thanks for checking on the issue. There are a couple of methids that only work in real time like the notifications for email and sound. But I was trying to verify if the same was true with the chart Objects. I would like to see if support will verify this and decide if it is by design or a bug. I would really like to see this available with backtesting.
I will tell you that you can get indicators to mark the chart with trade entries and exits but that is obviously a lot more work and not going to cover all the possible uses as within a robot.
@lec0456
cAlgo_Development
18 Mar 2013, 11:43
Backtesting robot does not have associated chart and it is impossible to use Chart Object in backtesting. This is by design, chart that you see when selecting an instance is for real-time robot execution only. As I understood you need it mainly to visualize backtesting deals and analyze them. This feature is high-priority for us now. I hope you will be able to use in the nearest future.
@cAlgo_Development
AlexanderRC
30 Aug 2014, 18:24
Consider the following code
using System; using cAlgo.API; using cAlgo.API.Internals; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class DebugBacktestChart : Robot { private DateTime startTime; private double startAsk; protected override void OnStart() { startTime = Server.Time; startAsk = Symbol.Ask; Print("Open Ask: {0}", startAsk); } protected override void OnBar() { ChartObjects.DrawLine("openBid", startTime, startAsk, Server.Time, startAsk, Colors.Red, 2, LineStyle.Solid); } protected override void OnStop() { double endAsk = Symbol.Ask; ChartObjects.DrawLine("closeBid", startTime, endAsk, Server.Time, endAsk, Colors.Blue, 2, LineStyle.Solid); Print("Close Ask: {0}", endAsk); } } }
No lines in back testing results.
Am I doing something wrong or that just not yet implemented?
Cannot efficiently visually debug complex robots because of that. Either I need to do that when the market is open with a demo account and wait for the needed events to happen or wade through the back test debug output why robot did or did not do something at some point.
@AlexanderRC
Pav K
06 Aug 2015, 19:49
RE:
I guess this feature is not implemented yet. Do you have any ETA?
Also is there is any way to Visually pass information on to chart when backtesting?
It is huge problem when debugging robot.
Spotware said:
Chart objects are not supported in backtesting. We plan to implement it in the future.
@Pav K
pavel
12 Feb 2017, 18:23
RE:
cAlgo_Development said:
Backtesting robot does not have associated chart and it is impossible to use Chart Object in backtesting. This is by design, chart that you see when selecting an instance is for real-time robot execution only. As I understood you need it mainly to visualize backtesting deals and analyze them. This feature is high-priority for us now. I hope you will be able to use in the nearest future.
It is 3 years now, I can not imagine something in low-priority. Is cTrader dead?
@pavel
kricka
22 May 2017, 19:45
Hold your horses
Come on guys, to introduce a platform to compete with MT4 is not a one night stand, it takes years of testing and releases to get it done right. We as traders who are using the platform will benefit by this for sure at the end. So my suggestion to you all is "Hold Your Horses". Give Spotware the deserved time to work it out what's needed to be done!
@kricka
qstream
28 Dec 2017, 11:34
RE: Hold your horses
kricka said:
Come on guys, to introduce a platform to compete with MT4 is not a one night stand, it takes years of testing and releases to get it done right. We as traders who are using the platform will benefit by this for sure at the end. So my suggestion to you all is "Hold Your Horses". Give Spotware the deserved time to work it out what's needed to be done!
This task doesn't take 3 years to implement, lol. I'm saying it as a professional software developer. 4 weeks maximum.
I don't understand... how it was desinged so to not let people visually debug their bots on historical data?? Even more, whole backtesting functionality is very hard to debug bots. It's just craziness.
Any updates from Spotware when it's going to be done?
Thanks.
@qstream
... Deleted by UFO ...
cAlgo_Fanatic
11 Mar 2013, 11:10
Yes, ChartObjects can be used in Robots. Let us know if you need more help with the code.
@cAlgo_Fanatic