Last Version - 5.80
No Nonsense ATR is a tool designed to help NNFX Traders backtest strategies and trading in real time.
The indicator calculates the value of the SL/TP based on the ATR, allowing you to verify the historical data in a simple and practical way, showing not only the SL/TP values but also the levels at which they would be set and whether a trade would result in a gain or a loss. The No Nonsense ATR also calculates the trading volume required for each trade according to the desired risk, using the SL and the account currency for the calculation, thus giving a more accurate value.
Listed below are the necessary steps to start using the No Nonsense ATR:
Installation
Features
iCustom
Troubleshooting
Download:
Installation:
The No Nonsense ATR installation is exactly like any other indicator.
Features:
The No Nonsense ATR offers several inputs to suit an individual trader's preferences.
Filtered ATR: Setting FILTER ATR? to "true" allows you to filter out extreme events that affect the ATR value, such as the flash crash of January 3, 2019. Extreme events are detected if the candle size is greater than the "STANDARD DEVIATION MULTIPLIER" * Standard deviation (sigma σ) + the average ATR. The average ATR is calculated for the number of candles placed in the input "SAMPLE SIZE". If an extreme event is detected, the candle size value is replaced by the average ATR on that candle thus creating the filtered ATR.
Live Mode: The Live Mode is designed to make it easier to use the indicator when trading in real time. In this mode, the values of SL/TP and trading volume are always fixed to the most recent value. This mode can be activated in two ways: by clicking on the area without candles in the right part of the graph (another click to disable the live mode) or changing the input "LIVE MODE" to true.
Trading Volume: The No Nonsense ATR can be configured to show the trading volume of the 36 main forex pairs (USD, EUR, GBP, CHF, AUD, CAD, NZD, JPY, SGD), by changing the input "SHOW TRADING VOLUME" to "ONLY ON LASTEST CANDLE" or "ALWAYS". This feature is exclusively for real-time trading and not for backtesting, with or without simulators, because the trading volume calculation uses the current account value (balance, equity free margin or fixed value) and does not check the past value or the simulator account's balance. You can choose between account balance, account equity, account free margin or a fixed amount. If you choose a fixed value, place it in the "ACCOUNT_FIXED_VALUE" input.
It is possible to select the currency of your account, making the calculation of trading volume more precise. If you select "COUNTER CURRENCY" then the calculation is made with the account base currency equal to the counter currency of the pair you are trading. If you select a currency you have to enter the suffix and/or the prefix of the other forex symbols in the "CURRENCY_SUFFIX" and "CURRENCY_PREFIX" respectively. For example, if the names of the forex pairs are "GBPUSDpro", "EURUSDpro" Put the word "pro" in the input "CURRENCY_SUFFIX".
You can select the trading volume value resolution up to 5 decimal places in the input "TRADING VOLUME RESOLUTION". The AUTO option sets the automatic resolution according to the trading account settings.
iCustom:
The No Nonsense ATR offers 3 buffers. The NNFX_SL (SL), the NNFX_TP (TP), and the NNFX_TRADING_VOL (trading volume), which can be read externally through the function iCustom.
Note: The buffer NNFX_TRADING_VOL cannot be read when the input TRADING_VOLUME=2 ("NEVER" option)
Examples:
- Save the SL value of the previous candle in the variable SL
double SL=iCustom(NULL,0,"No_Nonsense_ATR",14,1.0,14,1.5,0,0,"==========================",False,3.0,200,"==========================",false,0,14,Gold,Gold,false,Black,"==========================",false,false,false,false,false,0,DeepSkyBlue,0,Red,"==========================",2,1,0,0,0.0,"","",0,"==========================",false,0,0,1);
- Save the Filter TP value of the current candle in the variable TP
double TP=iCustom(NULL,0,"No_Nonsense_ATR",14,1.0,14,1.5,0,0,"==========================",True,3.0,200,"==========================",false,0,14,Gold,Gold,false,Black,"==========================",false,false,false,false,false,0,DeepSkyBlue,0,Red,"==========================",2,1,0,0,0.0,"","",0,"==========================",false,0,1,0);
- Save the trading volume value (account currency = EUR and Risk = 3%) in the variable VOL
double VOL=iCustom(NULL,0,"No_Nonsense_ATR",14,1.0,14,1.5,0,0,"==========================",False,3.0,200,"==========================",false,0,14,Gold,Gold,false,Black,"==========================",false,false,false,false,false,0,DeepSkyBlue,0,Red,"==========================",0,3,2,0,0.0,"","",2,"==========================",false,0,2,0);
Troubleshooting:
Most errors can be resolved by simply changing the indicator inputs. In case of error, a general message will appear in the chart. To know more details about an error, check the Experts tab.
(E01) This is not one of the 36 forex pairs and it is not possible to show the trading volume value. The calculation of trading volume is not possible outside the main 36 pairs if a base currency of the account is chosen in the input "ACCOUNT BASE CURRENCY". If "COUNTER CURRENCY" is selected, the error will no longer show but the value of the trading volume will not have been tested, so use with caution. Turning off this function by changing the input "SHOW TRADING VOLUME" to "NEVER" will also solve the problem.
(E02) The "symbol name" pair does not exist or it is not possible to obtain the price. Offline graph? Select COUNTER CURRENCY as ACCOUNT BASE CURRENCY. This error occurs when the user has selected their "ACCOUNT BASE CURRENCY" and there is not enough data to calculate the trading volume. To solve the problem, make sure the inputs "CURRENCY PREFIX" and "CURRENCY SUFFIX" are correct. If you are using a simulator then it may not be possible to obtain the necessary data to calculate the trading volume. In this case, select "COUNTER CURRENCY" in the input "ACCOUNT BASE CURRENCY" or turn off this function by changing the input "SHOW TRADING VOLUME" to "NEVER".
(E03) Could not get STEP LOT ("step lot value"), MIN LOT ("min lot value") and MAX LOT ("max lot value") size value. You will probably be using an offline simulator or graphics when this error appears. In this case it is not possible to use the "AUTO" option in the "TRADING VOLUME RESOLUTION" input; you need to select another resolution.
(E04) The value of the calculated trading volume ("trading volume value"=~"trading volume value rounded") is bigger than the maximum allowed by the broker ("max lot value by broker"). This error occurs when the calculated value of the trading volume is outside the range allowed by the broker. In this case the value of the trading volume cannot be used to trade and the error appears. Check if you have your selected currency in the input "ACCOUNT BASE CURRENCY". You can also solve the problem by selecting a resolution in the input "TRADING VOLUME RESOLUTION" (not the AUTO option), which will bypass this check.
(E05) The value of the calculated trading volume ("trading volume value"=~"trading volume value rounded") is smaller than the minimum allowed by the broker ("min lot value by broker"). Like the E04 error, this error occurs when the calculated value of the trading volume is outside the range allowed by the broker. In this case the value of the trading volume cannot be used to trade and the error appears. Check if you have your selected currency in the input "ACCOUNT BASE CURRENCY". You can also solve the problem by selecting a resolution in the input "TRADING VOLUME RESOLUTION" (not the AUTO option), which will bypass this check.
(E06) Are not there enough candles in the chart? ("number of bars") Maybe reloading the indicator will solve the problem. This error can occur when the indicator loads faster than the graph, in which case the indicator does not have enough candles to make the necessary calculations and produces this error. Changing the number of candles in the MT4 chart may help to prevent this problem from recurring. Resetting the indicator or changing the Time Frame can also solve the problem.
(E07) You need more candles to calculate the number of values you want ("number of bars">"number of bars to calculate"). If you are using Filtered ATR then decrease the SAMPLE SIZE. This error can occur when there are not enough candles to calculate the required values. To solve it, reduce the number of candles in the input "LOOKBACK CANDLES". If you are using the filtered ATR function, reducing the value in the "SAMPLE SIZE" input may also solve the problem.
(E08) The N OF HISTORY BARS ("number of bars") can not be higher than the number of candles available in the chart ("number of bars available in the chart")! There are not enough candles in the chart to make the calculations needed for the number of candles requested by the user. Decrease the number of candles in the input "LOOKBACK CANDLES" to solve the problem.
(E09) The SAMPLE SIZE ("sample size value") can not be higher than the number of candles available in the chart ("number of bars available in the chart")! Decrease the number of candles on the "SAMPLE SIZE" input, or turn off the filtered ATR function on the "FILTER ATR" input and the error should disappear.
(E10) There must be at least "number of bars to calculate" candles available to calculate the filtered ATR! Candles available in the chart = "number of bars available in the chart". Filtered ATR calculation requires more candles than normal ATR calculation. If there are not enough candles in the chart this error appears. To resolve it, increase the number of candles in the input "LOOKBACK CANDLES". If this is not possible, decrease the value in the input "SAMPLE SIZE".
(E11) ATR SHIFT cannot be a negative value (ATR SHIFT= "ATR_SHIFT" ). Put zero or a positive value in the input "ATR SHIFT".
Copyright and License:
No Nonsense ATR is open source software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0
You can download the source code here.
No Nonsense ATR was made available in the hope that it will be useful for traders, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License v3.0 for more details.