Replies

PanagiotisCharalampous
08 May 2019, 17:08

Hi,

At the moment the formula to retrieve previous bars is the following

Backtesting start date - 100 * minutes in timeframe - 3 days

If your indicator needs more data than that, then you will have this issue. However we are looking into changing this behavior in the future.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 15:30

Hi ryan.a.blake,

The indicator code does not seemd complete. Can you please share the full indicator cBot and any code you might have written till now?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 15:13

Hi jitenlodhia,

Unfortunately we did not receive anything. If you can still reproduce the issue please contact us at community@spotware.com to arrange a teamviewer session.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 11:29

Yes that is right!


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 11:01

Try running the backesting in Visual Mode. It might help you understand it better.


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 10:53

Hi FireMyst,

-536 represents the difference between the equity at the moment the cBot stops execution (05/05/2019) and the starting balance (you still have an open position with unrealized P&L). The highlighted values show the balance and equity on the 26/04/2019.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 09:58

Hi FireMyst,

I had a look at the cBot. Please note that the chart does not show the equity at the moment that the backtesting finishes but the max equity reached since the moment the last position was closed (in this case 07/03). In other words, it says that since the 07/03 till the 20/04, the max equity reached 10400. The balance shows correclty and the ending equity is calculated based on the unrealized P&L of the remaining open positions.

Let me know if this clarifies things.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 09:43

Hi lec0456,

You already do it. There isn't a safe way to achieve this since the server can close the postion at any time and the information might need some time to propagate to you. During this gap, your code might have already passed the check and trying to close the position.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 May 2019, 09:32

Hi ryan.a.blake,

Can you explain to us what help do you need here?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 17:45

Hi nelson.pmf.sc,

Thanks for posting in our forum. See below

protected override void OnBar()
        {
            if (Positions.Count < 20)
            {
                var dailySeries = MarketData.GetSeries(TimeFrame.Daily);

                _MACD = Indicators.MacdCrossOver(dailySeries.Close, LongCycle, ShortCycle, MACDPeriod);

                if (_MACD.MACD.Last(1) < _MACD.Signal.Last(1) && _MACD.MACD.Last(0) > _MACD.Signal.Last(0) && _MACD.Signal.Last(0) < 0)
                {
                    ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "EUR/USD C", StopLoss, TakeProfit, 5);
                }

                if (_MACD.MACD.Last(1) > _MACD.Signal.Last(1) && _MACD.MACD.Last(0) < _MACD.Signal.Last(0) && _MACD.Signal.Last(0) > 0)
                {
                    ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "EUR/USD C", StopLoss, TakeProfit, 5);
                }
            }
        }

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 17:42

Hi Patrick,

There is no single line solution for this. In general, you should keep track of the orders sent and the responses received. If e.g. you have a max number of 50, 48 positions open and 2 orders in progress, for which a response has not beed received, them probably you will have 50 positions soon. In this case, you should not open any further positions. You could have a global counter for the orders in progress (static variable?) which will be increased just before sending the order and decreased after a TradeResult is received.

Let me know if the above helps

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 16:53

Hi nedjadala,

Can you please provide more information to reproduce the problem?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 15:32

Hi Patrick,

Positions property is updated after the order is successfully executed and the relevant message sent back to the application. If you execute trading in between, there is a change to send orders before Positions is updated. Therefore, if you need to be strict with the number of positions, you would need to implement more complicated checks to avoid this situation.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 10:37 ( Updated at: 21 Dec 2023, 09:21 )

Hi erisoftdevelop,

Print function for indicators works only for the Automate section. I tried the indicator and the rectangle seems to draw fine. See below

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 10:24 ( Updated at: 21 Dec 2023, 09:21 )

Hi trader.calgo,

After placing the files in the correct directory, the cBot seems to be working fine for me

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 May 2019, 10:10

Hi Matt,

I am not sure I understood the question but the way renko bars work is pretty standard. Bullish bars are created when price moves x pips above the previous high and bearish bars when price moves x pips below previous low.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 May 2019, 16:39

Hi FireMyst,

1) references all the other indicators I want used in the calculations

2) incorporate the bot's calculation logic

indeed this is the correct approach

There's currently no way then to draw objects on a chart that's not the main chart? Or is there?

There is but you need to manually add the area. See below an example 

  Chart.IndicatorAreas[0].DrawText("Test", "Test", Server.Time, 50, Color.Red);

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 May 2019, 12:58

Hi FireMyst,

The levels will appear when your indicator starts getting more values. At the moment it is zoomed at 0. e.g.

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Collections.Generic;

namespace cAlgo
{
    [Levels(2, 1, 0)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ConditionsOfEntry : Indicator
    {
        [Output("UpwardSell", LineStyle = LineStyle.Solid, PlotType = PlotType.Points, LineColor = "Red")]
        public IndicatorDataSeries UpwardSell { get; set; }
        [Output("UpwardNeutral", LineStyle = LineStyle.Solid, PlotType = PlotType.Points, LineColor = "Yellow")]
        public IndicatorDataSeries UpwardNeutral { get; set; }
        [Output("UpwardBuy", LineStyle = LineStyle.Solid, PlotType = PlotType.Points, LineColor = "Lime")]
        public IndicatorDataSeries UpwardBuy { get; set; }

        public int UpwardCount { get; set; }

        private const int UpwardMax = 5;

        public override void Calculate(int index)
        {
            //if (UpwardCount >= UpwardMax)
            UpwardBuy[index] = index % 10;
            //else if (UpwardCount > Math.Round(UpwardMax / 2.0, MidpointRounding.AwayFromZero))
            //    UpwardNeutral[index] = UpwardCount;
            //else
            //    UpwardSell[index] = UpwardCount;
        }

    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 May 2019, 12:49

Hi FireMyst,

1) We will fix the description.

2) It seems you are using new features included in 3.5 but compiling with 3.3. To solve this issue, close Spotware cTrader 3.5, go to C:\Users\UserName\Documents\cAlgo\API, delete all files in the folder and restart cTrader 3.5.

3) Deprecated fileds are not shown in Intellisence. If you want to use v3.3 of the API, repeat the process described in point 2 but with a 3.3 instance of cTrader.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 May 2019, 12:39

Hi reza h,

Technically speaking this is not flat.The indicator is both rising and falling at different times within the area.

Best Regards,

Panagiotis


@PanagiotisCharalampous