Class 'C1' expert advisors

Class 'C1' expert advisors

27 February 2024, 11:00
Andrey Minaev
0
129

Description of work

The 'C1' class expert advisor, when a signal from the built-in indicator appears, opens a position, sets a stoploss and takeprofit, and after opening the position, accompanies it until it is closed.

Note: before running the expert advisor, the settings need to be optimized for a specific instrument and timeframe.


Expert advisor settings

General settings

Timeframe

The parameter sets the timeframe on which the expert advisor will work. The parameter is needed if you switch the timeframe while the expert advisor is working, and the expert advisor will work with the timeframe that is set in the settings.

Example: the expert advisor is working on H1, you switch the timeframe to D1 to see the global situation, but the expert advisor continues to work on H1. Although, to evaluate the chart, you can use another chart on which the expert advisor does not work.

Note: if you select the current parameter from the list, the expert advisor will work on the timeframe that is currently active. The parameter is useful when testing on different timeframes, so as not to switch the parameter each time when changing the timeframe for testing.


Magic

The parameter sets a unique identifier for each open position. This parameter is needed if in the future you want to look at the history of transactions with a specific magician in order to assess the profitability of a trading strategy. A magic is assigned to an open position and is stored in the trading history.

Example: you have the same expert advisor working, but with different settings, for example, one expert advisor works with breakeven turned on, and another with breakeven turned off, since the expert advisor is the same, the Magic parameter will help distinguish positions opened by the expert advisor with breakeven turned on from positions with breakeven turned off.

Note: for positions opened manually, the terminal automatically sets the magic = 0, so it is better not to use 0 as a magic.


Money management settings

Position volume

The parameter sets the position volume with which the advisor opens a position.

Note: set the correct volume for the instrument on which the expert advisor will work. It must be greater than or equal to the minimum volume, less than or equal to the maximum volume, and be a multiple of the volume step. To do this, you can look at the specification of the tool, read the instructions.


Funds for volume

The parameter sets the amount of funds to calculate the required volume of the opened position.

The parameter can be used when testing the expert advisor over a long period, so that when the balance grows, the volume of positions increases and the real drawdown is visible. The account balance and the Position volume parameter are taken into account.

Calculation formula: Position volume x (Account balance / Funds for volume). As a result of the expression (Account balance / Funds for volume), the fractional part is discarded.

Example:

Position volume = 0.01, Funds for volume = 100, Account balance 100, position volume 0.01 = 0.01 x (100 / 100)

Position volume = 0.01, Funds for volume = 100, Account balance 150, position volume 0.01 = 0.01 x (150 / 100)

Position volume = 0.01, Funds for volume = 100, Account balance 200, position volume 0.02 = 0.01 x (200 / 100)

Position volume = 0.01, Funds for volume = 100, Account balance 1000, position volume 0.1 = 0.01 x (1000 / 100)

Position volume = 0.01, Funds for volume = 100, Account balance 1200, position volume 0.12 = 0.01 x (1200 / 100)

Position volume = 0.01, Funds for volume = 100, Account balance 2000, position volume 0.2 = 0.01 x (2000 / 100)


Position opening settings

This group contains settings for the indicator that supplies signals. The settings can be viewed for the specific indicator the expert advisor works with.


Position closing settings

StopLoss

The parameter sets the distance from the opening price to the loss limit price.

Calculation formula:

For a Buy position: opening price – (StopLoss x point size)

For a Sell position: opening price + (StopLoss x point size)

Example: StopLoss = 100, position opening price = 1.08000, stoploss for the Buy position will be set at 1.07900 (1.08000 – (100 x 0.00001)), for the Sell position – 1.08100 (1.08000 + (100 x 0.00001)).

Note: the parameter is required and must always be greater than 0.


TakeProfit

This parameter sets the distance from the opening price to the profit taking price.

Calculation formula:

For a Buy position: opening price + (TakeProfit x point size)

For a Sell position: opening price – (TakeProfit x point size)

Example: TakeProfit = 100, position opening price = 1.08000, takeprofit for the Buy position will be set at 1.08100 (1.08000 + (100 x 0.00001)), for the Sell position – 1.07900 (1.08000 – (100 x 0.00001)).

Note: the parameter is required and must always be greater than 0.


The point size can be viewed in the instrument specification or on the chart itself, for example, for the EURUSD pair the point size is 0.00001 (5th quotes), for the USDJPY pair it is 0.001 (3rd quotes).


StopLoss

The parameter sets the distance from the opening price to the loss limit price. The distance is calculated using the ATR indicator. This parameter can be used if the volatility of the instrument changes sharply, and a fixed stoploss is not suitable.

Calculation formula:

For a Buy position: opening price – (StopLoss x ATR)

For a Sell position: opening price + (StopLoss x ATR)

Example: StopLoss = 2, position opening price = 1.08000, current ATR value = 0.00050, stoploss for a Buy position will be set at 1.07900 (1.08000 – (2 x 0.00050)), for a Sell position – 1.07900 (1.08000 + (2 x 0.00050)) .

Note: this parameter is optional and if set to 0, the parameter is not used.


TakeProfit

The parameter sets the distance from the opening price to the profit taking price. The distance is calculated using the ATR indicator. This parameter can be used if the volatility of the instrument changes sharply, and a fixed takeprofit is not suitable.

Calculation formula:

For a Buy position: opening price + (TakeProfit x ATR)

For a Sell position: opening price - (TakeProfit x ATR)

Example: TakeProfit = 2, position opening price = 1.08000, current ATR value = 0.00050, takeprofit for the Buy position will be set at 1.08100 (1.08000 + (2 x 0.00050)), for the Sell position – 1.07900 (1.08000 – (2 x 0.00050)) .

Note: this parameter is optional and if set to 0, the parameter is not used.


TakeProfit

The parameter sets the distance from the opening price to the profit taking price. The distance is calculated based on the distance to the stop loss. The parameter can be used during optimization to reduce the number of parameters to be optimized.

Calculation formula:

For a Buy position: opening price + (TakeProfit x distance to stoploss)

For a Sell position: opening price - (TakeProfit x distance to stoploss)

Example: TakeProfit = 2, position opening price = 1.08000, distance to stoploss = 0.00050, takeprofit for the Buy position will be set at 1.08100 (1.08000 + (2 x 0.00050)), for the Sell position – 1.07900 (1.08000 – (2 x 0.00050)) .

Note: this parameter is optional and if set to 0, the parameter is not used.


Breakeven settings

Activation

The parameter sets the distance until breakeven is activated.

Calculation formula:

For a Buy position: opening price + (Activation x point size)

For a Sell position: opening price – (Activation x point size)

Example: Activation = 100, position opening price = 1.08000, breakeven activation will occur for the Buy position at the level of 1.08100 (1.08000 + (100 x 0.00001)), for the Sell position – 1.07900 (1.08000 – (100 x 0.00001)).


Activation

The parameter sets the distance until breakeven is activated. The distance is calculated using the ATR indicator. The parameter can be used if the volatility of the instrument changes sharply, and a fixed breakeven is not suitable.

Calculation formula:

For a Buy position: opening price + (Activation x ATR)

For a Sell position: opening price – (Activation x ATR)

Example: Activation = 2, position opening price = 1.08000, current ATR value = 0.00050, breakeven activation will occur for the Buy position at the level of 1.08100 (1.08000 + (2 x 0.00050)), for the Sell position – 1.07900 (1.08000 – (0.00050 x 2)).


Activation

The parameter sets the distance until breakeven is activated. The distance is calculated based on the distance to take profit. The parameter can be used during optimization to reduce the number of parameters to be optimized.

Calculation formula:

For a Buy position: opening price + (Activation x distance to takeprofit)

For a Sell position: opening price – (Activation x distance to takeprofit)

Example: Activation = 50%, position opening price = 1.08000, distance to takeprofit = 0.00200, breakeven activation will occur for the Buy position at the level of 1.08100 (1.08000 + (50% x 0.00200)), for the Sell position – 1.07900 (1.08000 – (50%) x 0.00200)).


Activation involves moving the stoploss to the opening price plus/minus the Distance to placing parameter.

Note: the priority of the Activation parameter is directed from top to bottom in the list of settings, i.e. the lowest Activation parameter has the highest priority. Made to avoid errors with settings if you have several Activation parameters greater than 0.


Distance to placing

The parameter sets the distance at which the breakeven will be placed from the opening price. It can be useful if you want the breakeven to be a little in profit, or if slippage occurs, the position can be closed with a small loss, or to compensate for the commission for opening/closing a position.

Calculation formula:

For a Buy position: opening price + (Distance to placing x point size)

For a Sell position: opening price – (Distance to placing x point size)

Example: Distance to placing = 10, position opening price = 1.08000, breakeven for the Buy position will be set at 1.08010 (1.08000 + (10 x 0.00001)), for the Sell position – 1.07090 (1.08000 – (10 x 0.00001)).


ATR settings

This group contains settings for the ATR indicator, which is used to calculate dynamic stoploss, takeprofit and breakeven. The word dynamic means that the distance is always set differently; if volatility is high and the price travels a long distance, then the distance to stoploss, takeprofit and breakeven will be large.

Note: if the settings do not use stoploss, takeprofit or breakeven, which are calculated using the ATR indicator, then these settings are not needed. This is important when optimizing so that the optimizer does not go through unnecessary parameters.


Trading stop settings

Profit

The parameter sets the total profit, upon reaching which the expert advisor closes open positions and is deleted. The parameter is measured in the deposit currency.

Loss

The parameter sets the total loss, upon reaching which the expert advisor closes open positions and is deleted. The parameter is measured in the deposit currency.


Display settings

StopLoss color

The parameter sets the color of the stoploss line.

StopLoss line style

The parameter sets the style of the stoploss line.

StopLoss line widht

The parameter sets the width of the stoploss line.

TakeProfit color

The parameter sets the color of the takeprofit line.

TakeProfit line style

The parameter sets the style of the takeprofit line.

TakeProfit line widht

The parameter sets the width of the takeprofit line.


Class 'C1' expert advisors:

MA7 Flax C1 MT4;

MA7 Flax C1 MT5;

MA7 Galega C1 MT4;

MA7 Galega C1 MT5;

MA7 Hypnum C1 MT4;

MA7 Hypnum C1 MT5;

MA7 Ixora C1 MT4;

MA7 Ixora C1 MT5;

MA7 Viola C1 MT4;

MA7 Viola C1 MT5.


Subscribe to the 'MA7 Trading' channel to receive notifications about new programs, updates and other information.

Ask questions in the profile on the MQL5.

Share it with friends: