Replies

nordic
07 Oct 2018, 02:58

RE: RE:

tekASH said:

Thx. Can this also be used for moving averages? One MA crossing another MA?

Also, how about candle closing inside MA , after crossing it.

Tekash,

HasCrossedAbove and HasCrossedBelow will return a boolean true or false when it is called by comparing two dataseries, in this case the resulting dataseries from a primary and secondary indicator.  The function will only work with dataseries inputs.

For candles closing either side of an MA (ie, buy when a bull candle closes above and sell when a bear candle closes below), you'd want to build a function that determines the candle colour, determines where the open and close prices are, and executes when the closing price of the last candle is above or below the MA last value.  You'd also probably want to construct it such that it won't continue to open orders once an order is placed.

My advice would be to read up on the API as it's all pretty well documented, and hit up YouTube for all the C# coding how-tos if you're a beginner. There's a wealth of stuff out there to get you going.


@nordic

nordic
07 Oct 2018, 02:26 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

 

Range and Renko Bars
The platform introduces the Range and Renko bars with a step from 1 to 100 pips that are now available for time-independent volatility-based price charting.

Fantastic update, particularly the above - definitely going a long way to making cTrader a stronger product.  Just also confirming that backtesting for Range and Renko will be available when these updates hit brokers?

I realise we can currently implement indicators for these chart types, but native support makes things so much easier.

Great work guys!


@nordic

nordic
18 Sep 2018, 16:01

RE:

ClickAlgo said:

Hi Nordic,

Panagiotis is correct, if you compile with VS and the red asterisk on the cBot disappears then it is compiled, make sure you are looking at your errors tab in VS.

I compile using only VS on a regular basis for cBots, indicators and Add-Ons.

Paul.

Thanks guys, appreciate it (I was ignoring the VS errors tab).  I think I've found the culprit, which seems to be my insistence to use System.ValueTuple as a method return type.  Of course there are workarounds, but I've been trying to get this particular function to work as it simplifies the class library I'm building.

VS will happily build the below code with no errors in a project created from scratch, but not with a cBot launched out of cTrader (target framework set to 4.7.1):

private (double A, double B) TupleMethod()
        {
            return (2.1, 7.6);
        }

When I remove the implicit ValueTuple return type, VS builds the bot and it can be used as normal.  I think this may be a bug?

At any rate, thanks for the help and patience!


@nordic

nordic
17 Sep 2018, 03:45

RE:

ClickAlgo said:

When you build via Visual Studio, as long as you have the cBot extension it will create your cBot or indicator for you, there is no need to build from within the cTrader platform.

 

I must be missing something, then.  Using cTrader Public Beta 3.02, the only viable way to get cTrader to run any code in backtest is if it is compiled from within cTrader.  If I hit Edit in Visual Studio (using VS 2017 Community edition with extension installed), it can be edited and built in VS, and the code updates in the cTrader editor, but the changes won't run in backtest until I compile from the cTrader editor.

Does all this boil down to backtesting being incompatible with building from VS?  I wouldn't have thought so, but I'm at a bit of a loss.


@nordic

nordic
09 Sep 2018, 13:46 ( Updated at: 21 Dec 2023, 09:20 )

RE:

ClickAlgo said:

Hi Nordic,

Maybe I should have explained that the cTrader cBot assembly will run under .NET 4.0, but you can have many other separated assemblies running on any version of the framework as long as they are installed on the client machine.

If you are using just a single default cBot project then try changing the framework to 4.7, it is all backward compatible.

Paul.

Thanks Paul. At the risk of sounding daft, I've changed the .NET version of the solution (containing only 1 basic cBot project) to .NET4.7, and VS builds it without issue, but cTrader doesn't.

Attempting to build the code in cTrader throws the below compile errors (example of the basic tuple syntax included):

Am I not understanding something about this process?


@nordic

nordic
09 Sep 2018, 03:43 ( Updated at: 21 Dec 2023, 09:20 )

RE:

ClickAlgo said:

Hi GammaQuant,

If you want to use a different version of the .NET framework with your cTrader project you simply open the project using Visual Studio and open the project properties and shown below and change the target framework to another version. You will now be able to use all the features of the framework that relates to the framework in your project. You will also need to make sure your machine and any target machines will have this version of the framework installed.

cTrader runs on version 4.0, but your code can run on any version.

 

Paul Hayes
Sales & Marketing
Emailcontact@clickalgo.com
Phone: (44) 203 289 6573
Websitehttps://clickalgo.com

Twitter | Facebook | Google+ | YouTube | Pinterest | LinkedIn

 

Paul, could you please elaborate on this?  I've tried to use elements of .NET 4.7 (specifically System.ValueTuple installed via NuGet to enable me to return multiple values out of a method in better syntax), but cTrader won't compile the code.  I would have thought if the cTrader client is still running on .NET4.0 then it won't have compatibility for syntax and types not available by default in the language?

 


@nordic

nordic
04 Sep 2018, 15:46

Thanks Panagiotis, I hadn't tried the Beta in a while - and holy hell, visual backtesting is here, and it works wonderfully!  I had no idea.  Being able to cross-check with Visual mode made me realise this isn't a bug, just unclear notation on the chart.  The line on the chart begins on the X-axis where the initial entry was made, and when ModifyPosition kicks in, the line is offset to where the position volume was modified, but only on the Y axis.

Using standard backtesting it looks like a bug on the finished chart, but with Visual mode it's clear that what happens is in fact accurate.

By the way, my hat off to the team who built the Visual system. My only qualm is that it has no rewind ability during backtest, but it's a minor gripe as it seems to function very well, and much faster than previously.  This will give a huge extra dimension to algo development on cTrader. Love it.


@nordic

nordic
01 Sep 2018, 11:47 ( Updated at: 21 Dec 2023, 09:20 )

Example of the above issue:

Also, shouldn't ModifyPosition re-set the SL and TP values from the point the volume of the position is modified as it's essentially a new order?  The below seems to retain the original SL and TP values after the position is modified.


@nordic

nordic
11 Apr 2018, 17:12

RE:

Panagiotis Charalampous said:

Hi nordic,

Can you please refresh your chart and let me know if this still happens?

Best Regards,

Panagiotis

 

Had to restart the program, but after restart everything is back to normal.


@nordic

nordic
11 Apr 2018, 15:05 ( Updated at: 21 Dec 2023, 09:20 )

Looks like someone has taken a hacksaw to the chart but it appears to have gone back to the correct price.

There's no chance of this happening with a broker-provided cTrader 3.0 after release, is there?


@nordic

nordic
10 Apr 2018, 17:04 ( Updated at: 21 Dec 2023, 09:20 )

And another, zoomed out:

(it goes all the way up!)


@nordic

nordic
10 Apr 2018, 17:04 ( Updated at: 21 Dec 2023, 09:20 )

Hey Panagiotis,

Deal mapped chart below:


@nordic