Topics
Replies
prasanthtp
15 Mar 2023, 01:29
( Updated at: 15 Mar 2023, 01:44 )
Still getting error
Hi,
I am still getting the error. I am sharing the source code. Could you please try this on your end? It got 2 params, EventHours and EventMins. If an economic event in an econimic calender is AT 16:30, The hours param will be 16 and the mins will be 30. Basically I am trying to execute an order at the same time market data in the economic calender is released. You can look at follwong calender for economic events
Source code
###########
using System;
using System.Web;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using System.Threading;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.TasmaniaStandardTime, AccessRights = AccessRights.FullAccess)]
public class test00 : Robot
{
public bool showMessage = true;
#region Input Parameters
[Parameter("Event Hours (24HR format)", Group = "WebSite")]
public int EventHours { get; set; }
[Parameter("Event Mins", Group = "WebSite")]
public int EventMins { get; set; }
#endregion
protected override void OnStart()
{
var economicEventTime = DateTime.Now.Date.AddHours(EventHours).AddMinutes(EventMins);
ShowMessage("Now : " + DateTime.Now.ToString());
ShowMessage(economicEventTime.ToString());
if (DateTime.Now < economicEventTime)
Thread.Sleep((int)economicEventTime.Subtract(DateTime.Now).TotalMilliseconds);
var ExecutResult = ExecuteMarketOrder(TradeType.Sell, "AUDUSD", 5000, Guid.NewGuid().ToString(), null, 20);
}
protected override void OnException(Exception exception)
{
ShowMessage("OnException: " + exception.Message);
if ((exception.InnerException != null))
ShowMessage("OnException Inner: " + exception.InnerException.Message);
Environment.Exit(0);
}
protected override void OnError(Error error)
{
ShowMessage("Error :" + error.ToString());
ShowMessage("Error Code:" + error.Code.ToString());
Environment.Exit(0);
}
private void ShowMessage(string message)
{
if (showMessage)
Print(message);
}
}
}
@prasanthtp
prasanthtp
14 Mar 2023, 12:49
Any updates?
Hi . I have sent troubleshooting details via ctrader application as well. Any updates?
@prasanthtp
prasanthtp
10 Mar 2023, 15:39
( Updated at: 21 Dec 2023, 09:23 )
Hi
I am still getting this error. Please see my logs above
@prasanthtp
prasanthtp
09 Mar 2023, 02:02
( Updated at: 21 Dec 2023, 09:23 )
More info from debug System.Private.CoreLib
The exception is in System.Threading EventWaitHandle
@prasanthtp
prasanthtp
08 Mar 2023, 12:17
I just upgraded to 4.7. Now when I execute the cbot. It is the same process was unexpectedly terminated error . , I am getting a new error in windows event log.
Faulting application name: algohost.exe, version: 0.0.0.0, time stamp: 0x608e31d0
Faulting module name: System.Private.CoreLib.dll, version: 6.0.21.52210, time stamp: 0xf71d579
Exception code: 0xc00000f
Fault offset: 0x00000000001ab8c
Faulting process id: 0x0x250
Faulting application start time: 0x0x1D9519CD789C11
Faulting application path: C:\Users\prasa\AppData\Local\Spotware\cTrader\abb70432efbee65d18af69e79fe8efe1\app_4.6.4.13909\x64\algohost.ex
Faulting module path: C:\Users\prasa\AppData\Local\Spotware\dotnet\shared\Microsoft.NETCore.App\6.0.0\System.Private.CoreLib.dl
Report Id: 15e226f2-bfdd-49de-943d-11cd4ae6004
Faulting package full name
Faulting package-relative application I
D:5le801d3ication ID
@prasanthtp
prasanthtp
02 Mar 2023, 09:33
event viewer for this error
when i looked at the windows event viewer, i can see following error;
Faulting application name: algohost.exe, version: 0.0.0.0, time stamp: 0x608e31d0
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc00000fd
Fault offset: 0x00007ffeeb094046
Faulting process id: 0x0x8924
Faulting application start time: 0x0x1D94C923A5C41CE
Faulting application path: C:\Users\name\AppData\Local\Spotware\cTrader\abb70432efbee65d18af69e79fe8efe1\app_4.6.3.13401\x64\algohost.exe
Faulting module path: unknown
Report Id: 142abf5b-e77c-4a33-9eff-55cbbbcec870
Faulting package full name:
Faulting package-relative application ID:
Exception code: 0xc00000fd , I googled for it. it looks like a stack overflow error. any idea?
@prasanthtp
prasanthtp
11 May 2023, 01:16
Thanks. How do I get the time value of the current bar from this list.
Bars.OpenTimes is a list of datetime values . Is it Bars.OoenTimes[0]?
PanagiotisChar said:
@prasanthtp