Designer - create a strategy based on MACD. Start with simple.

Designer - create a strategy based on MACD. Start with simple.
Atom
06.05.2019
Marat


Creating a strategy in the Designer program.

Let’s discuss an example of creating a trading strategy in a program based on the MACD indicator values.
The indicator’s goal is as follows:

1. If the MACD indicator histogram crosses the zero line from top to bottom, this is a sell signal.
2. The transition of the histogram from the negative to the positive zone is a buy signal.

Therefore, it is necessary to create conditions under which a trade will be made, namely, if the indicator value on the next candle changes its sign, then the signal is sent to make a trade.
To create a strategy, we need:

- Run the program.

1.png

- Select the Variable, Candles and Chart Panel blocks, connect them.

2.png

- Select an instrument with which we will test the strategy.

3.png

- Plot a candle chart.

4.png

- Select the Indicator and Chart Panel blocks. Connect the Indicator and Candles blocks.

5.png

- Plot a chart of the MACD indicator.

6.png

- Select the Variable block and assign it a numeric value of 0 for further comparison with the indicator value.

7.png

- Select the Comparison block and set the test condition in the properties: execution during the test, with the MACD indicator value greater than 0.

- Add two Variable blocks and Comparison block. One of the variables is set to -1 in the block properties. It will indicate the transition of the MACD curve value from negative to positive area. The second Variable value is set to 0 in the properties, that will indicate the initial indicator value.

- Set the condition in the Comparison block that will be fulfilled if the initial indicator value for the time frame is greater than the current one.

- Connect the Variable blocks via a trigger socket with the Comparison blocks, as shown in the figure.
Select the Logical Condition and Variable cubes.

8.png

- The execution condition of two comparisons will be checked in the Logical Condition cube. Set the AND condition in the properties of the Logical Condition cube and connect the cubes as shown in the figure.

9.png

- Set the value equal to -1 in the Variable cube and connect it with the Logical Condition cube via a trigger socket, and through the output connect to the input of the cube with a value of 0. This will allow overwriting the checkbox value when conditions are met, indicating within what range of values the MACD indicator curve is.

10.png

- Select the Open Position block, select the Buy direction in the settings and connect data and trigger with the socket, as shown in the figure.

11.png

- Select two Variable blocks in which to set the volume and portfolio for trading. Connect them with the corresponding sockets of the Open Position block.

12.png

- Similarly, create a routine for the Sales execution.

13.png

-The strategy is ready, let’s run it.

14.png




Добавить файлы через драг-н-дроп, , или вставить из буфера обмена.

loading
clippy