Replies

BeardPower
28 Feb 2018, 15:07

Finally, it happens!

Let's hope, v3.01 is coming these days as well.

Thank you!


@BeardPower

BeardPower
28 Feb 2018, 15:04

It will be in cTrader 3.x

The Beta is already released so that you can try it out.


@BeardPower

BeardPower
28 Feb 2018, 14:04 ( Updated at: 21 Dec 2023, 09:20 )

Click on the top icon (the three horizontal lines), to expand/collapse the panel. That's all you can do.


@BeardPower

BeardPower
27 Feb 2018, 14:25

cTrader 3.0 Beta

They just released cTrader 3.0 Beta. So Renko and Range bars should be imminent for a release. That's what I hope ;-)


@BeardPower

BeardPower
24 Jan 2018, 15:48

Let's just hope, cTrader 3.0 is released in Q1.


@BeardPower

BeardPower
08 Jan 2018, 14:43

RE:

irmscher9 said:

Hey guys. 

Anyone can share the easiest way to get a value of the variable from the previous period?

For which variable? OHLC values?
E.g., for highs:

MarketSeries.High[index - 1]

 


@BeardPower

BeardPower
18 Dec 2017, 17:19

RE:

Panagiotis Charalampous said:

Hi BeardPower, 

We are currently designing Open API v2.0. Not all decisions have been made yet, therefore I reserve myself to answer your questions at a later stage. However the community's feedback will be taken into consideration seriously during design and development.

Best Regards,

Panagiotis

Hi Panagiotis,

I'm looking forward to your decisions.
API and protocol fragmentation is already a big issue in the financial industry, so both, clients and providers, will benefit from agreeing on a free and open standard. I think you agree with me when I'm saying, that FIX/FAST being a headache, as it's called a standard, but every provider is doing his own style.

Thanks for considerating it!

 

 


@BeardPower

BeardPower
22 Nov 2017, 21:55

RE:

Sorry, it was only one issue, but the forum does not support the editing of posts.


@BeardPower

BeardPower
22 Nov 2017, 21:53

The Problem Seems to be that its not running through the entire nested if statement, it runs through one or two, but doesnt read all of them

it enters positions it shouldnt because one conditin was true but the others werent for some reason

It does, but you have two issues in your code.

enter if price has crossed above cloud and tenkansen > kijun sen and chikou > kumo)

TenkanSen should be > than KijunSen, not the other way round.

if (ichimoku.KijunSen.LastValue > ichimoku.TenkanSen.LastValue)

The correct code is:

if (MarketSeries.Close.HasCrossedAbove(ichimoku.SenkouSpanA.LastValue, 10))
            {
                if (MarketSeries.Close.HasCrossedAbove(ichimoku.SenkouSpanB.LastValue, 10))
                {
                    if (ichimoku.TenkanSen.LastValue > ichimoku.KijunSen.LastValue)
                    {
                        if (ichimoku.ChikouSpan.LastValue > ichimoku.SenkouSpanA.LastValue && ichimoku.ChikouSpan.LastValue > ichimoku.SenkouSpanB.LastValue)
                        {
                            Open(TradeType.Buy);
                        }
                    }
                }
            }


 

 

 


@BeardPower

BeardPower
21 Nov 2017, 14:06

RE:

Panagiotis Charalampous said:

This is not always the case. Let's suppose you are running a backtest on EURGBP using USD account. Profit from GBP needs to be converted to USD. The way that is implemented now is that we take quote for GBPUSD from last backtest date and use it along whole backtesting. We do not make the conversion using the GBPUSD at each given moment since we will need to also download the tick data for that pair as well. So now for convenience we just take an indicative conversion rate and use it all along. 

So it is not always the case, not because there is no conversion rate at any point in time, but because you are just not using it (not downloading it).
I was a little confused by your previous statement. There's a big difference in not using something, although its there to not using it because it doesn't exist :)

However it seems that the current behavior causes confusion, therefore we are planning to change this behaviour.

Thanks. This behavior needs to be addressed by Spotware. It's not only confusing, but it also renders backtesting meaningless, as it does not show the user the real outcome. There isn't even the used conversion rate noted anywhere on the chart or the log.


@BeardPower

BeardPower
20 Nov 2017, 16:01

RE:

Panagiotis Charalampous said:

It has been implemented this way to facilitate the need to convert the profit to any currency account, for which the conversion rate is not available for every single point in time.

How comes? Just use the most recent quote for any point in time. Regardless of the aggregation type (ticks or time periods), there is always a most recent quote,

In a nutshell your calculations are correct, it is just the fact that cAlgo uses a different formula to calculate P&L and might lead to these small discrepancies.

On the contrary. The discrepancies can be huge! A discrepancy of 2% is all but small.
As seen here:
/forum/cbot-support/12146?page=2#18
 


@BeardPower

BeardPower
20 Nov 2017, 15:49

RE: RE: RE:

Ah, the forum definitely needs an edit functionality!

var askvolume = (Account.Balance * ENTRYPRICE * Risk ) / CalculateStopLoss() * 10000;

 


@BeardPower

BeardPower
20 Nov 2017, 15:48

RE: RE:
var askvolume = (Account.Balance * ENTRYPRICE * Risk ) / CalculateStopLoss() * 10000 ;

 


@BeardPower

BeardPower
20 Nov 2017, 15:47

RE:

aronbara664 said:

Hi!

So I guess the final formula should look something like this:

 

            var askvolume = (Account.Balance * Risk) / CalculateStopLoss() * 10000 * ENTRYPRICE;

 

Right?

Correct.

 


@BeardPower

BeardPower
20 Nov 2017, 14:09

RE:

aronbara664 said:

Hey there!

Alright, first things first -- I rewrote my volume calculation formula to this:

 

            var askvolume = Account.Balance * Risk / CalculateStopLoss() * 10000;

As your account is in EUR, you would have to multiply the term by the entry price.

Your calculations are all correct, the issue with the profit calculation is a cTrader issue. It seems that it's using the price at the end of the testing period. Calculate it with these prices and you will see, that the profit is nearly correct:

01.11.2011: 18000 * 0.0112 / 1.3696 = 147.20
15.01.2013: 18000 * 0.0112 / 1.3304 = 151.53

I took the prices from here:
https://www.investing.com/currencies/eur-usd-historical-data

You should report this issue to Spotware!

 

 


@BeardPower

BeardPower
18 Nov 2017, 23:14

RE:

aronbara664 said:

Alright so we recreated our volume calculation to this, as laid out in the API reference:

 

            var juro = ((Account.Balance * Risk) / CalculateStopLoss()) / Symbol.PipValue;

This calculation would only be correct if your account currency is USD, which is assumed by the API reference.

As expected, the TP/SL changes if we change the timeframe, which makes little sense.

Are you testing based on ticks? When you are talking about the timeframe, are you talking about the testing period?
The TP/SL does not change, only the volume, which is very weird. In both screenshots, there is the same entry price and the same close price, so why is the volume 0.19 Lots in the first screenshot, but 0,23 Lots in the second? The difference in volume would only happen if open and close are different in CalculateStopLoss(). Can you please also print these values?
Both values should be the same, regardless of the testing period.


@BeardPower

BeardPower
18 Nov 2017, 17:46

Is your Account in EUR?

cTrader is using the account currency for volume, so you don't multiply it with the quote currency:

var askvolume = Account.Balance * Risk * Symbol.Ask / CalculateStopLoss * 10000;

It would only be:

var askvolume = Account.Balance * Risk  / CalculateStopLoss() * 10000;

But even then, the numbers don't match up:
35000 * 1.40628 * 0.008 / 1.41428 = EUR 278.42 profit

 

 


@BeardPower

BeardPower
18 Nov 2017, 17:30

Hi,

It seems it's a cTrader issue.
cTrader is not using the closing price of EUR/USD, as it should.

E.g., trade number 1:
It made a profit of 80 pips ((1.41428 - 1.40628) * 10000), which matches two times the SL (2 * 40), as specified in your code.
The profit in EUR would be the volume * TP (in ticks) * 1 / EUR/USD: EUR 197.98 (35000 * 0.00800 * 1 / 1.41428), but it shows a wrong value of EUR 240.22

Try to calculate it by the actual EUR/USD price on your platform at the time of your backtest. If I use the actual price on my chart (1.17943), your profit would be:
35000 * 0.008 / 1.17943 = EUR 237.40, which is more closer to your result. The EUR/USD used in the calculation was 240.22 / 200 = 1.2011. None of these numbers are matching up.

There must be some issue with calculating the profit.


@BeardPower

BeardPower
17 Nov 2017, 17:44

You can just do:

return Math.Abs(candleClose3 - candleOpen3);

to get the absolute value, which is always positive.

Print out the returned value of each trade, post them and also post the stop loss and entry price of your trades so that they can be compared.

 


@BeardPower

BeardPower
17 Nov 2017, 16:34

Post more details

Hi,

Please post more details:

  • price value of the SL order, so the SL in ticks can be calculated
  • SL in ticks, which was calculated by CalculateStopLoss

Check, if both were the same.


@BeardPower