forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Express Generator → Take Profit Out of Range

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

Topic: Take Profit Out of Range

Hello good night I would like to draw attention to a bug that is happening to me this occurred right after the update that happened in the afternoon all the robots even being with the limiter in this way

stop_loss_type = Fixed
stop_loss_range_min = 1000
stop_loss_range_max = 1000

; Take Profit: AlwaysUse, MayUse, DoNotUse
take_profit_usage = AlwaysUse
take_profit_range_min = 25
take_profit_range_max = 25
take_profit_gte_stop_loss = false

It simply all the strategy that generates does not obey minimum and maximum arrangement in case it was for all strategies

----------------------------------------------
Stop Loss 1000, Take Profit 96, Long only
Entry: RSI [7.3] [5.50] Alligator [3,3,4] [47,21,21,5,5,1] ADX [2] [2.31] Bulls Power [3] [6.0]
Exit : Do not Exit [0] []


I believe it could be a bug

Re: Take Profit Out of Range

Thank you for the report!

It looks like a bug.

I check the code and cannot see obvious problems, so I need to dig deeper.

Please give me more details about this case.
Did it happen when generating new strategies or when validating old collections?
Did you use Optimizer or Monte Carlo?

Please post the complete command and the ini file to make reproducing and fixing the issue easier.

Re: Take Profit Out of Range

yes sr

; Settings keys can be in snake case, camel case, or pascal case.
; All settings can be overwritten by an user settings file or a command option.
; Example: node ./bin/gen.js --settings ./my-settings.ini --collection-capacity 1000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Data source              ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Express Generator loads data by either "server", "symbol", and "period" or by "data_file"

; Server is actually the data files folder under the "data" folder.
; Provided by Forex Software Ltd.: Premium, Eightcap, BlackBull, Darwinex, MetaQuotes
server = Premium
symbol = EURUSD
; Avalable values: M1, M5, M15, M30, H1, H4, D1
period = M30

; Data file from Premium data or exported from Meta Trader
; Example: data_file = ./data/Premium/EURUSD_M30.json
; The usage of "data_file" overrides the "symbol" and the "period" parameters.
data_file =

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Output collection        ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Collection's filename for a newly generated or a validated Collection.
; Possible placeholders: [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], [DAY], [COUNT], [PROFIT]
; Placeholders can be used as directory names too.
; Example: output = ./collections/[SERVER]/[SYMBOL]/[PERIOD]/collection.json
output = ./collections/Coll_[SYMBOL]_[PERIOD].json

; When 'false' it adds a suffix to the collection file if it already exists.
; When 'true', it overwrites the file.
output_replace = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Input collection or directory  ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Points one or several collections or a collection directory for validation.
; Keep empty to generate a new Collection.
; Possible placeholders: [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], [DAY]
input =

; Filters the input collections by given text phrases.
; It is helpful when we have an "input" directory with many collections.
; Possible placeholders: [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], [DAY]
input_match =./collections

; It validates the "input" strategies and then continues generating new ones
validate_then_generate = false

; Prevent rising an error when an input file cannot be loaded
suppress_input_error = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Collection               ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; The Collection will purge the excessive records.
; 0 means 100000
collection_capacity = 1000

; Sort the Collection by one of the following metrics:
; NetBalance, Profit, ProfitFactor, ReturnToDrawdown, RSquared, Stagnation, WinLossRatio
sort_by = Profit

; Correlation analysis threshold
correlation_threshold = 0.98

; Detect balance lines correlation
resolve_correlation = true

; Detect strategies with similar trading rules
resolve_similar_rules = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Generator stop           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; 0 means unlimited for all of the options
max_calculated_strategies = 0
max_ascended_strategies   = 0
max_collected_strategies  = 0
max_working_minutes       = 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Acceptance criteria      ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Set 0 to ignore a criterion (except for min_profit)
max_consecutive_losses = 0
max_drawdown_percent   = 0
max_equity_drawdown    = 0
max_stagnation_days    = 0
max_stagnation_percent = 0
min_count_of_trades    = 10
min_profit             = 1
min_profit_factor      = 0
min_profit_per_day     = 0
min_r_squared          = 0
min_return_to_drawdown = 0
min_win_loss_ratio     = 0
min_m1_count_of_trades = 0
min_m1_profit          = 0
min_m1_profit_factor   = 0
min_y1_count_of_trades = 0
min_y1_profit          = 0
min_y1_profit_factor   = 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Account settings         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

account_currency      = USD
initial_account       = 10000
leverage              = 100

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Strategy properties      ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

entry_lots            = 0.10

; Trade direction: LongAndShort, LongOnly
trade_direction_mode  = LongAndShort

; Opposite entry signal: Ignore, Reverse, IgnoreOrReverse
opposite_entry_signal = Ignore

; Stop Loss: AlwaysUse, MayUse, DoNotUse
stop_loss_usage       = AlwaysUse
; Stop Loss type: Fixed, Trailing, FixedOrTrailing
stop_loss_type        = Fixed
stop_loss_range_min   = 500
stop_loss_range_max   = 500

; Take Profit: AlwaysUse, MayUse, DoNotUse
take_profit_usage         = AlwaysUse
take_profit_range_min     = 25
take_profit_range_max     = 25
take_profit_gte_stop_loss = false

; Max number of indicators to use
max_entry_slots = 8
max_exit_slots  = 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Backtester               ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Values: Open, Close. Use Open for EA Studio and Close for FSB Pro
exit_trade_at         = Open
close_at_backtest_end = true

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Data Horizon             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

max_data_bars  = 100000

; Use these parameters to set the data range between "data_start" and "data_end".
; Set from where the actual trading starts with "trade_start".
; Text: "2023-05-25 00:00 UTC", "2023-05-25 00:00", "2023-05-25" or "25 May 2023 00:00 UTC"
; Negative number as a number of days before the current date: -365, -30, -7

use_data_start  = false
data_start      = "01 Jan 2020 00:00 UTC"

use_data_end    = false
data_end        = "30 Jun 2023 00:00 UTC"

use_trade_start = false
trade_start     = "01 Jun 2023 00:00 UTC"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Forward testing          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Validate strategies on new unseen data.

use_forward_testing = false
preload_data_bars   = 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Out of sample            ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Use these parameters to set the data range.
; The program cuts data after applying Data Horizon.

data_start_percent = 0
data_end_percent   = 100

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Trading Session          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

session_open  = 00:00
session_close = 24:00
friday_close  = 24:00

trade_on_sunday = true

close_at_session_close = false
close_at_friday_close  = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Symbol info              ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Set values to override the values coming with the data file.
; Useful for the Premium Data.
; Commission is in Currency applied at Close.

spread     =
swap_long  =
swap_short =
commission =

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Miscellaneous            ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; When enabled, the generator dynamically updates the best strategy on the console.
update_best = true

; How many strategies to print when finish
show_top = 10

; Prevent showing output in the console (except errors)
silent = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Indicators used by the Generator ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Entry indicators

entry_accelerator_oscillator       = true
entry_accumulation_distribution    = false
entry_adx                          = true
entry_alligator                    = true
entry_average_true_range           = true
entry_awesome_oscillator           = true
entry_bears_power                  = true
entry_bollinger_bands              = true
entry_bulls_power                  = true
entry_candle_color                 = true
entry_commodity_channel_index      = true
entry_demarker                     = true
entry_directional_indicators       = true
entry_donchian_channel             = false
entry_envelopes                    = true
entry_force_index                  = false
entry_long_or_short                = false
entry_macd                         = true
entry_macd_signal                  = true
entry_momentum                     = true
entry_money_flow_index             = false
entry_moving_average               = true
entry_moving_average_of_oscillator = true
entry_moving_averages_crossover    = true
entry_on_balance_volume            = false
entry_pin_bar                      = true
entry_rsi                          = true
entry_rvi                          = false
entry_rvi_signal                   = false
entry_standard_deviation           = true
entry_stochastic                   = true
entry_stochastic_signal            = true
entry_time                         = false
entry_volumes                      = false
entry_williams_percent_range       = true

;; Exit indicators

exit_accelerator_oscillator       = false
exit_accumulation_distribution    = false
exit_adx                          = false
exit_alligator                    = false
exit_average_true_range           = false
exit_awesome_oscillator           = false
exit_bears_power                  = false
exit_bollinger_bands              = false
exit_bulls_power                  = false
exit_candle_color                 = false
exit_commodity_channel_index      = false
exit_demarker                     = false
exit_directional_indicators       = false
exit_do_not_exit                  = true
exit_donchian_channel             = false
exit_envelopes                    = false
exit_force_index                  = false
exit_macd                         = false
exit_macd_signal                  = false
exit_momentum                     = false
exit_money_flow_index             = false
exit_moving_average               = false
exit_moving_average_of_oscillator = false
exit_moving_averages_crossover    = false
exit_on_balance_volume            = false
exit_rsi                          = false
exit_rvi                          = false
exit_rvi_signal                   = false
exit_standard_deviation           = false
exit_stochastic                   = false
exit_stochastic_signal            = false
exit_time                         = false
exit_volumes                      = false
exit_williams_percent_range       = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Indicator options                ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; The following options are used by the Generator for composing new strategies.

; Randomize Moving Average Methods.
; When 'true', the Generator chooses between Simple, Exponential, Weighted and Smoothed.
randomize_ma_method = false

; Maximum period generated by the Generator. Recommended: 50. Recommended max 200.
max_indicator_period = 100

; Shift of the Moving Average indicator. When it is enabled, the Generator may use shift.
randomize_ma_shift = false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Auto-save collection             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Auto-save is useful if you run Express Generator for long time on strict Acceptance Criteria
; Setting 0 disables an option. Choose one of the options only.

; Save the collection at a particular interval in minutes.
; It doesn't clear EG collection.
auto_save_at_minutes = 0

; Save the collection when it reaches the given count.
; It clears EG collection.
auto_save_at_collected = 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Optimizer                        ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

enable_optimizer     = false
numeric_values_steps = 20
optimize_protections = false

; Search best strategy by:
; NetBalance, Profit, ProfitFactor, ReturnToDrawdown, RSquared, Stagnation, WinLossRatio
optimize_by = Profit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Monte Carlo                      ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

enable_monte_carlo            = false
count_of_tests                =  20
valid_tests_percent           =  80

spread_max                    =  30

; Execution problems
slippage_max                  =  20
skip_entries_percent          =   2
skip_exits_percent            =   2
rand_close_percent            =   0

; Strategy variations
ind_params_change_probability =   0
ind_params_max_change_percent =  20
ind_params_min_delta_steps    =  20
rand_first_bar_percent        =  10

; Monte Carlo validation
mc_max_consecutive_losses     =   0
mc_max_drawdown_percent       =   0
mc_max_equity_drawdown        =   0
mc_max_stagnation_days        =   0
mc_max_stagnation_percent     =   0
mc_min_count_of_trades        = 100
mc_min_profit                 =  10
mc_min_profit_factor          =   0
mc_min_profit_per_day         =   0
mc_min_r_squared              =   0
mc_min_return_to_drawdown     =   0
mc_min_win_loss_ratio         =   0

Re: Take Profit Out of Range

i.changeTakeProfit=function(t,e){var a;0!==e.takeProfitUsage&&Math.random()<.5?(t.useTakeProfit=!1,t.takeProfit=Math.max(Math.min(100,e.takeProfitRangeMax),e.takeProfitRangeMin)):(t.useTakeProfit=!0,a=e.takeProfitGteStopLoss&&t.useStopLoss?Math.max(e.takeProfitRangeMin,Math.min(t.stopLoss,e.takeProfitRangeMax)):e.takeProfitRangeMin,e=Math.min(e.takeProfitRangeMax,Math.max(e.stopLossRangeMax,a)),t.takeProfit=Num.randomInteger(a,e))}

sir, if you allow me to help you, I managed to solve the problem as follows, but I am sure that you will do better, because I believe I have made a palliative measure

Here is the line I put inside the xgen.min.js file to solve my problem

When useTakeProfit is set to false, the takeProfit value is limited to the maximum takeProfitRangeMax:

When useTakeProfit is true, we ensure that the maximum value of e (which will be used to generate the random takeProfit) does not exceed takeProfitRangeMax:

These changes ensure that the Take Profit amount will never exceed the take_profit_range_max set in the settings.

Re: Take Profit Out of Range

Strategy 1
----------------------------------------------
Stop Loss 500, Take Profit 25
Entry: MACD Signal [0,3] [38,96,16] Moving Average of Oscillator [3,3] [4,89,17,-0.0014]
Exit : Do not Exit [0] []


    10023 ┤                     ╭─────────────────     Net profit      23.40 USD
    10021 ┤                     │                      Profit per day  0.01  USD
    10019 ┤                     │                      Profit factor   23.40
    10017 ┤                     │                      Max drawdown    0.00  USD
    10015 ┤                     │                      Max drawdown    0.00  %
    10013 ┤                     │                      Return/drawdown 23.40
    10010 ┤                    ╭╯                      Win / loss      1.00
    10008 ┤                    │                       Max stagnation  1897  days
    10006 ┤                    │                       Max stagnation  53.85 %
    10004 ┤                    │                       R - squared     54.92
    10002 ┤                    │                       Max cons losses 0
    10000 ┼────────────────────╯                       Count of trades 1


Strategy 2
----------------------------------------------
Stop Loss 500, Take Profit 25
Entry: Average True Range [5] [44,0.0051] Awesome Oscillator [0] [0] MACD [3,3] [47,97,9]
Exit : Do not Exit [0] []


    10021 ┤      ╭────────────────────────────────     Net profit      21.29 USD
    10019 ┤     ╭╯                                     Profit per day  0.01  USD
    10017 ┤     │                                      Profit factor   21.29
    10015 ┤     │                                      Max drawdown    0.00  USD
    10013 ┤     │                                      Max drawdown    0.00  %
    10011 ┤     │                                      Return/drawdown 21.29
    10010 ┤     │                                      Win / loss      1.00
    10008 ┤     │                                      Max stagnation  2986  days
    10006 ┤     │                                      Max stagnation  84.76 %
    10004 ┤     │                                      R - squared     8.96
    10002 ┤     │                                      Max cons losses 0
    10000 ┼─────╯                                      Count of trades 1


Strategy 3
----------------------------------------------
Stop Loss 500, Take Profit 25
Entry: Momentum [6,3] [23,100]
Exit : Do not Exit [0] []


    16869 ┤                                  ╭────     Net profit      6589.90 USD
    16245 ┤                             ╭──╮╭╯         Profit per day  1.87    USD
    15620 ┤                         ╭───╯  ╰╯          Profit factor   1.68
    14996 ┤                     ╭╮╭─╯                  Max drawdown    1174.98 USD
    14371 ┤       ╭─╮╭──────╮ ╭─╯╰╯                    Max drawdown    8.07    %
    13747 ┤     ╭─╯ ╰╯      ╰─╯                        Return/drawdown 5.61
    13122 ┤    ╭╯                                      Win / loss      0.94
    12498 ┤   ╭╯                                       Max stagnation  699     days
    11873 ┤   │                                        Max stagnation  19.82   %
    11249 ┤ ╭─╯                                        R - squared     63.39
    10624 ┤ │                                          Max cons losses 2
    10000 ┼─╯                                          Count of trades 695


Strategy 4
----------------------------------------------
Stop Loss 500, Take Profit 25
Entry: Pin Bar [0] [9,39]
Exit : Do not Exit [0] []

NOW WHEN I GENERATE A STRATEGY IT RESPECTS THE MAXIMUM AND MINIMUM RANGE CONFIRMS TO ME IF THIS IS CORRECT

Posts: 5

Pages 1

You must login or register to post a reply

Forex Software → Express Generator → Take Profit Out of Range

Similar topics in this forum