Portfolio X - Settings

Portfolio X - Settings

1 September 2020, 05:15
Mateus Botelho Mattos
1
8 161
setName = ""
OpenNewPositions = true
MagicNumber = 23
OpenPositionMinutesDelayD1 = 90


setName
This EA allows you to create several portfolios by selecting the desired strategies for each one.
To facilitate your control, enter a name here for this set of parameters that make up your portfolio and save it on your computer with the same name.
When you load the previously saved .set file, this name will help you to identify the portfolio you have created.

OpenNewPositions
Set to false to suspend the opening of new positions by the EA.
Open positions will continue to have their exit and trailing signal managed by the EA.

MagicNumber
Basic identifier of positions opened by the EA, from 1 to 99.
Each strategy opens its positions with an individual Magic Number, starting with this value.
The Magic Number of the position is formed as follows: "mm 0 gg 0 sss"
mm = MagicNumber
gg = Strategy Set number

sss = Strategy number

Strategy Set numbers are:

  • EURUSD_H1_STRATEGY_SET_02 = 2
  • EURUSD_H4_STRATEGY_SET_02 = 3
  • EURUSD_D1_STRATEGY_SET_02 = 4
  • USDJPY_H1_STRATEGY_SET_01 = 8
  • USDCHF_H1_STRATEGY_SET_01 = 9
  • AUDUSD_H1_STRATEGY_SET_01 = 10
  • AUDUSD_D1_STRATEGY_SET_01 : 12


OpenPositionMinutesDelayD1
This EA evaluates the opening of new positions only when a new strategy timeframe bar is started.
For timeframe D1, the opening would be at 00:00 on the day, at your broker time. Normally at this time the spreads rise too much, as the broker is balancing his positions.
To get around this inconvenience, the value of OpenPositionMinutesDelayD1 creates a delay in the processing of the EA of the timeframe bar D1, opening positions a few latter, at a time when the spread is already normalized.

 

ignoreMidnightNewBarMinutes
Similar to OpenPositionMinutesDelayD1, this one allow the EA to ignore the first bar on midnight (00:00 broker time), for strategies on other timeframes than D1.
This avoid Enter/Exit signals when brokers have higher spreads or market closed.



---------- VOLUME & RISK ----------

VolumeByRisk = true
EntryRiskPercent = 0.5
FixedVolume = 0.01

maxExposure_volume = 0
maxExposure_leverage = 0
maxExposure_IgnoreBreakEven = true
maxNewPositionsPerBarPerStrategySet = 0
operatingMethod = NORMAL


VolumeByRisk
If true, the EA will calculate the lot based on: EntryRiskPercent value, strategy stop loss and account Free Margin.
As each strategy has its individual stop loss, this method is the most recommended for good risk management.

EntryRiskPercent
If VolumeByRisk = true, each strategy will use this value to calculate the lot value of its positions, based on: EntryRiskPercent value, strategy stop loss and account Free Margin .
Conservative values ​​are up to 0.5%
Accounts with a balance of less than $ 1,000 may need to increase the risk for the EA to open positions. In general accounts up to $200 may need around 3.0%

FixedVolume
If VolumeByRisk = false, the positions will be opened with the volume entered here.


maxExposure_volume
As the EA has several strategies running simultaneously, many simultaneous positions may open, increasing your account's risk exposure.
Here you can limit the maximum total volume that this EA can operate, considering the volume of each open position.
Zero ignores this limit.

maxExposure_leverage
As the EA has several strategies running simultaneously, many simultaneous positions may open, increasing your account's risk exposure.
Here you can limit the maximum total leverage that this EA can use, considering the volume of each open position.
If you want to limit the exposure to a 5:1 leverage, enter 5.
If you want to limit the exposure to a 10:1 leverage, enter 10.
Zero ignores this limit.

maxExposure_IgnoreBreakEven
If true, the calculations of maxExposure_volume and maxExposure_leverage will disregard open positions where the Stop Loss is beyond the Break Even limit, that is, there is no longer any possibility of loss in the position.
Recommended true.


maxNewPositionsPerBarPerStrategySet
With multiple strategies, more than one position can open at the same time in the same direction.
If greater than zero, the opening of positions on the same timeframe bar, in the same direction, in the same Strategy Set, will be limited to this value.


operatingMethod
NORMAL or CONSERVATIVE, the second is more selective when opening positions. Backtest it and choose the method that suits you best.

closeAllPositionsOnProfitPercent
This parameter configures the EA to close all open positions, in all symbols, when that percentage of profit is reached.

maxPositionsPerSymbol
Limit the maximum number of open positions on the same symbol, for all strategies, all groups.


--------- STRATEGIES GROUP A ----------

group_A = EURUSD_H1_STRATEGY_SET_02
symbol_A = STRATEGY_SYMBOL
timeframe_A = STRATEGY_TIMEFRAME

CustomSymbol_A = ""

A_MaxSpread = 20

list_A1 = "17,19,20,24,36,38,40,48,54,60,66,105,111,119,132"

--- BREAK EVEN 1 ---
A_BETrigger_pts = 250; 
A_BEGap_pts = 200;
        
--- BREAK EVEN 2 ---
A_BE2Trigger_pts = 450;

A_BE2Gap_pts = 150;


group_A
Select the Strategy Set you want to list strategies that will run in this EA.

symbol_A
By default use STRATEGY_SYMBOL. Use CHART_SYMBOL only if you want to try out the strategies in this package on other symbols.

timeframe_A
This parameter exists only for the EA to be validated by the tests of mql5.com.
Always use STRATEGY_TIMEFRAME

CustomSymbol_A
Each Strategy Set has its appropriate symbol, such as EURUSD, GBPUSD, etc.
Some brokers use private names, such as mEURUSD, #EURUSD, etc.
If your broker uses a particular symbol, enter it here, and select  symbol_A = CUSTOM_SYMBOL.

list_A1
Here you must enter the numbers of the strategies, from Strategy Set informed in "group_A", which you want in your portfolio, and these will be executed by this EA.
This is the list of numbers, from 1 to the maximum number of strategies in the Strategy Set selected in "group_A".
Numbers must be separated by commas.
Dash can also be used to enter a range, for example: 1-200, the EA will execute all the first 200 strategies of the Strategy Set selected in "group_A".
The combination of commas and dash is also allowed, eg: 1,5,20-30,78,120

A_BETrigger_pts

First Break Even. This tool moves your Stop Loss ahead of your opened price, holding profits.
Here you enter the distance in points from enter price the BE will be triggered.
Zero disable this feature.

*1 see note

A_BEGap_pts

Here you enter the distance from A_BETrigger_pts in points to move the Stop Loss.
For example: A Long position with enter price = 1.00000 ,  A_BETrigger_pts =500 and   A_BEGap_pts=100. When symbol price reaches  1.00500 , the Stop Loss will be moved to  1.00400 . 100 points before trigger.
A_BE2Trigger_pts  and  A_BE2Gap_pts  has same behavior to second Break Even tool.


A_ts_Trigger_pts

Trailing Stop feature.
This tool moves your Stop Loss ahead of your opened price, holding profits.
Here you enter the distance in points from enter price the BE will be triggered.

*1 see note

A_ts_Gap_pts

Here you enter the distance from A_ts_Trigger_pts in points to move the Stop Loss.
For example: A Long position with enter price = 1.00000 ,  A_ts_Trigger_pts = 600 and   A_ts_Gap_pts =200. When symbol price reaches  1.00800 , the Stop Loss will be moved to  1.00600 . 200 points before trigger.
It the price goes to 1.00900 ,  the Stop Loss will be moved to  1.00700 . 200 points before trigger.
It the price goes to 1.007500 ,  the Stop Loss will continue on  1.00700 .
Zero disable this feature.


A_MaxSpread
Maximum limit for the EA to open new positions on this strategy group.

Set to just above your broker's average spread.


Note *1

Break Even and Trailing can have the trigger starting at the same distance as SL_by_ATR, plus #n points.
To do this, set the trigger to a negative value.

Ex: A position with SL_by_ATR had its SL set at 600 points from the opening price. If you use ts_Trigger_pts = -200 and ts_Gap_pts = 100, when the price reaches 800 points (600 from SL + 200 from ts_Trigger_pts), the SL will be moved to the opening price plus 700 points (price – 100 from ts_Gap_pts). From this moment on, if the price rises to 900 points above the opening, the SL will move to 800 points.



— OTHERS —
A_SL_by_ATR
If higher than zero, replace the Stop Loss of each strategy on this group with a new value, calculated by Open-price + (A_SL_by_ATR x ATR) value for the strategy timeframe.
Ex: A Short position on price 1.00000, ATR at 0.00300 , and A_SL_by_ATR =2.5 => 1.0000 + (2.5 x 0.00300) = 1.00900 => Calculated Stop Loss.
 
A_TP_by_ATR
Similar to A_SL_by_ATR , but for Take Profit.
Any negative value remove all TP from positions on this group.
 
A_ignoreExitSignal
If true, the Exist Signal of all strategies on this group will be ignored.
 
A_OpenPositionFilter1 / A_OpenPositionFilter1_bars
A_OpenPositionFilter2 / A_OpenPositionFilter2_bars
A_OpenPositionFilter3  / A_OpenPositionFilter3_bars
 
Open Position Filters will be applied to all strategies on this group.

Available filters:

  • STOCHASTIC_D1_FILTER
  • STOCHASTIC_H12_FILTER
  • STOCHASTIC_H6_FILTER
  • STOCHASTIC_H4_FILTER
  • STOCHASTIC_H1_FILTER
  • STOCHASTIC_M30_FILTER
  • MA_MN1_FILTER
  • MA_W1_FILTER
  • MA_D1_FILTER
  • MA_H12_FILTER
  • MA_H6_FILTER
  • MA_H4_FILTER
  • MA_H1_FILTER
  • MA_M30_FILTER

    Setting bars=0 the filters will use default values of 10 bars on Moving Average (MA)  and 5 bars on Stochastic.



    Below are several sets that are repeated, from B to G, to allow you to assemble a portfolio with multiple timeframes or symbols, making your risk more pulverized, and your operations broader.

    ---------- STRATEGIES GROUP B - G ----------

    group_B = EURUSD_H4_STRATEGY_SET_02
    symbol_B = STRATEGY_SYMBOL

    CustomSymbol_B = ""

    A_MaxSpread = 20

    list_B1 = "7,16,29,38,54,57,83"


    group_B - G
    Select the Strategy Set that you want to select the strategies that will be run additionally in this EA.

    symbol_B - G
    Use always STRATEGY_SYMBOL.


    CustomSymbol_B - G
    Each Strategy Set has its appropriate symbol, such as EURUSD, GBPUSD, etc.
    Some brokers use private names, such as mEURUSD, #EURUSD, etc.
    If your broker uses a particular symbol, enter it here.

    list_B1 - G1
    Here you must enter the numbers of the Strategy Set strategies informed in "group_B - G", which you want in your portfolio, and they will be executed by this EA.
    This is the list of numbers, from 1 to the maximum number of strategies in the Strategy Set selected in "group_B - G".
    Numbers must be separated by commas.
    Dash can also be used to enter a range, for example: 1-200, the EA will execute all the first 200 strategies of the Strategy Set selected in "group_B - G".
    The combination of commas and dash is also allowed, eg: 1,5,20-30,78,120


    MaxSpread B - G
    Maximum limit for the EA to open new positions on this strategy group.

    Set to just above your broker's average spread.

    — OTHERS —

    Same as on Group_A


    ---------- RUN SINGLE STRATEGY ----------

    ***  This tool allows you to individually backtest each strategy, for each Strategy Set. Don't use it to trade live account, run only in backtest.***

    group_single = EURUSD_H1_STRATEGY_SET_02

    runSingle = 0

    RS_MaxSpread  = 30

    NOTE: When using this tool, it always set the symbol to CHART_SYMBOL, and the timeframe will be always the as STRATEGY_TIMEFRAME.

    group_single
    Select the Strategy Set you want to test.

    runSingle
    Enter the number of the strategy you want to test.
    If using the metatrader optimizer, select from 1, step 1, up to the maximum number of strategies in the Strategy Set selected above.
    If zero, disable this tool.
    If greater than zero, it will ignore any other strategy selected in the groups below.

    MaxSpread
    Maximum limit for the EA to open new positions on this strategy group.
    Set to just above your broker's average spread.


    — OTHERS —

    Same as on Group_A



    Read the Frequently Asked Questions page























































    Share it with friends: