Support/Resistance Indicator

Post Reply
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: Support/Resistance Indicator

Post by lucklogic »

Hi,

Great indicator and thank you for sharing

Do you have any code or know of others code that can be used with an EA to correctly report the nearest S&R zones to the current price action and there attributes :D

What I'd like to be able to do is have the EA examine the price level of the nearest resistance bottom and the price level of the nearest support top, as well as being able to read the current strengths of the S&R zones.

I have code that does this, within a S&R zone, when price action crosses into the zone

Many thanks in anticipation of your help :ugeek:
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

Re: Support/Resistance Indicator

Post by mobthehop »

lucklogic, not sure but this should put you in the right direction..... http://www.stevehopwoodforex.com/phpBB3 ... 159#p56159

Have put the code snippet into mq4 for myself to keep in my archive - see attached

Hope this helps
You do not have the required permissions to view the files attached to this post.
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: Support/Resistance Indicator

Post by lucklogic »

Looks like it is along the right lines, certainly THANK YOU v.much that's appreciated :ugeek:


However that code is for incorporating the whole of the indicator into an EA and that's not what I'm after

Here is the code to recognise when price action crossed into a zone

Code: Select all

 // this will find when the rectangle blocks are crossed .
                       double srcount=GlobalVariableGet("SSSR_Count_"+Symbol()+Period() );
                        if(srcount== 0)Print (" ERROR getting SS_SupportResistance values. Check indicator");
                      double   lasthigh=0,lastlow=0, hits=0 ;
                      int  number=0;
                 //      Print (" srcount ", srcount );
                        for(int i=srcount-1;i>=0;i--)
                        {
                        strenght=GlobalVariableGet("SSSR_STRENGTH_"+Symbol()+Period()+i);
                        lasthigh=GlobalVariableGet("SSSR_HI_"+Symbol()+Period()+i);
                        lastlow=GlobalVariableGet("SSSR_LO_"+Symbol()+Period()+i);
                        hits=GlobalVariableGet("SSSR_HITS_"+Symbol()+Period()+i);
                      //  Print (" high, low , strength ",Symbol()," ", lasthigh," ",lastlow," ",strength, " ", i);
                        if( Close[0]>lastlow && Close[0]<lasthigh){
                        number=i; 
                   //    Print (" Nearest SR zone found.", number);
                        // if(hits>1){maxstrength=strength;number=i;
                        break;}   
                        else 
                        number = -1;
                        
                        }
                           lasthigh=GlobalVariableGet("SSSR_HI_"+Symbol()+Period()+number);
                           lastlow=GlobalVariableGet("SSSR_LO_"+Symbol()+Period()+number);
                           strenght=GlobalVariableGet("SSSR_STRENGTH_"+Symbol()+Period()+number); 
What I need is v.similar to the above, it should examine the global variables in order to determine which S&R zone are the nearest to the price action and then be able to report the price levels of the nearest support top and nearest resistance bottom, strenght etc

Or it probably can it be done using Baluda code that incorporates the indicator in an EA but that is beyond my pay grade to understand :lol:

Can anybody do this via either method and share the code, pretty please. :ugeek:
dudest
Trader
Posts: 1847
Joined: Tue May 08, 2012 2:37 pm

Re: Support/Resistance Indicator

Post by dudest »

How's this?

Code: Select all

SSSRAlert=GlobalVariableGet("SSSR_Alert_"+Symbol()+Period());
     	
if(SSSRAlert!=0)
{
  SSSRAlertZone=GlobalVariableGet("SSSR_Alert_Zone_"+Symbol()+Period());
  strength=GlobalVariableGet("SSSR_STRENGTH_"+Symbol()+Period()+SSSRAlertZone);
  lasthigh=GlobalVariableGet("SSSR_HI_"+Symbol()+Period()+SSSRAlertZone);
  lastlow=GlobalVariableGet("SSSR_LO_"+Symbol()+Period()+SSSRAlertZone);
  hits=GlobalVariableGet("SSSR_HITS_"+Symbol()+Period()+SSSRAlertZone);
  ..
  ..
Attached: magft's mod of ver 4b that provides alerts being read in code above

Cheers
You do not have the required permissions to view the files attached to this post.
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: Support/Resistance Indicator

Post by lucklogic »

dudest wrote:How's this?

Code: Select all

SSSRAlert=GlobalVariableGet("SSSR_Alert_"+Symbol()+Period());
     	
if(SSSRAlert!=0)
{
  SSSRAlertZone=GlobalVariableGet("SSSR_Alert_Zone_"+Symbol()+Period());
  strength=GlobalVariableGet("SSSR_STRENGTH_"+Symbol()+Period()+SSSRAlertZone);
  lasthigh=GlobalVariableGet("SSSR_HI_"+Symbol()+Period()+SSSRAlertZone);
  lastlow=GlobalVariableGet("SSSR_LO_"+Symbol()+Period()+SSSRAlertZone);
  hits=GlobalVariableGet("SSSR_HITS_"+Symbol()+Period()+SSSRAlertZone);
  ..
  ..
Attached: magft's mod of ver 4b that provides alerts being read in code above

Cheers

Thanks for that, but this is only showing when a zone is being entered, in the same way as the code that I provided. It does not show how far the price action is away from the nearest Support Bottom and Resistance top, the values that I'm interested in. :cry:

But thanks again :ugeek:
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: Support/Resistance Indicator

Post by slipshod »

Ok, I've packaged the core functionality of the indicator into a library, which is now downloadable from the first post in the thread. No more need for iCustom() or global variables to access S/R zone info.

Instructions for how to install and use the library are included in the zip.
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: Support/Resistance Indicator

Post by dietcoke »

slipshod wrote:Ok, I've packaged the core functionality of the indicator into a library, which is now downloadable from the first post in the thread. No more need for iCustom() or global variables to access S/R zone info.

Instructions for how to install and use the library are included in the zip.
That's fantastic.
Image
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: Support/Resistance Indicator

Post by lucklogic »

slipshod wrote:Ok, I've packaged the core functionality of the indicator into a library, which is now downloadable from the first post in the thread. No more need for iCustom() or global variables to access S/R zone info.

Instructions for how to install and use the library are included in the zip.

Thank you v.much for your continuing efforts and for sharing :D
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: Support/Resistance Indicator

Post by slipshod »

You're most welcome, I do hope its useful. Of course if anyone comes across any errors/bugs or has suggestions for additional functions in the API, please don't hesitate to post them here or PM me.
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: Support/Resistance Indicator

Post by lucklogic »

slipshod wrote:Ok, I've packaged the core functionality of the indicator into a library, which is now downloadable from the first post in the thread. No more need for iCustom() or global variables to access S/R zone info.

Instructions for how to install and use the library are included in the zip.

Hi, Sorry to appear a bit thick but i dont understand the instructions! :?

1) what does this call mean - example pls
In your EA's init() function, add a call to SSSR_Settings() with your preferred values
for how the library should calculate S/R levels. These should be the same as your
settings for the SS_SupportResistance_vX indicator.

2) Example pls of this call :
Where required in your EA, call SSSR_FindZone() with the following arguments:-

direction - must be either SSSR_UP or SSSR_DN. If SSSR_UP it looks for the nearest
resistance zone, SSSR_DN it'll look for a support zone.

3) Pls provide an example of how to determine the price action difference from the nearest support would be most appreciated. ie how many pips is the the price above the support top ???

Thanks in anticipation of you assistance :ugeek:
Post Reply

Return to “Indicators”