Topics
Load cBot parameters from file

completed Closed cTrader Automate

Suggestions
21 Jan 2014, 07:51
 19
 1178
 3
Optimization

completed Closed cTrader Automate

Suggestions
14 Jan 2014, 12:29
 273
 1965
 6
Replies

modarkat
05 Aug 2014, 14:41

You can pass decimal values to Bollinger Bands indicator:

Indicators.BollingerBands(MarketSeries.Close, 14, 1.5, MovingAverageType.Simple);

 


@modarkat

modarkat
05 Aug 2014, 14:41

You can pass decimal values to Bollinger Bands indicator:

Indicators.BollingerBands(MarketSeries.Close, 14, 1.5, MovingAverageType.Simple);

 


@modarkat

modarkat
17 Jul 2014, 09:44

here you go:

        int GetBarsAgo(Position position)
        {
            for (var i = MarketSeries.OpenTime.Count - 1; i >= 0; i--)
            {
                if (position.EntryTime > MarketSeries.OpenTime[i])
                    return MarketSeries.OpenTime.Count - 1 - i;
            }
            return -1;
        }

        protected override void OnTick()
        {
            var barsAgo = GetBarsAgo(position);

            if (barsAgo > 5)
            {
                ClosePosition(position);
            }
        }

 


@modarkat

modarkat
11 Jul 2014, 09:29

Here you go

/forum/cbot-support/2929


@modarkat

modarkat
10 Jun 2014, 12:21

RE: Extracting data from ctrader to cvs. file

czeslaw said:

Spotware said:

Yes, we plan to implement Visual Backtesting in the near future.

Hi I wonder how to extract file with historical data in order to write in cvs. file containing: date, time, maximum, minimum, open and close. Thank you for your support.

You can use this cBot:

/algos/cbots/show/495


@modarkat

modarkat
30 May 2014, 09:38

Calculating Volume based on fixed risk and stop loss

        private long GetVolume(double risk, int stopLossPips)
        {
            var moneyToInvestInDepositCurrency = Account.Balance * risk;
            var moneyToInvestInQuoteCurrency = moneyToInvestInDepositCurrency / (Symbol.PipValue / Symbol.PipSize);
            var volume = moneyToInvestInQuoteCurrency / (stopLossPips * Symbol.PipSize);
            var normalizedVolume = Symbol.NormalizeVolume(volume);

            return normalizedVolume;
        }

example of usage with risk 25% and SL 10 pips

            var risk = 0.25;
            var stopLossPips = 10;
            var volume = GetVolume(risk, stopLossPips);
            
            ExecuteMarketOrder(TradeType.Buy, Symbol, volume, null, stopLossPips, null);

 


@modarkat

modarkat
29 May 2014, 16:11

RE:

rkokerti said:

Dear Developers,

As you previously said "Even if trading is not possible platform can receive new prices which could produce new bar." OK I accept that, I do not understand why, but it's not important... 

Therefore, I need to open the half of the positions by manually. In this case very difficult to set the proper SL/TP levels and set the position sizing.

So, please help me to handle this problem with a sample code.

Thanks in advance!

 

You can try the following snippet

            while (true)
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, Symbol.VolumeMin);
                if (LastResult.IsSuccessful)
                {
                    break;
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }

 


@modarkat

modarkat
27 May 2014, 12:27 ( Updated at: 23 Jan 2024, 13:11 )

OnTimer event will be added in next version of cAlgo:

[/forum/cbot-support/2871?page=1]


@modarkat

modarkat
27 May 2014, 09:33

RE:

davidp13 said:

Any help will be appreciated!

Im looking for a CBOT that will automatically open a counter trade as soon as an original trade is opened. How would one go about that?

Thanks

/algos/cbots/show/475


@modarkat

modarkat
27 May 2014, 09:20

There are two ways to do that.

First of all you can convert moving average value to pips distance from a spot price.

Another way is to execute market order without TP and then modify TP as an absolute value.

            ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, label, StopLossPips, null);
            if (LastResult.IsSuccessful)
            {
                ModifyPosition(LastResult.Position, LastResult.Position.StopLoss, mAverage);
            }

 


@modarkat

modarkat
12 May 2014, 09:26

there is a layout not mentioned in the window called "Free Chart Mode". It's the third chart layout on on the toolbar. Using this layout you can move charts around, reorganise them and change their size and order


@modarkat

modarkat
02 May 2014, 17:52 ( Updated at: 23 Jan 2024, 13:14 )

You need to add indicator to the chart:

[]


@modarkat

modarkat
02 May 2014, 14:31

You can use News - DailyFx Economic Calendar indicator


@modarkat

modarkat
22 Apr 2014, 09:59

Yes, it is possible. Look at code of this indicator: News - DailyFx Economic Calendar.


@modarkat

modarkat
31 Mar 2014, 10:25

cAlgo.API.Color is equalent to System.Drawing.Color:

http://safeery2k.files.wordpress.com/2013/06/system-drawing-knowncolor.png


@modarkat

modarkat
29 Mar 2014, 21:53

instead of 

if (enableATR = true)

you need to write

if (enableATR == true)

 


@modarkat