ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Custom Support And Resistance Indicator For MT4 Forex

Updated on August 17, 2016

Please click on picture to see full size

Why use support and Resistance In Forex ?

Support and Resistance, I find to be the most reliable future prediction in the market place. Price tends to gravitate towards previous highs and previous lows. It offers a good area to watch for breaks and pull backs to create an entry. Similar to trend lines, price usually has a a difficult time penetrating these levels. Take a look at the picture to let your mind wrap around how price reacts to previous tops and bottoms/ highs and lows.  

MT4 Code for THE BEST Support and Resistance Indicator in Forex

To implement this indicator into your trading platform, I have provided the code below:

For those that need instructions:
1.Open up MetaEditor through the MT4 terminal
2.Click on "File" ---> New
3.Choose Customer Indicator
4. Click "Next"
5. Put in desired indicator name
6. Click "Next"
7. DO NOT select "Indicator in separate window"
8. Click "Finish"
9. Delete the generic code
10.Copy the code below
11. Paste the code
12. Compile it to make sure it has not errors/warning
13. Should be zero errors/warning
14. Save
15. Restart MT4 terminal ---> You should now have your new indicator under the custom indicator heading and able to attach it to any chart.

~If you would like an easier and faster way to put this MT4 code into your MT4 platform Scroll to the very very very bottom of this page. ~



Code ( I do not own this code/ indicator. This is an indicator that I personally use)

Copy everything below by left clicking and scrolling to the bottom of this code then press ctrl-c to copy selected code >>>>


//+------------------------------------------------------------------+

//| SUPRESMultiFrame.mq4 |

//| |

//| RD |

//+------------------------------------------------------------------+

#property copyright "RD"

#property link "marynarz15@wp.pl"

#property indicator_chart_window

#define MaxObject 1000

//---- indicator parameters

extern int TimeFrame=15;

extern int BarsMax=144;

extern int ExtDepth=13;

extern int ExtDeviation=1;

extern int ExtBackstep=5;

extern bool DeleteObjectsOnExit=true;

extern color LineColor1=RosyBrown;

extern color LineColor5=Aqua;

extern color LineColor15=DeepPink;

extern color LineColor30=PaleVioletRed;

extern color LineColor60=Red;

extern color LineColor240=DarkOrange;

extern color LineColor1440=DeepSkyBlue;

extern color LineColor10080=Lime;

//-----------------------

double ExtMapBuffer[];

double ExtMapBuffer2[];

int SUPRESCount=0;

int linewidth;

string NamePattern;

color LineColor;



//+------------------------------------------------------------------+

//| Delete objects |

//+------------------------------------------------------------------+

int DeleteSupRes()

{

int ObjectCount=ObjectsTotal();

string names[MaxObject];

for (int i=0; i<ObjectCount;i++)

names[i]=ObjectName(i);

for (i=0; i<ObjectCount;i++)

{

string objname=names[i];

objname=StringSubstr(objname,0,StringLen(NamePattern));

if (objname!=NamePattern || ObjectType(names[i])!=OBJ_TREND)

names[i]="";

}

for (i=0; i<ObjectCount;i++)

{

if (names[i]!="") {

ObjectDelete(names[i]);}

}

return(0);

}


//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

IndicatorBuffers(2);

SetIndexBuffer(0,ExtMapBuffer);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(0,0.0);

ArraySetAsSeries(ExtMapBuffer,true);

ArraySetAsSeries(ExtMapBuffer2,true);

switch (TimeFrame)

{

case 1: linewidth=1; LineColor=LineColor1; break;

case 5: linewidth=1; LineColor=LineColor5; break;

case 15: linewidth=1; LineColor=LineColor15; break;

case 30: linewidth=1; LineColor=LineColor30; break;

case 60: linewidth=1; LineColor=LineColor60; break;

case 240: linewidth=1; LineColor=LineColor240; break;

case 1440: linewidth=1; LineColor=LineColor1440; break;

case 10080: linewidth=1; LineColor=LineColor10080; break;

default: linewidth=1; TimeFrame=Period(); break;

}

NamePattern=DoubleToStr(TimeFrame,0)+" SUPRES ";

if (BarsMax<55) BarsMax=55;

DeleteSupRes();

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

if (DeleteObjectsOnExit) DeleteSupRes();

return(0);

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

int start()

{

int shift, back,lasthighpos,lastlowpos;

double val,res;

double curlow,curhigh,lasthigh,lastlow;

string objectname;

if(BarsMax==0) {BarsMax=Bars/2;}// return(0);

for(shift=iBars(NULL,TimeFrame)-ExtDepth; shift>=0; shift--)

{

val=iLow(NULL,TimeFrame,Lowest(NULL,TimeFrame,MODE_LOW,ExtDepth,shift));

if(val==lastlow) val=0.0;

else

{

lastlow=val;

if((iLow(NULL,TimeFrame,shift)-val)>(ExtDeviation*Point)) val=0.0;

else

{

for(back=1; back<=ExtBackstep; back++)

{

res=ExtMapBuffer[shift+back];

if((res!=0)&&(res>val)) ExtMapBuffer[shift+back]=0.0;

}

}

}

ExtMapBuffer[shift]=val;

//--- high

val=iHigh(NULL,TimeFrame,Highest(NULL,TimeFrame,MODE_HIGH,ExtDepth,shift));

if(val==lasthigh) val=0.0;

else

{

lasthigh=val;

if((val-iHigh(NULL,TimeFrame,shift))>(ExtDeviation*Point)) val=0.0;

else

{

for(back=1; back<=ExtBackstep; back++)

{

res=ExtMapBuffer2[shift+back];

if((res!=0)&&(res<val)) ExtMapBuffer2[shift+back]=0.0;

}

}

}

ExtMapBuffer2[shift]=val;

}


// final cutting

lasthigh=-1; lasthighpos=-1;

lastlow=-1; lastlowpos=-1;


for(shift=iBars(NULL,TimeFrame)-ExtDepth; shift>=0; shift--)

{

curlow=ExtMapBuffer[shift];

curhigh=ExtMapBuffer2[shift];

if((curlow==0)&&(curhigh==0)) continue;

//---

if(curhigh!=0)

{

if(lasthigh>0)

{

if(lasthigh<curhigh) ExtMapBuffer2[lasthighpos]=0;

else ExtMapBuffer2[shift]=0;

}

//---

if(lasthigh<curhigh || lasthigh<0)

{

lasthigh=curhigh;

lasthighpos=shift;

}

lastlow=-1;

}

//----

if(curlow!=0)

{

if(lastlow>0)

{

if(lastlow>curlow) ExtMapBuffer[lastlowpos]=0;

else ExtMapBuffer[shift]=0;

}

//---

if((curlow<lastlow)||(lastlow<0))

{

lastlow=curlow;

lastlowpos=shift;

}

lasthigh=-1;

}

}

for(shift=iBars(NULL,TimeFrame)-1; shift>=0; shift--)

{

if(shift>=iBars(NULL,TimeFrame)-ExtDepth) ExtMapBuffer[shift]=0.0;

else

{

res=ExtMapBuffer2[shift];

if(res!=0.0) ExtMapBuffer[shift]=res;

}

}

///////////////////////// Lines creation /////////////////

int count=0;

double TempBufferPrice[MaxObject];

int TempBufferBar[MaxObject];

string ObjectNames[MaxObject];

//////////////////////// lists of lines //////////////////

for(shift=BarsMax; shift>0; shift--)

if (ExtMapBuffer[shift]>0)

{

count++;

TempBufferPrice[count-1]=ExtMapBuffer[shift];

TempBufferBar[count-1]=shift;

}

for(int i=0; i<count; i++)

ObjectNames[i]=/*TimeFrame+"m S/R("+i+")"+DoubleToStr(TempBufferPrice[i],Digits)+" "+*/

TimeToStr(iTime(NULL,TimeFrame,TempBufferBar[i]),TIME_DATE|TIME_MINUTES);


/////// deleting pending objects ///////////////

int ObjectForDeleteCount=0;

string ObjectsForDelete[MaxObject];

for(i=0; i<ObjectsTotal(); i++)

{

objectname=ObjectName(i);

if (StringSubstr(objectname,0,StringLen(NamePattern))==NamePattern)

{

ObjectForDeleteCount++;

ObjectsForDelete[ObjectForDeleteCount-1]=objectname;

}

}

for(i=0; i<count-2; i++)

{

objectname=ObjectNames[i];

for(int j=0; j<ObjectForDeleteCount; j++)

if(ObjectsForDelete[j]==objectname)

{

ObjectsForDelete[j]="";

break;

}

}

for(j=0; j<ObjectForDeleteCount; j++)

if (ObjectsForDelete[j]!="")

{

ObjectDelete(ObjectsForDelete[j]);

}

////////////// objects plotting /////////////////

for(i=0; i<count; i++)

{

if (ObjectFind(ObjectNames[i])==-1)

{

ObjectCreate(ObjectNames[i],OBJ_TREND,0,iTime(NULL,TimeFrame,TempBufferBar[i]),TempBufferPrice[i],

iTime(NULL,TimeFrame,TempBufferBar[i])+10080*60,TempBufferPrice[i]);

ObjectSet(ObjectNames[i],OBJPROP_WIDTH,linewidth);

ObjectSet(ObjectNames[i],OBJPROP_COLOR,LineColor);

ObjectSet(ObjectNames[i],OBJPROP_RAY,True);

ObjectSetText(ObjectNames[i],ObjectNames[i]/*+" "+DoubleToStr(TempBufferPrice[i],Digits),8,"Courier",LightSteelBlue*/);

}

}

}



<<<<<< END OF CODE, PRESS CONTROL (ctrl) -C to copy highlighted code

Write Articles, Make Money

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The QUICK way to put a new code into your MT4 platform! 

Click on the MetaEditor button at the top of the MT4 platform.  This will bring up the code box.  It's the yellow diamond shape with the " ! " inside it.
Click on the MetaEditor button at the top of the MT4 platform. This will bring up the code box. It's the yellow diamond shape with the " ! " inside it.
Click inside the code box and press ctrl-a to select all of the code. Then press delete so we have an empty code box.
Click inside the code box and press ctrl-a to select all of the code. Then press delete so we have an empty code box.

My quick tutorial for you, on how to upload. please look at and read the pictures above first

This was recorded with my cellphone, so pardon the horrible sound and crappy video quality.

Comments

    0 of 8192 characters used
    Post Comment

    • Midasfx profile imageAUTHOR

      Midasfx 

      3 years ago

      @ Ric, I do have some more indicators. I plan on making some new hubs for these special indicators. If I have time I will post them so stick around. Also, I have uploaded a few of them already on www.kaizen.devhub.com That is my personal FX website with some good tips and the indicators I use for trading Forex. Hope the best to you, good luck trading!

    • profile image

      Ric 

      3 years ago

      Hey Thank you!! This is exactly what I was looking for. BTW, do you have any more indicators (like this) that you use? I saw and downloaded the MT4 HMA indicator and the Pivot point indicators from your website www.kaizen.devhub.com So far they are working great on the charts!

    • profile image

      fxwess 

      6 years ago

      is it possible to code this to enable the s and r lines appear as i scroll all time frames

    • profile image

      Mr.MaginCole 

      6 years ago

      Been eyeing this indicator for 2 days now and following your comments on FFs EURUSD. What time frame do you use it on?

    • giaodichforex profile image

      giaodichforex 

      7 years ago from Viet Nam

      thank for sharing

    • profile image

      Forex News 

      7 years ago

      Good luck to all you newbie traders, if you stick with it you really can make a lot of money - trust me!

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)