NO LINKS OR MQL SOURCE CODE REQUESTS. Please follow the rules.

Re: MT4 Indicator requests and ideas

Tue Feb 15, 2022 10:04 am
I have done as you suggested but it says error "input - unexpected token - line 37 column 8"
I copy and pasted exactly what I added on line 37 -
extern input ENUM_MA_METHOD MaMode = MODE_EMA;
Don't know what that means.
I hope you don't mind, I tried it and it works. Take out extern on line37
Hull moving average 2.0 & sr lines.ex4
(36.77 KiB) Downloaded 77 times
Hull moving average 2.0 & sr lines.mq4
(8.89 KiB) Downloaded 108 times

Re: MT4 Indicator requests and ideas

SpecialFX wrote:
Tue Feb 15, 2022 7:23 am
Dear sirs,

Could I please request ATR bands be added to this indicator? I realise I haven't supplied the source code, but the indicator came from this website (by mladen), so I'm hoping somebody here still has access to it...

Many thanks in advance.
Posted a version here

Re: MT4 Indicator requests and ideas

GoldenBrett90 wrote:
Tue Feb 15, 2022 9:02 am
Would it be asking too much to code this cosmetic idea of mine?
All I'm asking is to create a double-MA cloud from either the MA I've provided or an AllAverages MA indicator.
Then, code this new, popular "color background" idea, according to the MA cloud color-change.

For example, if both MA's of the cloud are signaling a buy, then a buy-colored background will appear, and vice-versa for a sell.
And if both MA's are conflicting with a buy & sell, then a neutral color will appear for the chart background.

This is a simple, yet effective concept for momentum trading & trading psychology, and to keep a clean chart.
Posted a version here

Re: MT4 Indicator requests and ideas

mrtools wrote:
Tue Feb 15, 2022 12:33 pm
Posted a version here
Looks great, but would it be too much work to do it in this way according to the screenshot, coding it with two MA's as a cloud?
This is a recent screenshot of US30 on M5, using periods 34 & 100 for the two MA's.
In the screenshot, I made arrows where both MA's are red for a sell background color, both MA's are blue for a buy background color, and where there's an area of disagreement with both a red & blue MA, where a neutral-colored background will be drawn.
My goal is to make advanced algorithm strategies, coded and simplified.
Trading psychology and ease-of-use are top priorities.


Re: MT4 Indicator requests and ideas

A_5 wrote:
Tue Feb 15, 2022 4:46 pm
Any chance that this trading view scrip can be converted to mt4?
Please no outside links

Code: Select all

study("MTF Order Block Finder", overlay = true, max_bars_back=22, max_lines_count = 500, max_labels_count= 500)
//## ToolTips
tip0 = "Instituational Order Blocks (OB) often signal the beginning of a strong move. There is a high probability that OB price levels will be revisited in the future. Bullish Order Block pattern is the last down candle before a sequence of up candles. Bearish Order Block pattern is the last up candle before a sequence of down candles." +
"Order Block sources are indicated by an upper, lower, and average line that preceeds the colored zone.\n\nConfused by a setting?\nHover over the ( i ) icon for a description."
tip1 = "Find Order Blocks from higher timeframes. Timeframes lower than the chart are ignored."
tip2 = "Required number of subsequent candles in the same direction to identify Order Block"
tip3 = "Reject Order Block patterns with a total % move less than this value. Measured from Close of the 1st candle to Close of the last candle in sequence. 0.30 = 0.30%"
tip4 = "Number of Zones to draw on chart. Higher numbers can lead to messy charts, especially if \"Order Block Draw Distance %\" is not configured!"
tip5 = "Reject Order Block patterns that start with a \"Doji\" which has a % move less than this value. Setting to zero requires the candle has moved at least one tick.\n0.05 = 0.05%"
tip6 = "Accept Order Blocks with an imperfect sequence. Any candle (after the first) with a % move less than this value will be accepted, regardless of its direction. Useful for accepting \"Doji\" candles that appear in the middle of a sequence. Setting to zero requires the candle has moved at least one tick.\n0.01 = 0.01%"
tip7 = "Reject Order blocks that are too far from current Open price. A value of 0 will disable this feature.\n2.5 = 2.5%"
//Style & Color
tip8 = "BOX = a solid, borderless rectangle colored to match the direction of the OB\n\nLINE = 3 lines representing the High, Low, and Average price of the OB source\n\nBOTH = draw both previous styles"
tip9 = "Line width when using the LINE drawing style"
exp1 = "Shift the source candle that is used for drawing Zones. Example: For a Bullish OB, a shift of zero selects the first candle of the pattern - the Bearish candle before a sequence of Bulls. Values higher than \"Order Block Required Length\" are ignored.\nDefault = 1 (selects 2nd candle)"
exp2 = "Choose the price values to extract from the Order Block candle. These prices are used to set the top and bottom of the Zone.\n\n\"High/Low\" = High and Low of OB Candle.\n\n\"OHLC\" = From the High/Low of the OB Candle to the Open/Close, whichever is in the direction of the OB.\n\n\"Context\" = Context sensitive algorithm. Picks the largest wick near the OB candle with a given search length"
exp3 = "When using \"Context\" for Order Block Source Selector, you can adjust the search length. Example: A search length of 2 will start with the 1st candle in the pattern and then check the following 2 candles. Values higher than \"Order Block Required Length\" are ignored."
exp4 = "Choose a Preset that overrides all previous settings. Presets come from real Day Trading experience in an attempt to provide clean charts, valuable information, and lots of trading opportunities!"

//Group Titles
gp1 = "Basic Configuration"
gp2 = "Advanced Configuration"
gp3 = "Style and Colors"
gp4 = "Experimental Settings"

doc = input(true,"Hover over ( ! ) for Intro", tooltip = tip0,group="Introduction")

//Basic Configuration (GP1)
resolution = input("","Order Block Timeframe",input.resolution,tooltip=tip1,group=gp1)
ob_period = input(5,"Order Block Required Length",maxval=20, minval=1,tooltip=tip2,group=gp1) // Required number of subsequent candles in the same direction to identify Order Block
threshold = input(0.3,"Order Block Required Move %", minval = 0,step = 0.05, tooltip=tip3,group=gp1) // Required minimum % move (from potential OB close to last subsequent candle to identify Order Block)
bull_channels = input(4,"Bullish Zones to Show",minval=0,tooltip=tip4,group=gp1) // Num of zones
bear_channels = input(4,"Bearish Zones to Show",minval=0,tooltip=tip4,group=gp1) // Num of zones

//Adv. Configuration (GP2)
doji = input(0.05,"1st Candle Filter",minval=0,step=0.005,tooltip=tip5,group=gp2) // Min size for first candle
fuzzy = input(0.01,"2nd+ Candle Filter",minval=0,step=0.005, tooltip=tip6,group=gp2) // Tolerance for rest of candles
near_price = input(0,"Order Block Draw Distance %",input.float,minval=0,step=.5, tooltip=tip7,group=gp2) // Distant candle rejection

//Style, Colors, and Drawing (GP3)
style = input("BOX","Zone Drawing Style",options=["BOTH","BOX","LINE"],tooltip=tip8,group=gp3)
bullcolor = input(,65),"Bullish Zone Color",input.color,group=gp3)
bearcolor = input(,65),"Bearish Zone Color", input.color,group=gp3)
linewidth_hl = input(1,"Line Width for Zone's High/Low",input.integer,minval=0,group=gp3,tooltip=tip9)
linewidth_avg = input(1,"Line Width for Zone's Avg",input.integer,minval=0,group=gp3,tooltip=tip9)

//Experimental (GP4)
ob_shift = input(1,"Order Block Candle Shift",input.integer,minval=0,tooltip=exp1,group=gp4)
ob_selector = input("OHLC","Order Block Source Selector",options=["High/Low","OHLC","Context"],tooltip=exp2,group=gp4)
ob_search = input(2,"Order Block Context Search Length",input.integer,minval=0,maxval=20,tooltip=exp3,group=gp4)
//preset = input("None","Asset Presets",options=["Crypto","Forex","Stock","None"],tooltip=exp4,group=gp4)

//Version Control
version = "1.504"
dummy1 = input(version,"\"MTF Order Block Finder\" Version #",options=[version],group="About")

//Input Sanitization & Adjustments
ob_search := ob_search >= ob_period ? ob_period : ob_search
ob_shift := ob_shift >= ob_period ? ob_period : ob_shift
ob_period += 1

//Convert a given string resolution into seconds
mins = res == "1" ? 1 :
res == "3" ? 3 :
res == "5" ? 5 :
res == "10" ? 10 :
res == "15" ? 15 :
res == "30" ? 30 :
res == "45" ? 45 :
res == "60" ? 60 :
res == "120" ? 120 :
res == "180" ? 180 :
res == "240" ? 240 :
res == "1D" ? 1440 :
res == "1W" ? 10080 :
res == "1M" ? 43200 : 0
ms = mins * 60

//Convert the current chart resolution into seconds
mins = 0.0
mins := timeframe.isdaily ? 1440 :
timeframe.isweekly ? 10080 :
timeframe.ismonthly ? 43200 : mins
mins := timeframe.isminutes ? 1 :
timeframe.isseconds ? (1/60) : mins
ms = round(mins * 60 * timeframe.multiplier)

//Given a source type, resolution, and warmup period;
//Return 1) an array of prices with gaps removed
// 2) a bool that is True when the given resolution has new data
max = security(syminfo.tickerid,res,bar_index,barmerge.gaps_off,barmerge.lookahead_off)
gap = security(syminfo.tickerid,res,src,barmerge.gaps_on,barmerge.lookahead_off)
clean = array.new_float()
if (na(max) or max < warm)
for i=0 to warm
if(not na(gap))
[clean,not na(gap)]

//Destroy distant Lines and remove from array
limit = source*percent/100
size = array.size(avg)
if(size > 0)
for i = 1 to size
if(abs(top-source)>limit and abs(bottom-source)>limit)

//Destroy distant Boxes and remove from array
limit = source*percent/100
size = array.size(arr)
if(size > 0)
for i = 1 to size
top = box.get_top(array.get(arr,size-i))
bottom = box.get_bottom(array.get(arr,size-i))
if(abs(top-source)>limit and abs(bottom-source)>limit)

//Returns the lowest wick of a data set and given search range
//A 'wick' is either: Low to Open, Low to Close
wick_h = float(na)
wick_l = float(na)
index = int(na)
for i = 0 to len
if(array.get(clow,start_index-i) > wick_l and i > 0)
bar_dir = sign(array.get(cclose,start_index-i) - array.get(copen,start_index-i))
wick_h := bar_dir == 1 ? array.get(cclose,start_index-i) : array.get(copen,start_index-i)
wick_l := array.get(clow,start_index-i)
index := i

//Returns the highest wick of a data set and given search range
//A 'wick' is either: High to Open, High to Close
wick_h = float(na)
wick_l = float(na)
index = int(na)
for i = 0 to len
if(array.get(chigh,start_index-i) < wick_h and i > 0)
bar_dir = sign(array.get(cclose,start_index-i) - array.get(copen,start_index-i))
wick_l := bar_dir == 1 ? array.get(copen,start_index-i) : array.get(cclose,start_index-i)
wick_h := array.get(chigh,start_index-i)
index := i

//Returns true if a candle has zero ticks (high, low, open, and close all equal)
base = array.get(o,index)
zc = base == array.get(c,index)
and base == array.get(h,index)
and base == array.get(l,index)

//Alert for new candle closing in order block

//Alert for new candle closing out of order block

//Alert for candle forming wick in order block

//Create a horizontal line spanning one bar


//Create a vertical line spanning two prices

//Create a colored label

//Create a colored label at a specific time
//Debugging Function to create label above candle in question

OB_bull = false
OB_bull_chigh = float(na)
OB_bull_clow = float(na)
OB_bull_avg = float(na)
OB_bear = false
OB_bear_chigh = float(na)
OB_bear_clow = float(na)
OB_bear_avg = float(na)
//Init Line Arrays
var LineBullAvg = array.new_line()
var LineBullHigh = array.new_line()
var LineBullLow = array.new_line()
var LineBearAvg = array.new_line()
var LineBearHigh = array.new_line()
var LineBearLow = array.new_line()
//Init Box Arrays
var BoxBull = array.new_box()
var BoxBear = array.new_box()
//MTF Sync vars
var selector_shift = ob_shift
var os = 0
var sync = 0
var start_time = 0
var end_time = 0
res = TimeframeToSec() > ResolutionToSec(resolution) ? "" : resolution
warmup = ob_period + iff(sign(ob_shift)==-1,-1*ob_shift,0)
mtf_warmup = res == "" ? warmup : warmup * ResolutionToSec(res)/TimeframeToSec()
//Data Curation
[copen,naopen] = Rem_Gaps_Security(open,res,mtf_warmup)
[chigh,nahigh] = Rem_Gaps_Security(high,res,mtf_warmup)
[clow,nalow] = Rem_Gaps_Security(low,res,mtf_warmup)
[cclose,naclose] = Rem_Gaps_Security(close,res,mtf_warmup)
[ctime,natime] = Rem_Gaps_Security(time,res,mtf_warmup)
nastate = naopen and nahigh and nalow and naclose and natime
//Array with least data
MinArraySize = min(array.size(copen),

//Despawn distant objects
if(near_price>0 and barstate.islast)
if(style=="LINE" or style=="BOTH")
if(style=="BOX" or style=="BOTH")

//Order Block Algorithm
if(MinArraySize > warmup)

//Entire OB sequence has enough price movement to be valid (filter low volatility noise)
relmove = 100*((abs(array.get(cclose,ob_period) - array.get(cclose,1)))/array.get(cclose,ob_period)) > threshold
//Can't start with a Doji (active by default)
doji_candle = 100*abs(array.get(cclose,ob_period)-array.get(copen,ob_period))/array.get(copen,ob_period) > doji

//Order Block Identification
bullishOB = array.get(cclose,ob_period) < array.get(copen,ob_period) // Determine potential Bullish OB candle (red candle)
bearishOB = array.get(cclose,ob_period) > array.get(copen,ob_period) // Determine potential Bearish OB candle (green candle)
int upcandles = 0
int downcandles = 0
for i = 1 to ob_period-1 // Check candles following the OB
float t_close = array.get(cclose,i)
float t_open = array.get(copen,i)
if(abs(100*(t_close - t_open)/t_open) < fuzzy)
upcandles := upcandles +1
downcandles := downcandles +1
if(t_close > t_open)
upcandles := upcandles +1
else if(t_close < t_open)
downcandles := downcandles +1

// Timeframe must have non-NaN data, Price action must be valid, Cannot be Doji
if(doji_candle and relmove and nastate)
OB_bull := bullishOB and (upcandles == (ob_period-1)) // Identification logic (red OB candle & subsequent green candles)
OB_bear := bearishOB and (downcandles == (ob_period-1)) // Identification logic (green OB candle & subsequent green candles)
if(ob_selector == "Context")
[temp_high,temp_low,index] = Low_Wick_Search(ob_period,ob_search,copen,clow,cclose)
selector_shift := index
OB_bull_chigh := temp_high
OB_bull_clow := temp_low
else if(ob_selector == "High/Low")
OB_bull_chigh := array.get(chigh,ob_period-selector_shift) //Determine OB upper limit (High)
OB_bull_clow := array.get(clow,ob_period-selector_shift) //Determine OB lower limit (Low)
else if(ob_selector == "OHLC")
[temp_high,temp_low,index] = Low_Wick_Search(ob_period-selector_shift,0,copen,clow,cclose)
OB_bull_chigh := temp_high
OB_bull_clow := temp_low
OB_bull_avg := (OB_bull_chigh + OB_bull_clow)/2 // Determine OB average
if(ob_selector == "Context")
[temp_high,temp_low,index] = High_Wick_Search(ob_period,ob_search,copen,chigh,cclose)
selector_shift := index
OB_bear_chigh := temp_high
OB_bear_clow := temp_low
else if(ob_selector == "High/Low")
OB_bear_chigh := array.get(chigh,ob_period-selector_shift) // Determine OB upper limit (High)
OB_bear_clow := array.get(clow,ob_period-selector_shift) // Determine OB clower limit (Low)
else if(ob_selector == "OHLC")
[temp_high,temp_low,index] = High_Wick_Search(ob_period-selector_shift,0,copen,chigh,cclose)
OB_bear_chigh := temp_high
OB_bear_clow := temp_low
OB_bear_avg := (OB_bear_clow + OB_bear_chigh)/2 // Determine OB average

//Create Zones based on user selection
sync := time_close(res) - (res=="" ? TimeframeToSec()*1000 : ResolutionToSec(res)*1000)
if(style=="LINE" or style=="BOTH")
//Bullish Channel Creation
if(OB_bull and bull_channels>0)
if array.size(LineBullAvg) == bull_channels
array.push(LineBullAvg, = sync, xloc=xloc.bar_time, y1 = OB_bull_avg, x2 = sync+12, y2 = OB_bull_avg, extend = extend.right, color = linewidth_avg>0?bullcolor:na, style = line.style_dashed, width = linewidth_avg))
array.push(LineBullHigh, = sync, xloc=xloc.bar_time,y1 = OB_bull_chigh, x2 = sync+12, y2 = OB_bull_chigh, extend = extend.right, color = linewidth_hl>0?bullcolor:na, style = line.style_solid, width = linewidth_hl))
array.push(LineBullLow, = sync, xloc=xloc.bar_time, y1 = OB_bull_clow, x2 = sync+12, y2 = OB_bull_clow, extend = extend.right, color = linewidth_hl>0?bullcolor:na, style = line.style_solid, width = linewidth_hl))
//Bearish Channel Creation
if(OB_bear and bear_channels>0)
if array.size(LineBearAvg) == bear_channels
array.push(LineBearAvg, = sync, xloc=xloc.bar_time, y1 = OB_bear_avg, x2 = sync+12, y2 = OB_bear_avg, extend = extend.right, color = linewidth_avg>0?bearcolor:na, style = line.style_dashed, width = linewidth_avg))
array.push(LineBearHigh, = sync, xloc=xloc.bar_time, y1 = OB_bear_chigh, x2 = sync+12, y2 = OB_bear_chigh, extend = extend.right, color = linewidth_hl>0?bearcolor:na, style = line.style_solid, width = linewidth_hl))
array.push(LineBearLow, = sync, xloc=xloc.bar_time, y1 = OB_bear_clow, x2 = sync+12, y2 = OB_bear_clow, extend = extend.right, color = linewidth_hl>0?bearcolor:na, style = line.style_solid, width = linewidth_hl))
if(style=="BOX" or style=="BOTH")
//Bullish Box Creation
if(OB_bull and bull_channels>0)
if array.size(BoxBull) == bull_channels
array.push(BoxBull,, left = sync, top = OB_bull_chigh, right = sync+12, bottom = OB_bull_clow, extend = extend.right, border_width=0, bgcolor = bullcolor))
//Bearish Box Creation
if(OB_bear and bear_channels>0)
if array.size(BoxBear) == bear_channels
array.push(BoxBear,, left = sync, top = OB_bear_chigh, right = sync+12, bottom = OB_bear_clow, extend = extend.right, border_width=0, bgcolor = bearcolor))

//Offset Calculation
var sync_mult = ResolutionToSec(res)/TimeframeToSec()
os := -(ob_period-selector_shift) * (res == "" ? 1 : sync_mult)
start_time := round(array.get(ctime,ob_period-selector_shift))
end_time := round(array.get(ctime,ob_period-selector_shift-1))
avg_time = round((start_time + end_time)/2)

//Custom Line/Label plotting
_bc =,0)
Create_Label("Bull OB",_bc,yloc.belowbar,label.style_none,os)
Horizontal_Line(OB_bull_chigh,_bc,2,os,os - sync_mult)
Horizontal_Line(OB_bull_clow,_bc,2,os,os - sync_mult)
Horizontal_Line(OB_bull_avg,_bc,1,os,os - sync_mult)
Create_Label_2("Bull OB",avg_time,OB_bull_clow,_bc,label.style_none)
_bc =,0)
Create_Label("Bear OB",_bc,yloc.abovebar,label.style_none,os)
Horizontal_Line(OB_bear_chigh,_bc,2,os,os - sync_mult)
Horizontal_Line(OB_bear_clow,_bc,2,os,os - sync_mult)
Horizontal_Line(OB_bear_avg,_bc,1,os,os - sync_mult)
Create_Label_2("Bear OB",avg_time,OB_bear_chigh,_bc,label.style_none)

//Alert Conditions
alertcondition(OB_bull or OB_bear, "New Order Block")
alertcondition(OB_bull,"New Bullish Order Block") //New OBs
alertcondition(OB_bear,"New Bearish Order Block")

Re: MT4 Indicator requests and ideas

Jackson Doh wrote:
Tue Feb 15, 2022 10:30 am
I hope you don't mind, I tried it and it works. Take out extern on line37
Hull moving average 2.0 &amp; sr lines.ex4Hull moving average 2.0 &amp; sr lines.mq4
Thanks - I did that and it did work - but only when I changed the speed from 2 to 1 did it get the correct ema settings.
It sorts out and gives me an indicator that has bugged me for over 20 years - I often wondered why it had not been made as it sorts out sideways movements of the price. THANK YOU.
I have renamed it for myself so to avoid confusion.
I am still not ever going to be a coder!!
All I need now is to sort out how to change the width of the horizontal lines......... never give up.
Most appreciated Mr Tools and Jackson Doh.
PS - this is how it looks - you now see why I love it.
US30sbM15 CLOSE UP.png

  1. Similar Topics

    1. Support Resistance strategy & Ideas

      19 Replies 9307 Views

      by sal, Sun Jul 18, 2021 10:29 pm in Trading Systems

      19 Replies
    2. Any ideas which "Volume" this is?

      7 Replies 1604 Views

      by ionone, Mon Jan 17, 2022 1:09 am in MT4 Indicators

      7 Replies
    3. Forex News Indicator MT4 and MT5

      3 Replies 2536 Views

      by pruso, Thu Aug 26, 2021 8:14 pm in Commercial Services

      3 Replies

Return to “MT4 Indicators”

Users viewing this forum: Abdi, bonbon123, camisa, CommonCrawl [Bot], direwolf, ffsss, IBM oBot [Bot], rudiarius, samuelkanu, SijjiN, TECHHDATE07, 太虚一毫 and 55 guests