
Topics
Replies
PanagiotisCharalampous
14 Jun 2019, 14:24
Hi Bjorn,
Can you post the complete cBot code?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 14:23
Hi Bjiorn,
You can try copying the settings file from the source computer. You can find it in C:\Users\User\AppData\Roaming\broker cTrader\Settings. Paste it in the same destination at the target computer.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 10:02
( Updated at: 21 Dec 2023, 09:21 )
Hi Asen,
I tried it but I do not see any problem. See below
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 09:53
( Updated at: 21 Dec 2023, 09:21 )
Hi FireMyst,
Here is your problem
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 09:48
Hi calgodemo,
It seems that the code you shared is not complete. There are no dots drawn on the chart using the posted indicator.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 09:32
Hi office3131,
Thank you for contacting Spotware. Can you please explain why do you think the results are wrong?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 09:24
RE:
FireMyst said:
HI @Panagiotis:
Before sharing code, since the PID was given in the log output from cTrader, is your team able to look it up in any "transaction logs" to see what, if anything, was logged on the server?
Or is that something I can pass along to Pepperstone, and then they would contact Spotware to find out more?
Thank you,
Hi FireMyst,
To investigate the reasons for the specific position you need to go through Pepperstone. They are in charge of their execution. Regarding the code sample, I will need the complete cBot and steps to reproduce. Since I do not see any obvious reason for a technical error, I might need to forward to the QA team for further investigation. Btw a more proper way to round prices is the following
Math.Round(price, Symbol.Digits)
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 15:01
Hi diegorcirelli,
Check your volume. The mimimum for EURUSD is 1000.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 14:49
Hi Bjorn,
Here it is
using System; using System.Linq; using System.Text; using cAlgo.API; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class DayTradeG1 : Robot { [Parameter("News Hour", DefaultValue = 14, MinValue = 0, MaxValue = 23)] public int NewsHour { get; set; } [Parameter("News Minute", DefaultValue = 30, MinValue = 0, MaxValue = 59)] public int NewsMinute { get; set; } [Parameter("Pips away", DefaultValue = 10)] public int PipsAway { get; set; } [Parameter("Take Profit", DefaultValue = 50)] public int TakeProfit { get; set; } [Parameter("Stop Loss", DefaultValue = 10)] public int StopLoss { get; set; } [Parameter("Volume", DefaultValue = 100000, MinValue = 10)] public int Volume { get; set; } [Parameter("Seconds Before", DefaultValue = 10, MinValue = 1)] public int SecondsBefore { get; set; } [Parameter("Seconds Timeout", DefaultValue = 10, MinValue = 1)] public int SecondsTimeout { get; set; } [Parameter("One Cancels Other")] public bool Oco { get; set; } [Parameter("ShowTimeLeftNews", DefaultValue = false)] public bool ShowTimeLeftToNews { get; set; } [Parameter("ShowTimeLeftPlaceOrders", DefaultValue = true)] public bool ShowTimeLeftToPlaceOrders { get; set; } [Parameter("Label", DefaultValue = "Label")] public string Label { get; set; } private bool _ordersCreated; private DateTime _triggerTimeInServerTimeZone; protected override void OnStart() { Positions.Opened += OnPositionOpened; Timer.Start(1); var triggerTimeInLocalTimeZone = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, NewsHour, NewsMinute, 0); if (triggerTimeInLocalTimeZone < DateTime.Now) triggerTimeInLocalTimeZone = triggerTimeInLocalTimeZone.AddDays(1); _triggerTimeInServerTimeZone = TimeZoneInfo.ConvertTime(triggerTimeInLocalTimeZone, TimeZoneInfo.Local, TimeZone); } protected override void OnTimer() { var remainingTime = _triggerTimeInServerTimeZone - Server.Time; DrawRemainingTime(remainingTime); if (!_ordersCreated) { var sellOrderTargetPrice = Symbol.Bid - PipsAway * Symbol.PipSize; ChartObjects.DrawHorizontalLine("sell target", sellOrderTargetPrice, Colors.Red, 1, LineStyle.DotsVeryRare); var buyOrderTargetPrice = Symbol.Ask + PipsAway * Symbol.PipSize; ChartObjects.DrawHorizontalLine("buy target", buyOrderTargetPrice, Colors.Blue, 1, LineStyle.DotsVeryRare); if (Server.Time <= _triggerTimeInServerTimeZone && (_triggerTimeInServerTimeZone - Server.Time).TotalSeconds <= SecondsBefore) { _ordersCreated = true; var expirationTime = _triggerTimeInServerTimeZone.AddSeconds(SecondsTimeout); PlaceStopOrder(TradeType.Sell, Symbol, Volume, sellOrderTargetPrice, Label, StopLoss, TakeProfit, expirationTime); PlaceStopOrder(TradeType.Buy, Symbol, Volume, buyOrderTargetPrice, Label, StopLoss, TakeProfit, expirationTime); ChartObjects.RemoveObject("sell target"); ChartObjects.RemoveObject("buy target"); } } if (_ordersCreated && !PendingOrders.Any(o => o.Label == Label)) { Print("Orders expired"); Stop(); } } private void DrawRemainingTime(TimeSpan remainingTimeToNews) { if (ShowTimeLeftToNews) { if (remainingTimeToNews > TimeSpan.Zero) { ChartObjects.DrawText("countdown1", "Time left to news: " + FormatTime(remainingTimeToNews), StaticPosition.TopLeft); } else { ChartObjects.RemoveObject("countdown1"); } } if (ShowTimeLeftToPlaceOrders) { var remainingTimeToOrders = remainingTimeToNews - TimeSpan.FromSeconds(SecondsBefore); if (remainingTimeToOrders > TimeSpan.Zero) { ChartObjects.DrawText("countdown2", "Time left to place orders: " + FormatTime(remainingTimeToOrders), StaticPosition.TopRight); } else { ChartObjects.RemoveObject("countdown2"); } } } private static StringBuilder FormatTime(TimeSpan remainingTime) { var remainingTimeStr = new StringBuilder(); if (remainingTime.TotalHours >= 1) remainingTimeStr.Append((int)remainingTime.TotalHours + "h "); if (remainingTime.TotalMinutes >= 1) remainingTimeStr.Append(remainingTime.Minutes + "m "); if (remainingTime.TotalSeconds > 0) remainingTimeStr.Append(remainingTime.Seconds + "s"); return remainingTimeStr; } private void OnPositionOpened(PositionOpenedEventArgs args) { var position = args.Position; if (position.Label == Label && position.SymbolCode == Symbol.Code) { if (Oco) { foreach (var order in PendingOrders) { if (order.Label == Label && order.SymbolCode == Symbol.Code) { CancelPendingOrderAsync(order); } } } Stop(); } } } }
If you need assistance in changing your cBots, you can always reach out to a Consultant.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 14:29
Hi Bjorn,
You set a label to each order but is constant
private const string Label = "News Straddler v1";
Your code filters out orders based on symbol and label
foreach (var order in PendingOrders) { if (order.Label == Label && order.SymbolCode == Symbol.Code) { CancelPendingOrderAsync(order); } }
You should make Label a parameter and set a different one for each instance so that each instance operates only on its orders.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 14:22
Hi diegorcirelli,
I just tried it and it works. I don't see anything wrong.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 14:11
Hi bjornvandekerkhof,
Thanks for posting in our forum. You should try setting a different label for each instance's orders.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 10:05
Hi exane,
Can you please send us troubleshooting information next time this happens? To do so, please press Ctrl+Alt+Shift+T, paste a link to this discussion in the textbox and then press Submit.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 10:02
Hi FireMyst,
If you can share the cBot code and cBot parameters we can investigate further.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 09:57
Hi FireMyst,
No there is no such option at the moment.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 09:55
Hi calgodemo,
Can you share the cBot and Indicator code?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 09:52
Hi diegorcirelli,
If you need assistance in developing your cBot, I would advise you to contact a Consultant or post a Job.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Jun 2019, 09:49
Hi mo798ua,
At the moment there is no suvh functionality in the mobile application.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
12 Jun 2019, 16:00
Hi,
Here is a more correct condition
if (Positions.Count(x => x.SymbolCode == Symbol.Code && x.Label == Label && x.TradeType == TradeType.Buy) > 0)
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
14 Jun 2019, 14:48
Hi Bjorn,
No there is no other way.
Best Regards,
Panagiotis
@PanagiotisCharalampous