Topics

Forum Topics not found

Replies

Invalid
06 Oct 2014, 09:14

RE:
public static DateTime UnixTimeStampToDateTime( int unixTimeStamp )
{
    // Unix timestamp is seconds past epoch
    var dateTime = new DateTime(1970,1,1,0,0,0,0,System.DateTimeKind.Utc);
    dateTime = dtDateTime.AddSeconds( unixTimeStamp ).ToLocalTime();
    return dateTime;
}

 

mijo212 said:

Hello,

how can i convert datetime(int) in format MT4 to datetime cTrader ?

thx Mijo.

 


@Invalid

Invalid
03 Oct 2014, 10:38

RE:

No, it's the same for both types

SkyAction said:

Should the   GUID change depending if it's an indicator or Robot ?

 


@Invalid

Invalid
23 Sep 2014, 09:17

RE:

emeeder said:

This for instance will not work:

Result[index] = (Server.Time - MarketSeries.OpenTime.Last(0));

is there a way that my result (in this case 00:00:40.8500000) can be converted to a number of 40.8500000 (seconds).

and also a number like 00:02:28.7800000 can be converted to a number 148.7800000 (seconds)

Thanks

 

TimeSpan has Property "TotalSeconds"

Result[index] = (Server.Time - MarketSeries.OpenTime.Last(0)).TotalSeconds; (as double). you can cast it to integer if you wish.

For more details take a look on MSDN


@Invalid

Invalid
19 Sep 2014, 15:35

RE:

Disable everything but "cBot and indicators" extension

SkyAction said:

If i disable extensions i will not be able to use the debugger ?

 


@Invalid

Invalid
19 Sep 2014, 15:12

RE:

Try to disable any extensions in VS and disable Avast. Reinstalling of VS probably won't help you much.  

SkyAction said:

I have Avast as an antivirus and not firewall except the windows default one.

No i don't have the possibility to run cAlgo and VS in a native Windows environment.

I can try to  install again VS


 

 


@Invalid

Invalid
19 Sep 2014, 14:56 ( Updated at: 23 Jan 2024, 13:16 )

RE: RE:

[SkyAction], Skip the first step. You won't be able to debug cBot if cAlgo extension will be turned off. 

Invalid said:

Try to 

  1. Run VS in safe mode. http://msdn.microsoft.com/en-us/library/ms241278.aspx. May be there some vs packages cause crash.
  2. Do you have any firewalls/antiviruses on your VM?
  3. Do you have possibility to run VS with cAlgo not on VM? 

On my machine (not VM) VS debugging works without any problem.

 

SkyAction said:

Here is the log :

 

Faulting application name: cAlgo.exe, version: 1.24.102.34376, time stamp: 0x53ff554e
Faulting module name: KERNELBASE.dll, version: 6.3.9600.17031, time stamp: 0x53089862
Exception code: 0xe0434352
Fault offset: 0x00000000000068d8
Faulting process ID: 0xf84
Faulting application start time: 0x01cfd3fbe8f2ed79
Faulting application path: C:\Users\maxlecomte\AppData\Local\Apps\2.0\OR06CH8O.Z5Q\02C56W4M.ZJH\icma..algo_2b1d787f64b7eb41_0001.0018_f6394ded2663d741\cAlgo.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report ID: 8aed77de-3fef-11e4-8254-001c42c842e4
Faulting package full name:
Faulting package-relative application ID:

 

And the XML if you like:

- 
- 
   
  1000 
  2 
  100 
  0x80000000000000 
   
  4583 
  Application 
  MAXIMELECOM3CB6 
   
  
- 
  cAlgo.exe 
  1.24.102.34376 
  53ff554e 
  KERNELBASE.dll 
  6.3.9600.17031 
  53089862 
  e0434352 
  00000000000068d8 
  f84 
  01cfd3fbe8f2ed79 
  C:\Users\maxlecomte\AppData\Local\Apps\2.0\OR06CH8O.Z5Q\02C56W4M.ZJH\icma..algo_2b1d787f64b7eb41_0001.0018_f6394ded2663d741\cAlgo.exe 
  C:\Windows\system32\KERNELBASE.dll 
  8aed77de-3fef-11e4-8254-001c42c842e4 
   
   
  
  

 

 

 


@Invalid

Invalid
19 Sep 2014, 14:53

RE:

Try to 

  1. Run VS in safe mode. http://msdn.microsoft.com/en-us/library/ms241278.aspx. May be there some vs packages cause crash.
  2. Do you have any firewalls/antiviruses on your VM?
  3. Do you have possibility to run VS with cAlgo not on VM? 

On my machine (not VM) VS debugging works without any problem.

 

SkyAction said:

Here is the log :

 

Faulting application name: cAlgo.exe, version: 1.24.102.34376, time stamp: 0x53ff554e
Faulting module name: KERNELBASE.dll, version: 6.3.9600.17031, time stamp: 0x53089862
Exception code: 0xe0434352
Fault offset: 0x00000000000068d8
Faulting process ID: 0xf84
Faulting application start time: 0x01cfd3fbe8f2ed79
Faulting application path: C:\Users\maxlecomte\AppData\Local\Apps\2.0\OR06CH8O.Z5Q\02C56W4M.ZJH\icma..algo_2b1d787f64b7eb41_0001.0018_f6394ded2663d741\cAlgo.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report ID: 8aed77de-3fef-11e4-8254-001c42c842e4
Faulting package full name:
Faulting package-relative application ID:

 

And the XML if you like:

- 
- 
   
  1000 
  2 
  100 
  0x80000000000000 
   
  4583 
  Application 
  MAXIMELECOM3CB6 
   
  
- 
  cAlgo.exe 
  1.24.102.34376 
  53ff554e 
  KERNELBASE.dll 
  6.3.9600.17031 
  53089862 
  e0434352 
  00000000000068d8 
  f84 
  01cfd3fbe8f2ed79 
  C:\Users\maxlecomte\AppData\Local\Apps\2.0\OR06CH8O.Z5Q\02C56W4M.ZJH\icma..algo_2b1d787f64b7eb41_0001.0018_f6394ded2663d741\cAlgo.exe 
  C:\Windows\system32\KERNELBASE.dll 
  8aed77de-3fef-11e4-8254-001c42c842e4 
   
   
  
  

 

 


@Invalid

Invalid
19 Sep 2014, 12:54

RE:

Probably it doesn't work well on VM. 

Could you get any errors from Events log?

SkyAction said:

Hi,

The cAlgo platform is crashing when i attach the Visual Studio debugger to it.

It crash directly without having the time to launch the Robot.

I Tried multiple times with always the same issue.

 

I'm using Visual Studio Professional 2013 in a virtual Machine (Parallels) on a Mac.

The OS is Windows 8.1

 

Thanks in advance for your help.

 

Regards,

 

Sky.

 


@Invalid

Invalid
16 Sep 2014, 16:57

Try to debug it in VS. In this case VS will show you the line and variable which caused this error.


@Invalid

Invalid
12 Sep 2014, 10:11

Download the zip file again, extract it.

Open cAlgoBot-Build-36873\Build-36873\Solution-calgobots-36873\cAlgoBots.sln in Visual Studio. You have to see several projects in your solution. And one of them will be PayBack II.


@Invalid

Invalid
11 Sep 2014, 15:07

RE: RE: RE:

you need to add a reference to a project (not a library). Take a look here.

 

Forex19 said:

I followed your suggestion: 

  - Remove "using cAlgo.Lib;" 
  - Right click on the mouse and select Add Reference, but when I select the folder of the file "cAlgo.Lib.csproj" doesn't see it so I can't add it. 

I misunderstood and mistaken something?

Invalid said:

Just opened the solution and it works.

Most probably your project has invalid reference path. Remove cAlgo.Lib from reference list in your project and  add reference to project ..\Solution-calgobots-36873\Sources\Library\cAlgoLib\cAlgo.Lib.csproj

Forex19 said:

Hi,
I wanted to test some cBots (for example PayBack II) but during the compilation by me:

Error CS0234: The type or namespace name 'Lib' does not exist in the namespace 'cAlgo' (are you missing an assembly reference?)

with reference to "using cAlgo.Lib."

In the page: 

https://calgobots.codeplex.com/

I found the cAlgobots Sources and binary Build 36873 that contains the folder cAlgo.Lib end file cAlgo.Lib.csproj.
I made some attempts to include files that I thought was missing but I could not solve.

How can I fix? Thanks. 

 

 

 


@Invalid

Invalid
11 Sep 2014, 12:53

RE:

Just opened the solution and it works.

Most probably your project has invalid reference path. Remove cAlgo.Lib from reference list in your project and  add reference to project ..\Solution-calgobots-36873\Sources\Library\cAlgoLib\cAlgo.Lib.csproj

Forex19 said:

Hi,
I wanted to test some cBots (for example PayBack II) but during the compilation by me:

Error CS0234: The type or namespace name 'Lib' does not exist in the namespace 'cAlgo' (are you missing an assembly reference?)

with reference to "using cAlgo.Lib."

In the page: 

https://calgobots.codeplex.com/

I found the cAlgobots Sources and binary Build 36873 that contains the folder cAlgo.Lib end file cAlgo.Lib.csproj.
I made some attempts to include files that I thought was missing but I could not solve.

How can I fix? Thanks. 

 


@Invalid

Invalid
09 Sep 2014, 09:19

RE:

Print position.Label before if block. What will you get?

 

 

obial said:

Dear Support

As I cannot find a way to know if the last of my orders closed in TP, I'm trying to limit  the number of positions via using the the Label.

I put the following into my cbot , but the problem is that it looks like the LabelOK bool, never comes true !!.

Can you please explain what is the default value for Label in positions and if the label documentation is correct.

 

                    bool LabelOK = false;
                    string TargetLabel = "NewOrderTargetLable";
                    if (position.Label == null || position.Label == Strategy1 + "1" || position.Label == Strategy1 + "2" || position.Label == Strategy1 + "3")
                    {
                        LabelOK = true;
                        if (position.Label == null)
                            TargetLabel = Strategy1 + "1";
                        if (position.Label == Strategy1 + "1")
                            TargetLabel = Strategy1 + "2";
                        if (position.Label == Strategy1 + "3")
                            TargetLabel = Strategy1 + "3";
                    }

 

Regards
Oltion bregu

 


@Invalid

Invalid
09 Sep 2014, 09:07

RE: RE:

Have you tried this http://2calgo.com/?


@Invalid

Invalid
08 Sep 2014, 09:24

RE: RE:

Take a look at logs in Backtesting tab. It should mention detected time zone. If the csv file was generated from UTC-5 time zone bars, than it should detect also UTC-5. 

cbellew said:

I'm sorry there is a small mistake with my post. Where I said...

"I have to set my timezone to UTC+5 in cAlgo"

...I meant to say...

"I have to set my timezone to UTC-5 in cAlgo"

 


@Invalid

Invalid
04 Sep 2014, 14:13

RE:

 

PlaceStopOrder(TradeType.Buy,  MarketData.GetSymbol(position.SymbolCode) TargetVolume, buyOrderTargetPrice, Strategy1, TargetSLSS, position.EntryPrice, expirationTime, Strategy1);

 

obial said:

Dear Support

 

I'd like to reuse the position.SymbolCode as the "Symbol" for a pending order placement, but I always get an error:

Error CS1503: Argument 2: cannot convert from 'string' to 'cAlgo.API.Internals.Symbol'

 

PlaceStopOrder(TradeType.Buy, position.SymbolCode, TargetVolume, buyOrderTargetPrice, Strategy1, TargetSLSS, position.EntryPrice, expirationTime, Strategy1);

 

Regards

 

 


@Invalid

Invalid
02 Sep 2014, 17:28 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

What is TF?

avionforex said:

Spotware said:

  1. Move your mouse over the Position line.
  2. Click and drag the Stop Loss or Take Profit to the rate you want.
  3. You will receive a confirmation of your order changes in the top right of your screen.

It's totally different. See image

To scalper is not easy as you have configured your. 
It is very comfortable to operate in this way. it's just a suggestion.

 


@Invalid

Invalid
25 Aug 2014, 11:57

RE:

English version would be preferable

saralin said:

先謝謝能夠幫助我

能不能在orders 加一個鍵是選擇的貨幣  , 現在只有一個鍵是 Cancel All,  能不能再加一個鍵是 cancel chose?

 

 


@Invalid

Invalid
25 Aug 2014, 10:59

RE:

Hi mijo212.

Yes, you can specify it using TimeSpan

Timer.Start(TimeSpan.FromMilliseconds(111));

mijo212 said:

Hello,

it is possible to calculate the indicator less than < 1 second ? in milliseconds.

protected override void Initialize(){ Timer.Start(1);}

protected override void OnTimer(){}

 


@Invalid

Invalid
30 Jul 2014, 09:34

RE: RE:
protected override void OnTick()
{
    using (var writer = File.CreateText(filePath))
    {
         //....
    }
}

File.CreateText doesn't append to existing file, it overrides existing one if it exists. Therefore on each tick you have only last record in the file. You can try File.AppendText in order to update file on each tick.

neverman said:

Spotware said:

5. Of cource for observation needs, I need a code that places datas every tick in CSV file like ask(bid) quotes, server time (hour,minute, second, millisecond), connection speed to the server, current order (type (buy,sell),SL, TP, volume, magicnumber)

You can find an example of writing to a CSV file there: /algos/cbots/show/495. You will need to put your to code to the OnTick handler. You can retrieve prices from Symbol.Ask and Symbol.Bid properties. Server.Time property has DateTime value which stores hour, minute, second and millisecond. Connection speed is not available in the API. There is no current order entity in our API. You can enumerate all Positions with foreach instruction. All position properties are presented there: /api/reference/position.

I can't handle this :(

I'm trying to save data every tick Ask and Bid together with Data and HH:MM:SS.mmm in CSV file. The problem is that the code saves me only last data. Please tell me where I'm wrong.

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class DumpToCSV: Robot
    {

        protected override void OnTick()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            var folderPath = Path.Combine(desktopFolder, "cTraderData");
            Directory.CreateDirectory(folderPath);
            var filePath = Path.Combine(folderPath, Symbol.Code + "-" + Server.Time.Day + "-" + Server.Time.Month + "-" + Server.Time.Year + ".csv");

            using (var writer = File.CreateText(filePath))
            {

                writer.WriteLine(ConcatWithComma(Server.Time.Date, Server.Time.TimeOfDay, " ", Symbol.Ask, Symbol.Bid));

            }//using
        }//onTick

    }//DumpCSV
}//cAlgo

Aslo, I can't put on the first row label of colomns and can't add properly mileseconds to the HH:MM:SS.mmm ...

Also any ideas how to put working directory different than Desktop (maybe without granting full access rights ?). Thanks in advance

Help me please

 


@Invalid