JagzFX One PIN allows a wide range of MT4 Custom Indicators to be used as PINs without the need to write any code. Could this be the Lord of the PINs?
Why I made the One PIN
The most common requests I receive are: 1) I’ve got this great indicator but I don’t know how to code, can you make it into a PIN for me? 2) Can you show me how to make my own PIN?
Whilst PINs are not super-difficult for experienced programmers, they do take time to code and even more time to testing and document. Sadly, I don’t have the hours in the day to answer every request. Then, a few weeks ago, I was playing with an EA that allowed the Custom Indicators to be configured through its settings panel, and I thought that this would be a great idea for a PIN: let people turn their fav indicator into a PIN without needing to write a single line of code.
The JagzFX One PIN v1.00 will work with trading dashboards such as EAX, TDESK and Mathias MADEA NextGen.
A bit about Buffers
Whilst I have tried to limit the amount of technical jargon needed to use this PIN, there are a few terms that might need explaining. The first of these is Buffers. Buffers are a feature in MT4 that allows an indicator to display lines, histograms and other chart information. Generally speaking, an indicator with a single-line will use just one buffer, and a two-line indicator will use two buffers, etc. Like many Buffers are numbered from zero, i.e. Buffer 0, Buffer 1, etc. So a single-line indicator such as RSI will usually use Buffer 0 (see Indicator window 1 in the image), and a two-line indicator, such as Stochastic, will use Buffer 0 for the Indicator or Main line and Buffer 1 for the Signal line (see Indicator window 2 in the image). The number of the buffer is also known as the Buffer Index.
One PIN reads the line values from these buffers, so we need to be able to tell it which buffers to use, and this is done using the settings Buffer A Index and Buffer B Index. By default these are set to 0 and 1, which will usually be the first two lines of an indicator, but there might be reasons to set these to other values which I will mention below.
One PIN Modes
One PIN v1.00 has eight modes, which is four basic types each with one option to compare the difference between values and a second option to check if the values have crossed.
Modes: Price versus Buffer A & Price cross Buffer A
These modes are used for indicators whose value is displayed on the main chart as price. An example is the Kaufman Adaptive Moving Averages (KAMA). The Close price of the candle is compared with the indicator value in Buffer A.
In versus mode, if the candle price is above the indicator value, a Long signal is produced, and if the Price is below the indicator level a Short signal is produced. In cross mode, if the candle price crosses from below to above the indicator a Long signal is produced, and if the price crosses from above the indicator to below it, a Short signal is produced. Long/Short signals can be swapped by setting the Reverse Output parameter to true.
Modes: Buffer A versus Level(s) & Buffer A cross Level(s)
These modes are used to compare the level of a single-line indicator (or one line from a multi-line indicator). Examples of this would be to check if an indicator is above or below a certain level, such as filtering trends (above or below zero level), filtering overbought/oversold levels, or looking for entry signals such as zero-crossing or reversals.
In these modes, two levels need to be set: the Long Level determines when a Long signal is generated and the Short Level determines when a Short signal is generated. Examples as follows:
- Above below zero (versus mode) or zero-cross (cross mode): Long Level=0, Short Level=0.
- RSI Overbought Oversold (versus mode): Long Level=80, Short Level=20.
- RSI Reversal (cross mode): Long Level=20, Short Level=80.
Whist only Buffer A is checked against the levels, the buffer index value can be set as needed. For example, to check for the MACD Main line crossing zero set Buffer A Index to 0, and to check for the MACD Signal line crossing zero you would set Buffer A Index to 1.
Modes: Buffer A versus MAofA & Buffer A cross MAofA
These modes are used to add a lagging value to single-line indicators (of one line of a multi-line indicator). The lagging value is similar to the signal line of indicators such as the MACD.
In these modes, the MA Period and MA Method (SMA,EMA, etc.) are set as required and value of the indicator is compared to the value of the MA.
Modes: Buffer A versus B & Buffer A cross B
These modes are for comparing the lines from a multi-line indictor such as the MACD or Stochastic. In versus mode the PIN will check if Buffer A is above Buffer B (Long signal) or below it (Short signal). In cross mode the PIN will check if Buffer A has crossed Buffer B up (Long signal) or crossed down (Short signal.
If the indicator has more than two buffers, Buffer A Index and Buffer B Index can be set to compare whichever two lines are required.
One PIN Settings
Sets the timeframe used by the indicator: M30, H1, etc.
Enter the name of the Custom Indicator exactly as it appears in the MT4 Navigator pane. You can only use Custom Indicators (not the MT4 built-in indicators). Custom Indicators are .exe files, installed into the MQL4\Indicators directory.
Depending on the type and number of parameters you want to set for your Custom Indicator, this bit can range from very simple to very complicated.
- To use the Custom Indicator’s default values, just leave the Indicator Parameters box empty
- Otherwise, enter the parameters you need (up to a maximum of ten), in the order required by the indicator. Separate each parameter with a comma but do not use spaces. e.g. 12,26,8 not 12, 26, 8.
(Tip, if you are unsure of the correct order, save the settings of the indicator as a set file, then open the set file with a text editor such as Notepad and you will be able to see the list of parameters. Some indicators may not have the option of having set files, but you can still find the parameters by saving your whole chart as a template and then opening the tpl file with a text editor.
- You can leave off parameters you don’t want to change, e.g. if your indicator has five parameters but you only want to change the first two then all you need is 15,32 for example. However, you must specify all the parameters before the one you want to change, so to change the third parameter to 5, you would also need to include parameters one and two, e,g, 12,26,5.
- Only numeric parameters are allowed.
- For Boolean values (true or false) use 1 or 0
- If the indicator uses Price modes, MA smoothing methods, etc. replace these with their numeric values, which you can find the standard MT4 constants here:
- You cannot use text-values (this is an MT4 coding limitation I ran into when passing externals to the iCustom function). But remember that you can leave off parameters that you do not need to change from defaults. Therefore, is a text-value occurs in the list after the parameters you need to set, just leave it off (you will also need to leave off any subsequent parameters). If the text-value occurs in the list before the parameters you want to change, it’s more difficult to deal with. See the Tip on modifying Custom Indicators further down this article.
Sets the Buffer comparison mode used by the PIN, see One PIN Modes (section above).
Long Level, Short Level
Set the threshold levels for Long and Short signals in the Levels modes, see One PIN Modes (section above).
MA Period, MA Method
Set the moving average smoothing period and smoothing method in modes MAofA modes, see One PIN Modes (section above).
Buffer A index, Buffer B index
Set which Custom Indicator buffers the PIN uses. Buffer B index is only used in the A versus B and A cross B modes. See One PIN Modes (section above).
Sets which candle the PIN takes its signals from. The current candle is 0, but since this candle and associated indicator values may update, signals from this candle may change (even for non-repainting indicators). Candle 1 should provide a stable signal for non-repainting indicators.
Sets the number of candles that a signal remains active. This is useful with the cross modes, where you want to allow time for other indicators to catch up and confirm the signal.
Swaps the direction of the signals generated by the pin, e.g. a cross-up (Long signal) becomes Short signal, and vice versa.
Tip: Modifying Custom Indicators to remove text parameters
For Customer Indicators with troublesome text parameters. If you have the source code for the indicator, it is usually possible to make modifications and hide the text parameters. e.g. suppose and indicator has this code relating to its input parameters:
extern string ModeStr="Mode: 0 - RSI, 1 - Stoch"; extern int Mode=0; extern int Length=9; extern int Smooth_Length=2; extern int Price=0;
The Custom Indicator is expecting a set of parameters like the list below, but the first parameter is a string of text, which will cause the PIN to fail:
"Mode: 0 - RSI, 1 - Stoch",0,9,2,0
However, the text is just a helpful comment that we never need to change, so we can ‘hide’ it by removing the extern modifier as follows:
string ModeStr="Mode: 0 - RSI, 1 - Stoch"; extern int Mode=0; extern int Length=9; extern int Smooth_Length=2; extern int Price=0;
Now ModeStr is no longer an extern value and we can ignore it and just pass the other values:
Download the JagzFX One PIN
One PIN Change Log
//+------------------------------------------------------------------+ //| JagzFX ONE PIN | //| Copyright 2021, JagzFX | //| https://jagzfx.com | //+------------------------------------------------------------------+ //| v1.00 First version