Follow Us

Header Ad

Latest Posts

Categories

How to write algorithms for ATAS. Step-by-step instructions for beginners.


Then we edit the code how it is shown in the screenshot (2):

We write namespace ATAS.Indicators.Technical because we will create our own algorithm in the space of other technical ATAS indicators.

Then we add using ATAS.Indicators… You will always use this reference when creating algorithms for ATAS (in the next but one paragraph).

Then we edit public class Example1_1: IndicatorExample1_1 in this line means that we make the first example from the first lesson (you can write any other name, which will be then displayed in the ATAS indicator list).

As regards the colon and the word Indicator, they are quite important. This is how we state that the Indicator class (it is in the ATAS.Indicators.dll) is a parent class and our Example 1_1 class inherits everything, which is available in the parent class. It means that we get access to all functions, which are allowed to be inherited by the Indicator class inheritors – which include operations with prices, clusters, other indicator values, etc.

Then we write protected override void OnCalculate (int bar, decimal value) and two curly braces. This code section is called the OnCalculate method

In simple words, a method is a set of commands to the computer for execution. The OnCalculate method is declared as compulsory inside the parent. When you add your indicator to the chart, the platform will execute commands, which you write inside curly braces. If you do not have the OnCalculate method, Visual Studio will not allow you to build the code into a dll file, since it is compulsory to have it. Otherwise, ATAS will not understand what it has to execute.

If you did everything right, there will be No issues found (3) at the bottom. If errors are shown, try to understand what went wrong. What can go wrong:

  • C # is case sensitive. It means that uppercase and lowercase letters in the code are interpreted differently.
  • Curly braces, semicolons, quotation marks and other symbols – all of them are significant. In case you missed or lost something, Visual Studio will help you by giving suggestions.

Now, when you have the error-free code, let’s build it. To do it, select Build Lesson1 in the Build menu item (or press CTRL + B) and a message that the code was successfully built into a file should appear in the Output window.

Fidenge Pecold

My profession is a journalist, but my hobby for 8 years has been studying Forex investing and trading. During this time, I managed to gain extensive experience in investing and trading cryptocurrencies and double my capital in the Forex market. To be the author of this magazine, the site owners invited me to participate in one of the 2020 trading webinars, and I will try to reveal the most relevant crypto market news for you.

    Leave Your Comment

    Your email address will not be published.*

    Forgot Password