Price Action Day Trader User Manual

17 April 2024, 18:05
Vladimir Buchta
0
84

This is user manual for Expert Advisor Price Action DayTrader.

EA introduction

This EA was created to help all day traders using price action to distance themselves from the emotional influence caused by instant market monitoring and routine decisions to open and close trades which is the source of most trading mistakes.

Price Action DayTrader enables focusing exclusively on high-level market analysis, while the ongoing tactical decision-making during daily sessions is taken care of automatically.

EA works with trading range and market sentiment. Trading range is an area you plan to trade within in a daily session. Market sentiment then determines which trading direction is preffered for particular trading session (Buy, Sell or both).

EA identifies bullish price rejections in lower half of trading range and buys towards top of range. In upper half of trading range it identifies bearish price rejections and sells towards bottom of trading range.

Market analysis

The key for successful using this EA is to perform high level market analysis upfront of each trading session and adjust EA to current market conditions. AS a trader, you need to identify trading range for current day session and general market sentiment (section Market conditions of input parameters).

Despite there is whole bunch of parameters to control and fine tune behaviour of DayTrader, this is the minimum you need to do on daily basis. Everything else, like identifying trading signals, opening trades, taking profits and handling risk is then all covered by EA. Nevertheless, even during active trading session you are still able to manually adjust EA’s behaviour through control panel.

I strongly recommend to test this EA on demo account to obtain confidence in using it and build solid strategy for identifying trading range and market trend. Once you have strategy in place it could be backtested with bulk market data, see chapter Backtesting EA.

Trading

Trading range

Trading range should be identified on a higher timframe than is the on you plan to trade on and should corresponds to the timeframe set in Range breakout section of input parameters.

Top of trading range or range maximummum is a maximal sell price for day session (highest price below which it is still worthwhile to sell), range minimum is a minimal buy price (lowest price above which it is still worthwhile to buy).

EA buys in lower half of trading range and sells in higher half trading range, depending on market sentiment. Line marking center of trading range and separanting "buy and sell areas" is called balance point.

Market sentiment determines what types of trades are allowed during trading session. Buy sentiment means that buyers control the market and therefor EA is focused only on buy trading signals. Similarly in Sell market sentiment sellers are expected to control the market and EA picks only sell signals. Consolidation then means that there is no signifficant sentiment in the market and EA accepts both buy and sell trading signals. It is assumed that buyer and sellers are more or less in balance.


Example of trading range with emphasized buy and sell areas. Balance point (dark blue)  is a center of trading range. EA sells above balance point and buys below.

Price rejection

EA identifies price rejections using combination of fractal and price action patterns engulfing or pinbar. Rejection is marked in the chart by arrow. It is marked on the candle, where rejection is confirmed (depending on fractal setup). Each type of rejection (engulfing 1, engulfing 2 and pinbar) can be enabled/disabled by input parameters (see section Price rejection). If all three price rejections are disabled, EA identifies price rejections only by fractal.

  • Engulfing (type 1) - classic definition of engulfing price action pattern. Consists of two candles and
    • Body of last candle > engulfing ratio * body of previous candle.
    • Bull: Last candle is bullish, previous candle is bearish.
    • Bear: Last candle is bearish, previous is bullish.
  • Engulfing (type 2) – loosely defined engulfing. Definition consists of three candles. Conditions that apply on last candle in classic engulfing definition, must apply on last two candles.
    • Sum of bodies of last two candles > engulfing ratio times * body of previous candle.
    • Bull: First candle bearish, last two bullish
    • Bear: First candle bullish, last two bearish.
  • Pinbar
    • Bull: Lower wick > pinbar ratio * body.
    • Bear: Upper wick > pinbar ratio * body.

Trading signal

Trading signal consists of market sentiment, correct position of market price within trading range and confirmation by price rejection. Rejection is combination of fractal with price action pattern engulfing or pinbar.
  • BUY:
    • Market sentiment is BUY or Consolidation.
    • Price is below balance point.
    • One of two following situations occurs
      1. Price rejection is formed near (within stop loss limit) range minimum. Range minimum is then a stop loss for potential buy trade. This is reffered to as a range rejection.
      2. For newly formed price rejection EA is able to find previous, lower price rejection. If previous price rejection is within stop loss limit from market price, it is then a stop loss for new buy trade. This is reffered to as a double rejection.
  • SELL:
    • Market sentiment is SELL or Consolidation.
    • Price is above balance point.
    • One of two following situations occurs
      1. Price rejection occurs near (within stop loss limit) range maximum. Range maximum is then a stop loss for potential sell trade. This is reffered to as a range rejection.
      2. For newly formed price rejection EA is able to find previous, higher price rejection. If previous price rejection is within stop loss limit from market price, it is then a stop loss for potential buy trade. This is reffered to as a double rejection.

    SELL trade opened on range rejection trading signal.

    SELL trade opened on double rejection trading signal.

Stop loss

Stop loss is either boundary of trading range (range minimum for buy, range maximum for sell) or in case of double rejection it is previous price rejection.

Another alternative for managing risk and protect profits is to use trailing stop, see Trailing stop section in chapter Input parameters.

Target

Target of a trade is by default opposite boundary of trading range. If target is not set, trade lasts until end of trading session (see input parameter Target in Trading session section). If partial profit is enabled, target of first trade is set to size of stop loss.

Number of open positions and partial profit

Normally EA opens only one position at a time with position size of input parameter Position size. As long as there is any open position, EA does not follow does not monitor trading signals nor does not open any new position. If partial profit is enbaled, EA opens two positions, each of input parameter Position size. First position has profit target set to size of stop loss, second position according to input parameter Target.

Trading range breakout

Breaking through range maximum or minimum is defined as folows: Candle of higher timeframe (timeframe defined in Range breakout section of input parameters) closed above range maximum or below range minimum. After range maximum or minimum is broken, appropriate line disappears from chart and condition for balance point is no longer applied in trading signal. If e.g. range maximum is broken, buy trade is opened anytime market price is close to range minimum or anytime occurs double price rejection.

EA's behaviour after range is broken is controled by input parameters in section Range breakout.

Input parameters

Trading session

  • Trade session start – Start time of trading session in timezone of your broker, format <hh:mi>.
  • Trade session end – End time of trading session in timezone of your broker.
  • Position opening until - Time threshold for opening new positions in your broker’s timezone. No new positions are opened beyond this time, but trading session is still active, controling target(s) of open position(s).
  • Action on end of trading session – What should happen after trading session finishes.
    • Close all positions – EA closes all open positions, goes to inactive mode after session ends, but will start operating with the same inputs on the next day with the start of new trading session.
    • Close all positions and disable trading – Trading is disabled (no new trades are being opened) until it is manually enabled in control panel. This allows to keep EA active, but at the same it prevents EA from opening trades on next trading session with obsolete market conditions.
  • Position size – Lot.
  • Max stop loss – Maximal allowed size of stop loss for one single trade in points.
  • Max day loss – Maximal limit for daily loss in points. Daily loss is calculated as a sum of all loss trades on trading account during trading session (not only for particular instance of DayTrader). Limit is for single instance of EA. Trades with risk that would overlap Max day loss limit won't be placed.
    Actual day loss is visible in control panel.
  • Offset added to SL value – Offset in points to be added to calculated SL of every newly opened position. Positive value increases SL size, negative decreses SL.
  • Target
    • Close with end of session – Target of newly opened position is set to 0 and position will be closed with end of session, no matter whether it is in profit or loss.
    • Opposite range – Target is set to range maximum for newly opened buy positions and to range minimum for sell positions. Should range be broken, target is set to 0 and positions are closed with end of trading session.
  • Offset added to target value – Offset in points to be added to calculated target value, in case opposite range is opted. Positive value increases target size, negative decreses.
  • EA Magic number – Unique identifier of EA instance. This is important in particular if there are multiple instances of DayTrader in paralel on one account. In this case, each instance should have unique Magic number. Otherwise instances could affect each other's positions.

Market conditions

  • Market sentiment – General market sentiment for the day session. Sentiment determines what type of orders will be allowed during trading session (Buy or Sell). Consolidation then enables placing both type of orders depending on trading signal.
    • Buy zone – Market has a buying preference. EA opens only buy trades.
    • Sell zone – Market has a selling preference. EA is only selling.
    • Consolidation – Market is moving sideways, consolidating. EA opens both buy and sell trades.
  • Range max – Top of daily range.
  • Range min – Bottom of daily range.
  • Load market conditions from file and File name – Enables bulk load of market data for multiple day from csv file. See chapter Bactesting.

Partial profit

  • Partial profit enabled – If enabled, EA on trading signal opens two positions each of size Position size.
  • Move SL of 2nd position to open price – If true, after target of first position is reached, SL of last remaning position is updated to open price (it is updated slightly above or below open price, depending on Move SL 2nd position offset)
  • Move SL of 2nd position offset – Offset added to open price, if previous parameter is true (positive value goes to profit, negative to loss compared to open price).

Trailing stop

  • Minimal position size – Profit size in points that position has to reach for trailing stop to be activated.
  • Size of trailing stop – The percentage size of drawdown from the maximum profit to close the trade.
  • 2nd position – Same meaning as previous two params, but used for second position if partial profit is enabled.

Price rejection

This part specifies price action patterns that marks price rejections inducing trading signal. By default EA uses for identifying price rejections fractal combined with pinbar or engulfing price patterns.

  • Price rejection by pinbar – if true, price rejection by pinbar pattern is enabled.
  • Pinbar ratio – Minimal wick to body size ratio for pinbar to be valid.
  • Price rejection by engulfing type 1– If true, rejection by classic price action pattern engulfing is enabled. Obviously fractal can occur on first or second candle.
  • Price rejection by engulfing type 2 – If true, more loosely defined engulfing rejection is enabled, also in combination with fractal. In this case it is used same ratio, but condition is applied on last two candles, instead of one as in case of engulfing type 1.
  • Engulfing ratio – Ratio of last candle’s body to previous candle’s body (for engulfing type 2 this applies to sum of bodies of last two candles to previous candle body).
  • Fractal factor – Number of candles to the left and right, that must have higher low (lower fractal) or lower high (upper fractal) than fractal candle. E.g. for fractal factor 3 (which is on pictures of price rejections and trading signal above) – there are three candles with lower high to the left and to the right from fractal candle.
  • Previous rejection offset – This is used only for double rejection trading signal. Determines minimal distance(number of bars) between two price rejections for trading signal to be valid.
  • Double rejection trading signal enabled – true enables trading signal type double rejection.
  • Range rejection trading signal enabled – true enables trading signal type range rejection.

Range breakout

Controls action to be performed when day range is broken. Broken means that bar on higher timeframe closes above range maximum or below range minimum.

  • Higher timeframe confirming breakout – Timeframe for breakout confirmation.
  • Action on breaking of range max
    • Update zone – Market sentiment is changed to Buy (if it's not buy already) and all sell positions are closed. Range max is no longer valid. New trades are opened whenever trading signal occurs, but there is no condition for price position within range since there is no range anymore.
    • Disable trading – All sell trades are closed and opening of new ones is disabled until it is manually enabled in control panel.
  • Action on breaking of range min
    • Update zone – Market sentiment is changed to Sell (if it's not Sell already) and all buy trades are closed. Range min is no longer valid. New positions are opened whenever trading signal occurs, but there is no condition for price position within range since there is no range anymore.
    • Disable trading – All buy trades are closed and opening of new trades is disabled until it is manually enabled in control panel.

Slippage protection

This provides protection against market slippage - strong price movements in the period of high volatility and insufficient liquidity (typically caused by signifficant market fundamental data). This affects only open positions.

  • Time to apply protection – Time when protection should be applied during trading session. In 24 hour format and time zone of your broker.
  • Action to apply
    • Update stop loss – SL of open positions will be changed by Ratio to update size of SL: New SL = ratio * old SL.
    • Close all positions.

Control panel

Control panel is placed in right top corner in chart area. It provides basic info about current session and also enables to control EA's behaviour without reloading it.

It can by minimized/maximized by "-" placed in right side of control panel's top bar.

Most of the items in control panel corresponds directly to input parameters and their meaning is obvious. But there are some, that deserves extra attention.

  • End session action - corresponds to input parameter action on end of trading session.
  • Actual day loss - total day loss on trading account. Sum of all loss on actual trading account during trading session. Limit for absolute maximal day loss is set by input parameter Max day loss.
  • Target, Target 1 and Target 2 - This is absolute price set as a target for open position. Appers in control panel only if there is any open position. If partail profit is enabled, there two values for each open position (Target 1 and Target 2), if partial profit is disabled, only one value appears in control panel.
  • Following two items are visible only if Partial profit is enabled:
    • Move SL to open price - corresponds to input parameter Move SL of 2nd position to open price.
    • Move SL offset - corresponds to input parameter Move SL of 2nd position offset
  • Trail stop min - correspond to input parameter Minimal position size
  • Trail stop ratio - corresponds to input parameter Size of trailig stop
  • Items TS 2nd pos min and TS 2nd pos ratio are visible only if partial profit is enabled and relates to second position.
  • Slip. prot. time - time to apply slippage protection, corresponds to input parameter Time to apply protection.
  • Slippage prot. action - corresponds to input parameter Action to apply while Slippage protection ratio corresponds to Ratio to update size of SL.
  • Trading session - Indicates whether session is active with respect to defined start and end of trading session.
  • Trading - Enabled/Disabled. Toggle button to manually enable or disable trading.

Please note that control panel refreshs with new tick so there could be delays before updated value appears - especially during periods with low volatility.

Backtesting

Despite this EA requires fresh market data on daily basis, it is still possible to run backtest for multiple days. Instead of setting up EA for every single day by input parameters you can use csv file containing bulk market data for every day you want to run back test. This is enabled/disabled by input parameter Load market conditions from file. CSV file has to be placed in directory \Common\Files\ in metatrader installation root. Name corresponds to input parameter File name.

Structure of csv file:
[date:dd.mm.yyyy];[zone:buy|sell|cons];[range max];[range min]

01.09.2022;cons;1.0079;0.9971
02.09.2022;cons;1.0048;0.991
05.09.2022;sell;0.9936;0.9879
06.09.2022;cons;0.9971;0.9942
07.09.2022;cons;0.9929;0.9876
08.09.2022;buy;1.0033;0.9979
09.09.2022;buy;1.0084;1.0061

There is a sample csv test file attached containing market data for forex pair EURUSD in the period of 01/09/2021 - 31/01/2023. Data are based on H1 timeframe market analysis with EA operating on M15 timeframe with default parameters. Runnig DayTrader with this data set in Strategy tester might be best way to understand how DayTrader operates and also good basis for building your own test data set based on any market analysis strategy you want to implement.

Files:
test_file.csv  11 kb
Share it with friends: