stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Support/Resistance Indicator
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=514
Page 7 of 23
Author:  lucklogic [ Thu Apr 25, 2013 10:17 am ]
Post subject:  Re: Support/Resistance Indicator

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:
Author:  mobthehop [ Thu Apr 25, 2013 12:04 pm ]
Post subject:  Re: Support/Resistance Indicator

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
Author:  lucklogic [ Thu Apr 25, 2013 2:07 pm ]
Post subject:  Re: Support/Resistance Indicator

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:
Author:  dudest [ Thu Apr 25, 2013 3:41 pm ]
Post subject:  Re: Support/Resistance Indicator

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
Author:  lucklogic [ Thu Apr 25, 2013 7:39 pm ]
Post subject:  Re: Support/Resistance Indicator

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:
Author:  slipshod [ Mon Apr 29, 2013 10:20 am ]
Post subject:  Re: Support/Resistance Indicator

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.
Author:  dietcoke [ Mon Apr 29, 2013 12:04 pm ]
Post subject:  Re: Support/Resistance Indicator

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.
Author:  lucklogic [ Mon Apr 29, 2013 12:13 pm ]
Post subject:  Re: Support/Resistance Indicator

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
Author:  slipshod [ Mon Apr 29, 2013 1:29 pm ]
Post subject:  Re: Support/Resistance Indicator

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.
Author:  lucklogic [ Mon Apr 29, 2013 2:50 pm ]
Post subject:  Re: Support/Resistance Indicator

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:
All times are UTC Page 7 of 23