Topics
05 Dec 2014, 00:00
 2644
 1
Replies

admin
19 Oct 2012, 11:33

Yes, it is possible to interface custom dll's (add reference).

At the moment access to .NET libraries is limited to a certain subset. An update is comming soon that enables accessibility to other libraries.

 


@admin

admin
19 Oct 2012, 11:19

RE:
banbeng said:

how I do to give the strategy to other persons without the source code?

 

I have to give that file " .Algo"? (and works it correctly?)  

 

----

example, I created a program.

I want to try this program to other

 

which file I have to share?

(without others read my code)

in other platforms enough  give other people only the compiled file

 

 

thanks

At the moment you have to share the source code. Soon we will implement the ability to share only the algo file.
Stay tuned!
 
 
 
 

@admin

admin
18 Oct 2012, 14:15

RE: RE:
banbeng said:
thanks both for  response that for advice on the code

Robot class creates conflicts when
call objects in my main?

I can then use the robot class to class without any problems?
I thought it was unique ability of the main class.
I'm not sure what you mean. It seems like a c# question. If so, please visit msdn http://msdn.microsoft.com/en-us/default.aspxOtherwise, please clarify.
 
Regards.
 
 
 

@admin

admin
17 Oct 2012, 17:12

We have this in our future plans. It will be available soon. Stay tuned!

 


@admin

admin
17 Oct 2012, 12:23

Yes, you need to add reference and locate your dll and include it.

 


@admin

admin
17 Oct 2012, 12:22

If you are going to use namespace cAlgo.Robot

Then you need to define your class as Robot

i.e.

    [Robot]
    public class Tool:Robot

 

Other than that I see a few issues with the code but no syntax error, like norm is a local variable being assigned but not used.

So the code starting from if(dir == -1) ... (until right before) return ln;

is essentially useless.

Also note that ln-1*pipsize is equal to ln-pipsize as well as ln+1* pipsize is equal to ln+pipsize

I presume that what you need is  (ln-1)*pipsize and (ln+1)* pipsize


@admin

admin
16 Oct 2012, 14:17

RE:
scalptastic said:

hi guys; just had a chance to demo the cTrader platform. it is great; and user friendly.


is there an API to connect to cAlgo or cTrader from external apps; such as Java or C++?

i have a legacy algo app that I need to keep running for the moment; while exploring the new platform.

 

thanks.

 

This is beyond our scope at the moment but you may implement such functionality with cAlgo using the System.NET namespace.
 


@admin

admin
16 Oct 2012, 10:16

RE: RE:
banbeng said:
admin said:

Hello,

 

In cAlgo you need to define each class in a separate file. Then you need to reference that file in the class which you want to use it. The filenames should be the same as the classes defined in them, i.e. class Imperial should be saved in filename Imperial.cs

e.g. 

//#reference: ..\Robots\Opertation.algo

using cAlgo.API;

namespace cAlgo.Robots
{
    public class Imperial : Robot
    {
        private Opertation robot;

        // etc.

    }
}

 

 

 

I placed the code
creating two new classes
which I compiled
and called up
 
/ / # reference: .. \ Robots \ HD.algo
/ / # reference: .. \ Robots \ Tool.algo
 
but one of them gave me a problem in compiling:
 
build succeeded
Unable to load assembly: assembly must contain single algo type
 
 
Is it possible to post the code for the one with the problem?
 

@admin

admin
15 Oct 2012, 16:44

See thread /forum/cbot-support/73

 


@admin

admin
15 Oct 2012, 16:43 ( Updated at: 23 Jan 2024, 13:11 )

Hello,

 

In order to learn how to code in cAlgo you should start by visiting the Documentation page of the API Reference here: [/docs/reference/calgo/api]

 

The cAlgo API is based on the c# programming language so you may want to do some reading on the c# programming language as well, in case you are not familiar with it.

You can find samples here: /forum/calgo-reference-samples, the sample Robots and Indicators that ship with cAlgo, as well as find answers to general questions of other users throughout the forum.

As always, you can ask questions on the forum for whatever it is that you need help with while coding your robots.

 

 

 


@admin

admin
15 Oct 2012, 15:40

This code 

int lastIndex = slowMa.Result.Count - 1;

corresponds to the index of the last bar.  Therefore, at runtime, weather backtesting or real time, the last bar would not have completed and the values, high,low close, as well as indicator values that depend on those would not be final. The only final value is the open price and open time. But the rest will keep changing until the bar completes and a new bar starts which triggers a new OnBar event, which brings us to another subject. When comparing indicator values such as the code above, it is best to use the OnBar event rather than the OnTick event. Since using the OnTick event will trigger far more Trades than the OnBar resulting in probably more loss due to commissions taken.

So, you need to use the previous to the last candle compared to the one before the previous.

i.e. 

int lastIndex = slowMa.Result.Count - 2;

int prevIndex = slowMa.Result.Count - 3;

 


@admin

admin
15 Oct 2012, 12:16

Thank you for the suggestion.  Indeed, a very good feature.  

We will include it very soon. Stay tuned!

 

 


@admin

admin
15 Oct 2012, 11:44 ( Updated at: 23 Jan 2024, 13:11 )

RE:
odomike said:

If its possible to include the ability to place LIMIT orders too (Say you use PipsawaySTOP for gap from current price for pending STOP orders and PipsawayLIMIT for gap from current price for pending LIMIT orders ), that will be super fantastic.

This will really make lives easier for lots of us new traders.

 

Thank you in advance.

Michael.

Hello Michael,
 
Is this question in reference to the first, about the robot? If not, please add a new thread and clarify a bit, so that we can better assist you.
 
You can place Limit orders in cAlgo
Definition:
CreateBuyLimitOrder(Symbol symbol,int volume,double targetPrice,double? stopLoss,double? takeProfit,DateTime? expiration)

Trade.CreateBuyLimitOrder(Symbol,10000,Symbol.Bid-Symbol.PipSize,null,null,null)
Read more: [/docs/reference/calgo/api/internals/itrade/createbuylimitorder]
 
 
PipsawaySTOP is a bit ambiguous.
 
 
Regards
 

@admin

admin
15 Oct 2012, 10:42

The entry price cannot be modified. You need to delete it and create a new one.

 

            foreach (var pendingOrder in Account.PendingOrders)
            {
                if(pendingOrder.SymbolCode == Symbol.Code && pendingOrder.TradeType == TradeType.Buy)
                {
                    Trade.DeletePendingOrder(pendingOrder);

                    Trade.CreateBuyLimitOrder(Symbol, Volume, price,  TakeProfit, StopLoss, expiration);
                }
            }


 

 

If the class is not of type Robot/Indicator then the intellisence will not produce the Account, Symbol or other internal class types.

 

 


@admin

admin
15 Oct 2012, 10:34

Hello,

 

After exhaustive testing of the cAlgo platform backtesting feature, we concluded that the accuracy is more than 90%.
If you have any suggestions please post them on our suggestions section of the forum /forum/suggestions

 

 

Regards

 

 

 

 


@admin

admin
15 Oct 2012, 09:57

Hello,

 

In cAlgo you need to define each class in a separate file. Then you need to reference that file in the class which you want to use it. The filenames should be the same as the classes defined in them, i.e. class Imperial should be saved in filename Imperial.cs

e.g. 

//#reference: ..\Robots\Opertation.algo

using cAlgo.API;

namespace cAlgo.Robots
{
    public class Imperial : Robot
    {
        private Opertation robot;

        // etc.

    }
}

 

 

 


@admin

admin
12 Oct 2012, 16:04

Hello,

 

We will include this option in the future. Stay tuned!

 


@admin

admin
12 Oct 2012, 10:26

Hello,

 

This is a simple robot that opens a position and then sets stop loss and take profit: /forum/calgo-reference-samples/69

To learn how to set the stop loss you may look at the reference guide: /docs/reference/calgo/api/internals/itrade/modifyposition

Also, you can look at the sample robots that are included in cAlgo, namely, SampleMartingaleRobot,  SampleBuyTrailing, SampleSellTrailing, SampleSARTrailingStop

 

 

 


@admin

admin
12 Oct 2012, 10:25

Simple Robot to open a position and modify to set stop loss and take profit.

// -------------------------------------------------------------------------------------------------
//
//    This cBot is an example of executing a market order setting stop loss and take profit
//
// -------------------------------------------------------------------------------------------------

using cAlgo.API;

namespace cAlgo.Robots
{
[Robot]
    public class SimpleRobot : Robot
    {
        [Parameter("Volume", DefaultValue = 10000, MinValue = 0)]
        public int Volume { get; set; }
 
        [Parameter("Stop Loss", DefaultValue = 40)]
        public int StopLoss { get; set; }
 
        [Parameter("Take Profit", DefaultValue = 40)]
        public int TakeProfit { get; set; }
 
        protected override void OnStart()
        {
            var result = ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "My Label", StopLoss, TakeProfit);
            if(!result.IsSuccessful)
            {
                Print("Stoping cBot due to failure to execute market order");
                Stop();
            }
        }
        
        //...

    }
}

 


@admin

admin
12 Oct 2012, 09:59

Hello,

 

Currently there is only spot forex data. There will be support of custom user data in the application in the future. Stay tuned!

 


@admin