
Topics
Replies
AlexanderRC
27 Aug 2014, 15:36
( Updated at: 21 Dec 2023, 09:20 )
Here is how my locale for non-Unicode (single byte string) programs is set. Visual Studio 2010 seems to pick it (cp1251) as a default when saving source files if non-ASCII characters are added first in Visual Studio.
Steps to reproduce.
- Create a new Indicator/cBot.
- Edit in Visual Studio.
- In Visual Studio, add some Russian characters is string literals. Here is a string for you to copy and paste: (Русский язык)
- Save the file in Visual Studio.
- Go back into cAlgo and observe the garbled characters.
The problem is that Visual Studio saves the file in cp1251 encoding if the file is pure ASCII (new Indicators/cBots are). If I add some Russian characters in cAlgo first and save, cAlgo saves it as UTF-8 without bytemark. If I later edit such a file in Visual Studio it properly detects the file as being UTF-8 (due to double byte character sequences of Russian characters) and saves it as such. The most unobtrusive fix would be to add Unicode bytemark at the beginning of the source file.
@AlexanderRC
AlexanderRC
26 Aug 2014, 23:09
Your computer is likely to be infected with a malware which modified Frontend.Controls.dll. Try to check the digital signature on it in file properties. But even if it is OK, malware may have some circumvention for displaying correct signatures. I have checked all of the copies of Frontend.Controls.dll from my ClickOnce application cache folder via VirusTotal and there are no single detection, Avast included.
@AlexanderRC
AlexanderRC
26 Aug 2014, 21:20
Do you have some security (antivirus) software that intercepts SSL/TLS connections? Try to temporary disable it and try again.
@AlexanderRC
AlexanderRC
18 Aug 2014, 15:16
RE:
Spotware said:
Also I have seen a situation that when viewing two identical 1-tick charts in two separate instances of cTrader, a tick was missing in one instance and present in another.
Tick chart shows all received ticks. Do you compare two instances of cTrader from the same broker?
Yes, cTrader was from the same broker and both instances were usung the same account. But that was observed around half a year ago. Unfortunately, I do not have a screenshot.
@AlexanderRC
AlexanderRC
16 Aug 2014, 01:43
( Updated at: 21 Dec 2023, 09:20 )
cTrader works under Wine. Sort of. Here is the screenshot.
Note that there are problems with bars.Some lines are not drawn. If I move the graphs back and forth, the bars are overdrawn without clearing the scrolled out content first and the graph becomes a mess. The popup windows (menus in menu bar, dropdowns) are very slow to appear.
Steps to reproduce this screenshot. I was using a virtual machine in VMware Workstation 10.0.3 for Linux. The host OS was Xubuntu 14.04(.1) LTS amd64.
- Install Xubuntu 14.04.1 x86 from iso into a vm. I allocated 2 CPU cores and 3GiB of memory.
- apt-get update && apt-get dist-upgrade -y
- apt-get install wine -y
- From winetricks install vcrun6, msxml6 and dotnet4. I am not sure if vcrun6 or msxml6 are required, I just kind of followed bellong's steps. Windows Installer was not required. I did not change windows version, it stayed at Windows XP.
- Then install cTrader from your broker using Open with "Wine Windows Program Loader" context menu item from GUI (or wine command from the shell). Obviously I used my own broker, Romanov Capital.
- Use find ~/.wine -iname ctrader.exe -print0 | xargs -0 wine command to run cTrader again.
I have not yet tested cAlgo.
At first I tried to use x64 version of Xubuntu for the virtual machine. msxml6 refused to install due to .wine directory being configured for x64. I deleted the .wine directory and recreated it with WINEARCH=WIN32 winecfg command for x86. msxml6 installed correctly. The next problem was in cTrader installer (.exe) that failed to parse machine.config from .Net installation directory with some obscure exception that XML was invalid and the inner exception was NotImplemented. After that I tried x86 version of Xubuntu and it worked with minimal steps
Next steps to try.
- Run installed cTrader/cAlgo under Mono. Mono's website states that WPF is not yet implemented, but some versions of Silverlight are. Silverlight is a subset of WPF and there is a rather small probability that required WPF functionaly for cTrader/cAlgo is covered.
- Run installer under Mono. The Mono's website states that ClickOnce APIs are not yet implemented, so this is likely to fail.
- Register handler for .appref-ms to run ClickOnce application from the GUI. On Windows it is registered as rundll32.exe dfshim.dll,ShOpenVerbShortcut %1|%2
- Try some graphical tweaks to get rid of the glitches and slowness. My vm was running with 3D acceleratoion off and that was a vm after all.
@AlexanderRC
AlexanderRC
15 Aug 2014, 19:00
RE: RE:
Spotware said:
AlexanderRC, have you manage to run cAlgo inside Wine?
No, but trying that is rather imminent on my to do list.
@AlexanderRC
AlexanderRC
06 Aug 2014, 23:31
What still does not work: even if the installer seem to do its job, in fact there is only a symlink dropped on the desktop for each prog, but not an exe ready to launch. Each time the 'installtion process have to be repeated. Not a big deal as its faster to use it that way compared to using virtualbox.
You can try to search cAlgo.exe inside Wine directory and run it directly. It should be somewhere in in the directory AppData/Local. ClickOnce applications like cTrader/cAlgo are installed (cached) there.
@AlexanderRC
AlexanderRC
14 Jul 2014, 17:09
RE:
Spotware said:
cAlgo API doesn't contain such methods. We plan to add them in the future.
Actually, ClosePosition[Async] has an argument to close a partial volume from position. So I can decrease the volume, but not increase...
@AlexanderRC
AlexanderRC
14 Jul 2014, 11:35
RE:
Next OnTimer invocation will be scheduled after current OnTimer invocation will be finished
Good to know that this behavior is by design. That may have fired back on me if it was not always the case.
I have employed similar approach with work item queue where actual work is happening in OnTimer() (and previously in tick/market data updates subscribed to all possible symbols to get into main thread as frequently as possible).
Too sad there are no immediate "jump" into the main thread. I have to wait for the next Timer tick to occur.
We plan to add method BeginInvokeOnMainThread in the future. It will simplify the above example.
It would be great if BeginInvokeOnMainThread() passes execution instantly to the main thread instead of waiting for the next Timer tick to occur.
@AlexanderRC
AlexanderRC
11 Jul 2014, 21:53
No, it will stop timer instead, otherwise it would mean smth like infinite calls of OnTimer method. In case you want to call OnTimer as soon as possible pass interval equal to one millisecond
Where does the one millisecond requirement come from? If OnTimer() handler takes more time than the Timer interval, will the handler be called second time simultaneously?
Are there any solution to pass "work objects" (Open/Close/Modify position) from arbitrary thread to "main" thread?
@AlexanderRC
AlexanderRC
11 Jul 2014, 16:41
RE:
AlexanderRC said:
2) Can I call Timer.Start with some "zero" value for the Timer to be invoked as soon as possible?
Timer.Start(new TimeSpan(1)) seems to be instant.
@AlexanderRC
AlexanderRC
26 May 2014, 11:59
I far as can tell, each robot runs in its own .Net application domain.
Here is a starting article to monitor memory usage per AppDomain.
http://msdn.microsoft.com/en-us/library/dd997285%28v=vs.110%29.aspx
@AlexanderRC
AlexanderRC
26 May 2014, 11:56
RE: RE:
Are there any chance that source code could be forever lost?
@AlexanderRC
AlexanderRC
24 May 2014, 12:00
RE:
Spotware said:
Market depth is provided by LP connected to the broker. Please contact your broker for additional information.
The fact that cTrader and cAlgo provide access to Level-II prices shows the transparency of our platforms.
In cTrader and cAlgo you can find detailed information about every deal including the Market Snapshot - the state of market depth at the moment of triggering.
When that snapshot is taken? When cServer sends request to LP or when acknowledgement from LP is received that the request has been executed?
@AlexanderRC
AlexanderRC
15 Apr 2014, 21:01
Any news for this feature?
This will greatly aid debugging if cBot is based on some indicator(s).
@AlexanderRC
AlexanderRC
14 Apr 2014, 13:11
RE: RE:
AimHigher said:
int iPosCnt = Positions.Count;would be considered reading since I am not changing or setting anything. However, I don't know what would happen if my timed event is executing this code at the same time as some code in OnTick() would trigger a change to the count e.g. by opening or closing a position.
That may still be unsafe. Positions is an interface, the actual implementation may crash if Count getter tries to read the positions collection for counting and in another thread that collection is modified when a new position just has been opened. I do not know the underlying implementation and assume the worst. The reality may be much better that Count is actually thread-safe.
What about
File.WriteAllText(PathToFile, StringToWrite); ?
Obviously this is not just reading but since it involves a file separate from anything internal to cAlgo, is it still unsafe?
WriteAllText() is a thread-safe method. Calling it from different threads should never crash. But I not sure about the written text, it may be garbled. I would guard it by some synchronization primitive.
@AlexanderRC
AlexanderRC
11 Apr 2014, 21:14
AimHigher, if your requirements allow it, I would do only reading in OnTimedEvent() and then postpone all the work until OnTick() or OnBar() happen. But even that does not bear any guaranties that reading is done on objects in "good" state. Even that reading may lead to a crash.
As another idea, to make OnTick() to be called more frequently I would "subscribe" to all possible Symbols by calling MarketData.GetSymbol() for all possible symbols your broker provides. I am yet to test this approach, though.
@AlexanderRC
AlexanderRC
11 Apr 2014, 15:15
RE: How catch last event
breakermind said:
Hi and thanks
how to capture last-position-event (like modify stoploss or takeprofit, open position, close position) when position was opened not from robot but manualy from calgo?
thx
You can vote for this feature.
@AlexanderRC
AlexanderRC
01 Apr 2014, 04:25
RE:
That code works as intended. I even modified it to open 3 distinct Buy orders in 3 consequtive OnBar() invocations. The positions are distinct both for netted and hedged demo accounts.
The problem with me thinking that position was merged was that the line for long running position was above or below on the backtesting chart. When I clicked on the Graph tab, i only saw one the line for one position (instead of several lines for several positions) because the local chart quotes around the clicked position did not cross the lines of other positions which were hidden as they were off chart due radically different open and close prices.
@AlexanderRC
AlexanderRC
27 Aug 2014, 15:43
Leading zeros are of some help but diagnostic messages from cTrader internals would go to the back or front of the list if sorted by message contents.
@AlexanderRC