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

Support/Resistance Indicator
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=514
Page 8 of 23
Author:  slipshod [ Mon Apr 29, 2013 3:03 pm ]
Post subject:  Re: Support/Resistance Indicator

lucklogic wrote: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.
Ok, well you don't _need_ to call this function if you want the library to use the same default settings that SS_SupportResistance_v04c does. If you've used different settings for the indicator though, you'll probably want the library to work the same way & this is how you tell it what those settings are. Not sure how better I can explain it :? Here's a code example if it helps:-

Code: Select all

void init() {
   // the following tells the library to only calculate on the last 1000 bars (instead of 10,000),
   // to use a fuzzfactor of 1.0 instead of the default 0.9, and a fastfactor of 5 instead of 6.
   SSSR_Settings(1000, 1.0, true, true, 5, 3);
}
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.

Code: Select all

   // find the nearest resistance zone above the current price
   int zoneID = SSSR_FindZone(SSSR_UP, true, Bid);
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:

Code: Select all

   int zoneID = SSSR_FindZone(SSSR_UP, true, Bid);
   if (zoneID >= 0)
   {
      double zoneHi = SSSR_GetZoneHi(zoneID);
      double zoneLo = SSSR_GetZoneLo(zoneID);
      
      if (Bid > zoneLo)
      {
         // price is inside the zone
      }
      else
      {
          double distToResistance = zoneLo - Bid;
      }
   }
That's the distance in actual price terms, I'll leave it to you to work out how to convert it to pips ;)
Author:  lucklogic [ Mon Apr 29, 2013 3:16 pm ]
Post subject:  Re: Support/Resistance Indicator

slipshod wrote:
lucklogic wrote: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.
Ok, well you don't _need_ to call this function if you want the library to use the same default settings that SS_SupportResistance_v04c does. If you've used different settings for the indicator though, you'll probably want the library to work the same way & this is how you tell it what those settings are. Not sure how better I can explain it :? Here's a code example if it helps:-

Code: Select all

void init() {
   // the following tells the library to only calculate on the last 1000 bars (instead of 10,000),
   // to use a fuzzfactor of 1.0 instead of the default 0.9, and a fastfactor of 5 instead of 6.
   SSSR_Settings(1000, 1.0, true, true, 5, 3);
}
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.

Code: Select all

   // find the nearest resistance zone above the current price
   int zoneID = SSSR_FindZone(SSSR_UP, true, Bid);
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:

Code: Select all

   int zoneID = SSSR_FindZone(SSSR_UP, true, Bid);
   if (zoneID >= 0)
   {
      double zoneHi = SSSR_GetZoneHi(zoneID);
      double zoneLo = SSSR_GetZoneLo(zoneID);
      
      if (Bid > zoneLo)
      {
         // price is inside the zone
      }
      else
      {
          double distToResistance = zoneLo - Bid;
      }
   }
That's the distance in actual price terms, I'll leave it to you to work out how to convert it to pips ;)

Fantastic, even I get all that, v.well explained and thank you :D :D :D :lol:
Author:  dudest [ Tue Apr 30, 2013 4:26 am ]
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.
You, my friend, are one of the great ones :)!

Thanks for your lovely work + generousity.

The indi + lib + examples totally rock

Cheers!
Author:  Zypip [ Tue Apr 30, 2013 11:38 am ]
Post subject:  Re: Support/Resistance Indicator

Hi Slipshod and thank you for this gem again.

May I ask whether it is possible to get an alert only when p/a has entered a S/R zone for the first time and ignore any further test of the zones ?

Ideally I was thinking of a dashboard on selected pairs simply showing when p/a enters a S/R zone for the first time.

Would greatly appreciate your thoughts on this if time permits of course.

Cheers,

Zyp
Author:  dietcoke [ Tue Apr 30, 2013 10:34 pm ]
Post subject:  Re: Support/Resistance Indicator

slipshod,

The library works great. Here are a couple of thoughts on improving it's usefulness.

1) Allowing passing the holding array by reference. Possibly as an optional parameter to keep things simple for those who don't need to hold more than one set of zones

2) A MaxZones Parameter would help. Generally, most of us are only interested in the nearest 2-3 zones.
Author:  slipshod [ Wed May 01, 2013 3:57 am ]
Post subject:  Re: Support/Resistance Indicator

Hi DC, glad its working well - sorry to say that I only performed minimal testing :)

1) I thought about that, but what would happen to the referenced array if the library needed to perform an ArrayResize on it? Would the pointer address be preserved or messed up? Something I'll need to experiment with. On a similar note, I was thinking of making SSSR_UpdateZones() return the number of zones created, then you could iterate through them all by calling the SSSR_GetZoneHi/Lo functions with IDs from 0 to the total zone count -1.

2) I'm not sure a MaxZones would help, or indeed how it would work. When the library's generating the zones it can't know which would be closest to the price until after its finished, and it certainly wouldn't change the amount of work it had to do. Also the SSSR_GetZoneHi/Lo functions are tailor-made for finding zones near the price. Perhaps you could expand more on what you're thinking here?
Author:  slipshod [ Sun May 05, 2013 12:28 pm ]
Post subject:  Re: Support/Resistance Indicator

I just added an example EA to the first post in the thread, illustrating how the library can be used.
Author:  slipshod [ Tue May 07, 2013 5:45 am ]
Post subject:  Re: Support/Resistance Indicator

Version 2 of the Library added to the first post. It contains a simpler API and better handling of instances where price is inside a zone (read the Instructions.txt in the zip). The sample EA is also included.
Author:  SteveHopwood [ Tue May 07, 2013 10:47 am ]
Post subject:  Re: Support/Resistance Indicator

slipshod wrote:Version 2 of the Library added to the first post. It contains a simpler API and better handling of instances where price is inside a zone (read the Instructions.txt in the zip). The sample EA is also included.
I have it working perfectly now Andrew. Many thanks.

:D
Author:  jlcgarcia [ Tue May 07, 2013 3:59 pm ]
Post subject:  Re: Support/Resistance Indicator

slipshod wrote:Version 2 of the Library added to the first post. It contains a simpler API and better handling of instances where price is inside a zone (read the Instructions.txt in the zip). The sample EA is also included.

Hello Andrew,

I want to thank you very much for this library (not to mention the LibOrderReliable4ss1), because this is the tool I was searching for taking a new step in the development of the !xMeter expert.

Your Support/Resistance Indicator will permit to eliminate all the indicators of the program (exception of !xMeter) and test an expert based only on price action.

Regards


José Luis
All times are UTC Page 8 of 23