Whitebox Strategy Engine ยป Position Entry Settings


The Position Entry Settings allow you to customise how the strategy enters positions.

Position Entry Settings Overview

Enable Long / Short Entries

With the "Enable Long Entries" and "Enable Short Entries" checkboxes, you can instruct the strategy to take only long or short positions or both.

Enable Long / Short Entries

Please note that the strategies will have only a single active position at any given time. If you are in a long or short position, the strategy will not open a new position until the currently active position closes. There is no way to change this behaviour (not even via the Pyramiding settings under the Properties tab).

Entry Type Settings

In this section, you can configure the type of entry order the strategy should use.

Entry Type Settings

Entry Type

The Entry Type dropdown allows you to select the type of entry order the strategy should use when opening positions:

  1. Market: As soon as the entry criteria are valid, place a market order and enter the position immediately

    Market Entry

  2. Limit: Once the entry criteria are valid, place a pending limit entry order (below the current price for longs, above the current price for shorts). The price level to place the order can be configured via the Entry Strategy settings. Please see below.

    Limit Entry

  3. Stop: Once the entry criteria are valid, place a pending stop entry order (above the current price for longs, below the current price for shorts). The price level to place the order can be configured via the Entry Strategy settings. Please see below.

    Stop Entry

Entry Strategy

For "Limit" and "Stop" entries, you can configure the price level where to place the entry order.

(Note: for "Market" orders, it doesn't make sense to configure an entry price as the position is entered on the candle open price right after the entry criteria are valid).

You can choose from the following strategies for calculating the Limit / Stop entry price:

  1. ATR Based: The entry will be submitted at the current price plus / minus the ATR, depending on the Entry Type and the direction of the trade. The ATR itself can be configured via the "ATR Length" and "ATR Multiplier" inputs.
  2. % based: The entry will be submitted at the current price plus / minus the given percentage, depending on the Entry Type and the direction of the trade. The % can be set via the "%" input.
  3. Tick based: The entry will be submitted at the current price plus / minus the given amount of ticks, depending on the Entry Type and the direction of the trade. The number of ticks can be configured via the "Ticks" input.
  4. Wick based: The entry will be submitted at the wick of the candle. Whether it is at the high or the low of the candle, depends on the Entry Type and the direction of the trade.
  5. Pivot based: The entry will be submitted at the last pivot low or pivot high, depending on the Entry Type and the direction of the trade. How the pivots are detected can be configured via the "Pivot Lookback" and "Pivot Include Last Candle" inputs.

Order Fill Max. Wait (Bars)

Most of the time you don't want to wait very long for limit and stop entries to be filled. While an order is waiting to be filled, the strategy is not looking for new entries. By setting a number in this input you can configure the maximum number of bars the strategy should wait before cancelling an unfilled pending entry order.

Restrict Entries To Date Range

If you want the strategy to run the backtest on a certain period in the past, you can enable the restrict entries to date range checkbox:

Restrict Entries To Date Range

For example, using the settings above, the strategy would not look for entries before the 1st January 2021 or after the 1st January 2099. To help you visualise where these date boundaries are, the strategy will plot a yellow vertical bar at the start and at the end of the period.

Please note that the strategy can only backtest on data TradingView has made available to you. The amount of bars available to you to backtest on depends on your TradingView subscription.

For example, if you have a free subscription, TradingView will give you access to 5000 historic bars. On a 1 hour chart, that means that the strategy can only backtest on 5000 hours worth of price data, which is about 208 days. On a 1 minute chart, it will be 5000 minutes, which is about 3.5 days.

Setting the 'Start' date to 2 years ago for example, will not magically give you access to 2 years worth of price data. Therefore make sure, that the start date you set, is after the first available historic bar, otherwise the start date restriction will have no effect whatsoever.

Restrict Entries To Days And Time Range

By enabling this checkbox, you can instruct the strategy to only enter into a position on given days between the given time range.

Restrict Entries To Days And Time Range

The days can be set using the following numbers:

  • 1 - Sunday
  • 2 - Monday
  • 3 - Tuesday
  • 4 - Wednesday
  • 5 - Thursday
  • 6 - Friday
  • 7 - Saturday

Note that the first day of the week is Sunday (1).

Some examples:

  • 1234567 - Sunday to Saturday (every day)
  • 23456 - Monday to Friday (weekdays)
  • 17 - Sunday, Saturday (weekends)
  • 246 - Monday, Wednesday, Friday
  • 1 - Sunday (single day)

To specify the time interval to trade each day, you can set a start and an end time in the time selector inputs next to "Between".

Note that the start time is exclusive. For example, on a 1 hour chart this means that if you set the start time to 10:00, positions will only be entered from 11:00. If you want to open positions from 10:00, you should set the start time to one bar earlier at 09:00. Always take the chart's time frame into account, i.e. on a 1 hour time frame, setting the start time to 09:59 will not result in positions being entered from 10:00, only from 11:00.

Also note that the time you set will be in the timezone of the exchange. For example, if the exchange you trade on runs on 'UTC' time, and you have your chart's timezone set to 'UTC-7', when you set a time frame of 10:00-15:00, you will find that trades are not entered according to your chart's timezone (UTC-7), but the exchange's timezone (UTC). The green and red vertical bars plotted on the chart also helps you see this: the start (green) is plotted at 03:00 am and the end (red) is plotted at 08:00 am. If you would rather want to trade between 10:00 and 15:00 according to the chart's timezone, you would have to set the start time to 17:00 and the end time to 22:00.

Skip Entry If Estimated Commission > Estimated Profit

When you use the strategy on a lower timeframe (< 3 min), often the stop loss is placed very close to the entry price, resulting in the take profit to be near the entry price too.

With this checkbox enabled, the strategy will compare the estimated profit to the estimated commission (trading fees), and if it finds that the commission you will pay is greater than the profit you would get, it will skip the entry in order to save you from unnecessary losses.

Skip Entry If Estimated Commission > Estimated Profit

Please note that you will still need to configure the 'Commission' via the 'Properties' tab. This section here is only for skipping entries that would result in a loss.

Also note that you must enable "Activate Custom 'Order Size' Settings" in the settings below for this functionality to work.

Skip entry if previous trade's unrealised profit reaches %

Skip entry if previous trade's unrealised profit reaches %

If enabled, the strategy will keep track of the max. unrealised profit % of any active position, and the next position will only be opened, if the max. unrealised profit % is below the configured % limit.

For example, if you enable this and set the limit to 10%, once the currently active position's unrealised profit reaches 10% or above, the next entry will be skipped automatically. (It is only a single entry that will be skipped).

Note: the current trade's max. unrealised profit % is only updated once per bar close, therefore if the price shoots up momentarily in the middle of a candle, that is not going to affect the max. unrealised profit %.

Reverse Entries

Reverse Entries

Have you ever wondered what would happen if you were to take a short position whenever a long entry is signalled, and take a long position whenever a short entry is signalled?

Well, wonder no more! With this checkbox enabled you can tell the strategy to do exactly that.