Hedge Fund Algo

Resources: Bot Blueprint

The Strategy

Before delving into playing with set files and changing settings, it is important to understand the actual mechanics of the bot. Copying and pasting someone else’s settings will only get you so far, because market conditions eventually change, and you need to understand the fundamental concept of the bot’s strategy to be able to adjust or to discover your own preferred settings.


The term “martingale” originates from a gambling strategy in which you increase your bet incrementally each time you lose, so that as soon as you win, you make up for all previous losses. While the bot does not work exactly in this way (you do NOT want to double the size of every trade), we will be making use of the general idea to hedge our trades and give us the best chance to guarantee ourselves a profit – all while being automated.


Once the EA is placed on a chart and a set file is loaded/configured and starts running, the bot will look for the first initial entry point to place a trade. This may be instantaneous, or it may take a few minutes or longer, depending on the timeframe your chart is set for in MT4 (we will get into timeframe later). Once the trade is placed, you will also see a “TP” or “take profit” line placed on the chart. If the price reaches this target line, the bot will automatically close out your trade and secure the profit. However, if the price continues to move away from the target profit, the bot will continue to place additional trades, slightly larger each time. By doing so, this moves the take profit target closer to the current price, so that when it is crossed, it will close all the open trades and secure profit. For these reasons, it is important to not interfere with the bot once it is taking trades or it will not hedge properly.


Now that we understand the basic mechanics of the bot, we will delve into the most important settings that you will see referenced often, and that are vital to operating efficiently.

The Settings

When you first open the EA onto a chart (and load a set file), you will see the list of settings that are able to be customized to your preferences. If you have trouble loading the EA or set file, please refer to tutorial videos in ⁠how-to-upload-setfiles . While the set files will have default settings designated for each scenario (currency, US30, BTC, etc)., it is vital to understand the mechanics of the following most important settings, to be able to adjust set files on your own. DISCLAIMER: Lot Size, Take Profit, and Step Size suggestions refer to currency pairs, because they are the most simple, most consistent, and easiest for beginners to get used to. Indices, metals, and crypto lots/pip settings may differ, but the strategy will remain the same.

Lot size:

One important factor in the martingale strategy is the lot size. The lot size determines the amount of currency that is bought or sold in each trade. A smaller lot size means a smaller position, while a larger lot size means a larger position. The lot size is crucial for a forex martingale bot for several reasons:

-Risk management: A forex martingale bot can quickly become risky if the lot sizes are too large. A smaller lot size can help manage risk and prevent large losses.

-Capital preservation: A smaller lot size can help preserve capital and prevent the bot from blowing up its trading account in a single trade.

-Market liquidity: A forex martingale bot that trades with a large lot size can impact the market liquidity, which can lead to slippage and increased trading costs.

-Profit potential: A smaller lot size can limit the profit potential of the martingale strategy, but it can also limit the losses and preserve capital for future trades.

Overall, the lot size is an important parameter to consider when developing a forex martingale bot. It can help manage risk, preserve capital, and maintain market liquidity, while also limiting the profit potential of the strategy. Your minimum and maximum lots are imperative to ensure you are setting yourself up to be profitable. We will take a look at the simple math behind determining lot sizes: While there are a number of variables to consider, when it comes to determining lot sizes - a general rule of thumb of 0.25 to 1.0 is a good foundation to follow, and can help you determine proper lot sizes for nearly any scenario. Keep in mind this PER 100K, PER pair and correlates to about a 3-3.5% risk. One of the common problems I see is running multiple pairs with these same lots and max drawdown (aka DD – we will go over this later)...

Take Profit in Pips:

Traders can set a "take profit in pips" parameter to automatically close a position once it has reached a certain profit level. This setting allows traders to specify the number of pips they would like to earn on a trade before the position is automatically closed. This setting is also cumulative for all open trades, and will close all at once, once the profit level is met. Upon the time of this being written, most clients are using between 7-10 pips for this setting.

Step Size in Pips:

Step size refers to the minimum distance between orders that can be placed on a particular currency pair. When the step size is set in pips, it means that the distance between two consecutive orders must be a certain number of pips apart. For example, if the step size is set at 20 pips, then the bot will only place orders that are at least 20 pips away from the previous order. The step size setting can be useful for managing risk in Forex trading. By placing orders at specific intervals, traders can avoid over-trading and minimize the risk of losing a significant amount of money on a single trade. This setting can also be used to take advantage of market trends, as the bot will only place orders when the market moves in the desired direction by the specified number of pips. In general, it is recommended to use the same pip number for your Take Profit setting and for your Step Size setting (or within a few pips).

Grid Factor Increment:

The Martingale grid factor increment setting determines how much the position size will be increased after each previous trade. The higher this factor is, the more each subsequent trade will pull your Take Profit target line closer to the current price. However, this will also tend to hit your Max Lots setting faster, and you will accrue drawdown quicker. It is advised to keep this factor between 1.1-1.3.

Max Drawdown Risk in Money:

"Drawdown" refers to the decline in a trading account's equity from its peak value to its lowest point. It is a measure of the maximum loss that an account has experienced during a specific period, usually expressed as a percentage of the initial investment or account balance. For example, if a trader's account has a peak value of $10,000 and then experiences a drawdown of 20%, the account equity will have declined to $8,000 ($10,000 - 20% x $10,000).


Since most prop firms have a daily limit that an account may be below equity (usually 5%), this setting is to ensure you do not go over this. It is recommended to use between 3-3.5%, to account for slippage, etc). Keep in mind that this setting is in MONEY, not percent. So for 3% on a 100k account, you will input 3000. This also will apply to live accounts as well, but will depend on the risk tolerance level of the client. Keep in mind, this needs to be adjusted PER pair, as it refers to the drawdown of the individual chart, it is not cumulative. For example, if you are running two charts and want to risk 3000 TOTAL, you would input 1500 in the EA settings on each chart.

Daily Profit Target in Money:

This setting works very similarly to the Max Drawdown setting, but only for profit. You can utilize this setting to close out all trades and charts once a target profit is met. Keep in mind again, this setting is set in MONEY, not percent. Also, this setting takes into account drawdown, and will not close out trades until the profit will be met entirely.

Close All Orders and Charts:

This setting applies to the Max Drawdown Risk and the Daily Profit Target settings. As the name implies, it will close all trades and charts when either setting is met. It is highly recommended to leave this setting as “TRUE,” to prevent you from potentially going into too much Drawdown, but the setting is here for those who would prefer to just stop taking new trades.

Time Filter:

The time displayed in MarketWatch (in MT4) is the server time of the broker's trading server. The time filter for the bot is directly correlated to MarketWatch time, ONLY. There is further information regarding what MarketWatch time periods correspond to which trading sessions. As such, you can simply set the time you wish the bot to take trades for each day. Remember that these days are based on the MarketWatch. If you are in the USA and your broker is another country, these days are going to be a day ahead of you. So Wednesday would be Thursday on the EA’s Filter Date/Time setting. Also the “Utilize time filter” setting has to be set to “true” or the filter will not be in effect, and the EA will continually place trades.


The time “start/end hour” is also based on your market watch, NOT your time zone. If you want it to run all day or manually shut on/off the bot, set your time to 00:00 start and 23:59 end. Finally, the time setting can be used for multiple time periods (with a comma in between), but MUST be in chronological order. For example, if you wanted to run from 20:00 to 08:00 (tail end of NY through Asia), you would input “00:00-08:00, 20:00-23:59” without the quotation marks.


Timeframe (in MetaTrader):

While not a setting of the EA, but rather in MT, the timeframe of a chart will also have an effect on how aggressively the bot will place trades. In MetaTrader, there are multiple timeframe options available, ranging from 1 minute to 1 month or even longer, depending on the trading platform and data feed. The most commonly used timeframes include 1 minute, 5 minutes, 15 minutes, 30 minutes, 1 hour, etc. Although one an initial trade is placed, the bot will act the same, the timeframe will affect when the initial trade is placed. On a 1m timeframe, you will pretty much always have a trade open. On 5m or 15m, the bot may wait some time before placing a trade. For our purposes, 5m or 15m is recommended – depending on the movement of your pair (the more volatile, the longer timeframe).

Resources

Instructor

Ricky Andrade

Ricky Andrade (@riskyricky)

Financial Analyst

Global leader of cutting edge training and coaching to help entrepreneurs rapidly grow their profits.

Hedge Fund Algo

Market Masters is the leading developments company for automated trading softwares! We have been focused in the automation industry for over 5 years and constantly finding ways to help our clients acheive greater success!

Copyright © 2024 Market Masters Inc. All rights reserved.