Topic: New to EA creation via Strategy Builder

Hello guy's i've beeing chatting via mail with Popov, but i think maybe here other could see how to make an EA work via this software i find great!! well i'm not a programmer so maybe lot of pople that do not know how to program could have a look here...

I will do lot of questions while i advance with this, so i don't bother popv too much via email, i would like to get responses, if you can maybe important for others to be shared info.

this is a strategy i build for EURUSD from scratch only using the software strategy builder trial:

http://i62.tinypic.com/513536.png

Ok, 2 things i see here:

- What is best acceptance criteria?? (could be chices for newbyes)
- What is and how to perform Intrabarscanning??
- How to get less Ambiguous Bars??
- When i optimize i have no result at all?? why??
- What is the idea for generate??
- Why when i try to Optimize i have no results at all.

this to start, thank you all.

Daniel Lüchinger M.
(Daniel1983)

Re: New to EA creation via Strategy Builder

- For intrabar scan load all lower timeframes, you can see some steps here forexsb.com/wiki/fsbpro_guide/intrabar_stats. That should lower amb. bars too.
- Optimizer strives for a better result, if it can't be achieved, there will be no results, parameters remain unchanged.
- Generator is for generating strategies forexsb.com/wiki/fsbpro_guide/strategy_generator.

Re: New to EA creation via Strategy Builder

footon wrote:

- For intrabar scan load all lower timeframes, you can see some steps here forexsb.com/wiki/fsbpro_guide/intrabar_stats. That should lower amb. bars too.
- Optimizer strives for a better result, if it can't be achieved, there will be no results, parameters remain unchanged.
- Generator is for generating strategies forexsb.com/wiki/fsbpro_guide/strategy_generator.

Hi, i am following instructions for intrabarstats, but i dont have this option!!
http://i62.tinypic.com/123xljd.png

Re: New to EA creation via Strategy Builder

You have some kind of errors there, click on the warning below, what does it say?

Re: New to EA creation via Strategy Builder

it says
http://i59.tinypic.com/24e5eth.png

Re: New to EA creation via Strategy Builder

I have to raise my hands... I tried it for 30min, nothing - it should load lower frame data automatically, but it doesn't. I don't know, went through all switches and settings I could find in Pro without result.

Old times were great

http://s18.postimg.org/4wlkli3tx/scanner.jpg

Re: New to EA creation via Strategy Builder

In order to load intrabar data you have to check on the "Use all available shorter periods..." option in Control Panel -> General. Do that for the Data Source you are going to use i your strategy.
Later on, open a new strategy and the program will load the intrabar data. If the strategy is already open, FSB Pro will reload the data alone. Then you come back in the Intarbar Statats page and you'll see the data.
You'll also see the loaded data list in the Output Log panel. 

http://s11.postimg.org/4ded3o47j/screenshot_782.jpg

Re: New to EA creation via Strategy Builder

Hi Popov thank you i was trying to enter account with mail instead of username big_smile

I did this its a solution still has some issues, like when i changed tabs it disconnected untill i reloaded the strategy again.

No big problem.

A bigger problem i am experiencing, is that when i make it transform into EA, it shows in Journal that i have in the code created by the software, an array out of range, how can i solve this??

Re: New to EA creation via Strategy Builder

A bigger problem i am experiencing, is that when i make it transform into EA, it shows in Journal that i have in the code created by the software, an array out of range, how can i solve this??

Send me the strategy and I'll fix it. Probably the problem is in some of the MQL indicators.

I did this its a solution still has some issues, like when i changed tabs it disconnected untill i reloaded the strategy again.

I cannot understand what you mean.

Re: New to EA creation via Strategy Builder

I did this its a solution still has some issues, like when i changed tabs it disconnected untill i reloaded the strategy again.




DOn't worry Popov, it is not big problem, i clicked the parameter from control panel, i openend the ea, went to intrabar tab, and i had what i needed everything good untill there, then i clicked back to home, went back to strategy, entered generator tab to see if any differences went back to intrabar tab and the info was not there anymor, so i went to control panel to see if it was clicked the option, and it was clicked, then closed the strategy loaded it again and i  could see the intrabar info again...This is not a big problem i think...


I will send you the strategy to email ok? the mq4 file.. thanks

Re: New to EA creation via Strategy Builder

then i clicked back to home, went back to strategy, entered generator tab to see if any differences went back to intrabar tab and the info was not there anymor

MHM. Can you reproduce that?

Re: New to EA creation via Strategy Builder

A bigger problem i am experiencing, is that when i make it transform into EA, it shows in Journal that i have in the code created by the software, an array out of range, how can i solve this??

This expert happily trades on my demo account. Do you set starting date to the MT backtester?
See this video related to this problem: Testing EAs with MT.

13 (edited by daniel1983 2015-02-09 22:00:13)

Re: New to EA creation via Strategy Builder

Popov wrote:

A bigger problem i am experiencing, is that when i make it transform into EA, it shows in Journal that i have in the code created by the software, an array out of range, how can i solve this??

This expert happily trades on my demo account. Do you set starting date to the MT backtester?
See this video related to this problem: Testing EAs with MT.

is it possible i don't have, buyt seems not be the problem, i attached a video in next post

vidya indicator
bbp ma oscilator
envelopes

??

Re: New to EA creation via Strategy Builder

here a video with errors

http://screencast.com/t/ZIRs74I6k4h

Re: New to EA creation via Strategy Builder

Thanks for the video.

Below the Out of range error there is another one: EURUSD W1 Wrong Moving Average Parameters (Period 23, Shift 0, Bars 11).

That means you are trying to calculate a MA requiring 23 bars on a data series having 11 bars. You have to provide minimum 23 weeks of data in order to calculate your expert.

Re: New to EA creation via Strategy Builder

that is strange as i have downloaded from tickstory 1 year - 48 week...will try downloading 2 years - 96 weeks...

Re: New to EA creation via Strategy Builder

daniel1983 wrote:

that is strange as i have downloaded from tickstory 1 year - 48 week...will try downloading 2 years - 96 weeks...

Ok, now its working everything perfect!! history very important!! will post test results further



thanks!!

Re: New to EA creation via Strategy Builder

nice to see that the test in mt4 is the same as here, even better here result was 80.000 and in mt4 109.000 really cool!!

How much will it cost if i want to add my own personal indicator to fsb to test i have the code but not the C++ how much for this?

Re: New to EA creation via Strategy Builder

How much will it cost if i want to add my own personal indicator to fsb to test i have the code but not the C++ how much for this?

I can make it for 20 eur/h for public indicator or 40eur/h for private indicator. It will take from 1 to 2 working hours. You pay via PayPal when the indicator is ready, but before to receive it. You'll receive C# code for FSB and MQL code for MT4 / 5 EA export.

Re: New to EA creation via Strategy Builder

I have the mq4 code allready i use it on mt4/5 is this only for "translating" into C?

Re: New to EA creation via Strategy Builder

I have the mq4 code allready

You cannot use it in our experts. It has to be completely rewritten. In MT even the data series are with an opposite direction. This code can be used only for reference or for comparing the result.

Re: New to EA creation via Strategy Builder

Hi Popov i want this indicator i don't know how to attach the code for the indicator i modified it so i took the name to myself, maybe this is helpfull for other traders reading this post, so here it is, you told me would be 20eur per hour, how much will you take for this one:

//+------------------------------------------------------------------+
//|                                                         SSSR.mq4 |
//|                               Copyright © 2014, Daniel Luchinger |
//|                                                                  |
//| You are allowed to copy and distribute this file as you see fit, |
//| and modify it to suit your purposes on the following condition:- |
//|                                                                  |
//| 1. You must charge no money for this indicator or any derivative |
//|    that you create from it.  It was released freely, please keep |
//|    it free.                                                      |
//|                                                                  |
//| 2. If you make alterations, please don't release a new version   |  
//|    using the name "SSSR".  Either release it using a new name,   |
//|    or contact me about getting your changes included in my       |
//|    indicator (antonioluchinger@gmail.com).                       |
//|                                                                  |
//| 3. If you make a killer EA based on this indicator, please do me |
//|    a favour and send me a copy :)                                |
//|                                                                  |
//| My thanks to HotPotato and Itinerant for the help in completing  |
//| the code to call it from EA.                                     |
//|                                                                  |
//+------------------------------------------------------------------+


#property copyright "Copyright © 2014 Daniel Luchinger"
#property link      "http://magix.freeforums.org/new-1mintf-trend-indicator-created-help-t359.html"
#property strict

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 DodgerBlue
#property indicator_color4 DodgerBlue

extern int BackLimit   = 10000;
extern int TimeFrame   = 0;
extern string TimeString  = "0=Current, 60=H1, 240=H4, 1440=Day, 10080=Week, 43200=Month";

extern color color_support_weak     = DarkSlateGray;
extern color color_support_untested = SeaGreen;
extern color color_support_verified = Green;
extern color color_support_proven   = LimeGreen;
extern color color_support_turncoat = OliveDrab;
extern color color_resist_weak      = Indigo;
extern color color_resist_untested  = Orchid;
extern color color_resist_verified  = Crimson;
extern color color_resist_proven    = Red;
extern color color_resist_turncoat  = DarkOrange;
extern color color_broken_proven    = DarkGray;
extern color color_broken_verified  = Gray;
extern color color_broken_other     = DimGray;

extern bool zone_show_weak  = true;
extern double zone_fuzzfactor = 0.75;
extern bool zone_solid = false;
extern int zone_linewidth = 1;
extern int zone_style = 0;
extern bool zone_show_info    = true;
extern int zone_label_shift  = 5;
extern bool zone_show_alerts  = false;
extern bool zone_alert_popups = true;
extern bool zone_alert_sounds = true;
extern bool send_email        = false;
extern int zone_alert_waitseconds = 300; 
extern bool zone_merge = true;
extern bool zone_extend = true;
extern bool zone_showbroken = false;
extern int  zone_limit = 1000;

extern bool fractals_show = false;
extern double fractal_fast_factor = 3.0;
extern double fractal_slow_factor = 6.0;
extern bool SetGlobals = true;

double FastDnPts[], FastUpPts[];
double SlowDnPts[], SlowUpPts[];
double ResHigh[1],ResLow[1];
double SupHigh[1],SupLow[1];

double zone_hi[], zone_lo[];
int    zone_start[], zone_hits[], zone_type[], zone_strength[], zone_end[], zone_count = 0;
bool   zone_turn[];

#define ZONE_SUPPORT 1
#define ZONE_RESIST  2
#define ZONE_BROKEN  3

#define ZONE_WEAK      0
#define ZONE_TURNCOAT  1
#define ZONE_UNTESTED  2
#define ZONE_VERIFIED  3
#define ZONE_PROVEN    4

#define UP_POINT 1
#define DN_POINT -1

int time_offset = 0;

int init()
{
   IndicatorBuffers(4);

   SetIndexBuffer(0, SlowDnPts);
   SetIndexBuffer(1, SlowUpPts);
   SetIndexBuffer(2, FastDnPts);
   SetIndexBuffer(3, FastUpPts);
   SetIndexBuffer(4, ResHigh);
   SetIndexBuffer(5, ResLow);
   SetIndexBuffer(6, SupHigh);
   SetIndexBuffer(7, SupLow);

   if (fractals_show == true)
   {
      SetIndexStyle(0, DRAW_ARROW, 0, 3);
      SetIndexStyle(1, DRAW_ARROW, 0, 3);
      SetIndexStyle(2, DRAW_ARROW, 0, 1);
      SetIndexStyle(3, DRAW_ARROW, 0, 1);
      SetIndexArrow(0, 218);
      SetIndexArrow(1, 217);
      SetIndexArrow(2, 218);
      SetIndexArrow(3, 217);
   }
   else
   {
      SetIndexStyle(0, DRAW_NONE);
      SetIndexStyle(1, DRAW_NONE);
      SetIndexStyle(2, DRAW_NONE);
      SetIndexStyle(3, DRAW_NONE);
   }

      SetIndexStyle(4, DRAW_NONE);
      SetIndexStyle(5, DRAW_NONE);
      SetIndexStyle(6, DRAW_NONE);
      SetIndexStyle(7, DRAW_NONE);

      
   if (TimeFrame != 1 && TimeFrame != 5 && TimeFrame != 15 &&
       TimeFrame != 60 && TimeFrame != 240 && TimeFrame != 1440 &&
       TimeFrame != 10080 && TimeFrame != 43200)
      TimeFrame = 0;

   if (TimeFrame < Period())
      TimeFrame = Period();

   zone_limit = MathMax(zone_limit, 100);
   ArrayResize(zone_hi, zone_limit);
   ArrayResize(zone_lo, zone_limit);
   ArrayResize(zone_start, zone_limit);
   ArrayResize(zone_hits, zone_limit);
   ArrayResize(zone_type, zone_limit);
   ArrayResize(zone_strength, zone_limit);
   ArrayResize(zone_end, zone_limit);
   ArrayResize(zone_turn, zone_limit);

   return(0);
}

int deinit()
{
   DeleteZones();
   DeleteGlobalVars();
   return(0);
}

int start()
{
   if (NewBar() == true)
   {
      int old_zone_count = zone_count;

      FastFractals();
      SlowFractals();
      DeleteZones();
      FindZones();
      DrawZones();
      if (zone_count < old_zone_count)
         DeleteOldGlobalVars(old_zone_count);
   }

   if (zone_show_info == true)
   {
      for (int i=0; i<zone_count; i++)
      {
         string lbl;
         if (zone_strength[i] == ZONE_PROVEN)
            lbl = "Proven";
         else if (zone_strength[i] == ZONE_VERIFIED)
            lbl = "Verified";
         else if (zone_strength[i] == ZONE_UNTESTED)
            lbl = "Untested";
         else if (zone_strength[i] == ZONE_TURNCOAT)
            lbl = "Turncoat";
         else
            lbl = "Weak";

         if (zone_type[i] == ZONE_SUPPORT)
            lbl = lbl + " Support";
         else
            lbl = lbl + " Resistance";

         if (zone_hits[i] > 0 && zone_strength[i] > ZONE_UNTESTED)
         {
            if (zone_hits[i] == 1)
               lbl = lbl + ", Test Count=" + zone_hits[i];
            else
               lbl = lbl + ", Test Count=" + zone_hits[i];
         }

         int adjust_hpos;
         int wbpc = WindowBarsPerChart();
         int k;
         
         k = Period() * 60 + (20 + StringLen(lbl));
         
         if (wbpc < 80)  
            adjust_hpos = Time[0] + k * 4;
         else if (wbpc < 125)  
            adjust_hpos = Time[0] + k * 8;
         else if (wbpc < 250)
            adjust_hpos = Time[0] + k * 15;
         else if (wbpc < 480)
            adjust_hpos = Time[0] + k * 29;
         else if (wbpc < 950)
            adjust_hpos = Time[0] + k * 58;
         else
            adjust_hpos = Time[0] + k * 115;
         
         //

         int shift = k * zone_label_shift;
         double vpos = zone_hi[i] - (zone_hi[i] - zone_lo[i]) / 2;

         string s = "SSSR#"+i+"LBL";
         ObjectCreate(s, OBJ_TEXT, 0, 0, 0);
         ObjectSet(s, OBJPROP_TIME1, adjust_hpos + shift);
         ObjectSet(s, OBJPROP_PRICE1, vpos);
         ObjectSetText(s, StringRightPad(lbl, 36, " "), 8, "Courier New");
      }
   }

   CheckAlerts();

   return(0);
}

void CheckAlerts()
{
   static int lastalert = 0;

   if (zone_show_alerts == false)
      return;

   if (Time[0] - lastalert > zone_alert_waitseconds)
      if (CheckEntryAlerts() == true)
         lastalert = Time[0];
}

bool CheckEntryAlerts()
{
   // check for entries
   for (int i=0; i<zone_count; i++)
   {
      if (Close[0] >= zone_lo[i] && Close[0] < zone_hi[i])
      {
         if (zone_show_alerts == true)
         {
            if (zone_alert_popups == true)
            {
               if (zone_type[i] == ZONE_SUPPORT)
                  Alert(Symbol() + TimeFrameToString(TimeFrame) + ": Support Zone Entered");
               else
                  Alert(Symbol() + TimeFrameToString(TimeFrame) + ": Resistance Zone Entered");
            }

            if (zone_alert_sounds == true)
               PlaySound("alert.wav");
         }
         
         if (send_email == true)
         {
            string dir = "";
            string msg = StringConcatenate(Symbol(), "-", TimeFrameToString(TimeFrame), " at ", TimeToStr(Time[0], TIME_DATE|TIME_SECONDS),
                                           " ", dir, " Zone Entered");
            if (zone_type[i] == ZONE_SUPPORT)
            {
               dir = "Support";
               SendMail("SS_SupRes_v04c alert", msg);
            }
            else
            {
               dir = "Resistance";
               SendMail("SS_SupRes_v04c alert", msg);
            }
         }
         return(true);
      }
   }

   return(false);
}

void DeleteGlobalVars()
{
   if (SetGlobals == false)
      return;

   GlobalVariableDel("SSSR_Count_"+Symbol()+TimeFrame);
   GlobalVariableDel("SSSR_Updated_"+Symbol()+TimeFrame);

   int old_count = zone_count;
   zone_count = 0;
   DeleteOldGlobalVars(old_count);
}

void DeleteOldGlobalVars(int old_count)
{
   if (SetGlobals == false)
      return;

   for (int i=zone_count; i<old_count; i++)
   {
      GlobalVariableDel("SSSR_HI_"+Symbol()+TimeFrame+i);
      GlobalVariableDel("SSSR_LO_"+Symbol()+TimeFrame+i);
      GlobalVariableDel("SSSR_HITS_"+Symbol()+TimeFrame+i);
      GlobalVariableDel("SSSR_STRENGTH_"+Symbol()+TimeFrame+i);
      GlobalVariableDel("SSSR_AGE_"+Symbol()+TimeFrame+i);
   }
}

void FindZones()
{
   int i, j, shift, bustcount=0, testcount = 0, brokebar;
   double hival, loval;
   bool turned = false, hasturned = false;

   double temp_hi[1000], temp_lo[1000];
   int    temp_start[1000], temp_hits[1000], temp_strength[1000], temp_count = 0;
   bool   temp_turn[1000], temp_merge[1000];
   double bust_hi[1000], bust_lo[1000];
   int    bust_start[1000], bust_hits[1000], bust_strength[1000], bust_end[1000], bust_count = 0;
   bool   bust_turn[1000], bust_merge[1000];
   int merge1[1000], merge2[1000], merge_count = 0;
   int berge1[1000], berge2[1000], berge_count = 0;

   // iterate through zones from oldest to youngest (ignore recent 5 bars),
   // finding those that have survived through to the present...
   for (shift=MathMin(iBars(NULL, TimeFrame)-1, BackLimit); shift>5; shift--)
   {
      double atr = iATR(NULL, TimeFrame, 7, shift);
      double fu = atr/2 * zone_fuzzfactor;
      bool isWeak;
      bool touchOk = false;
      bool isBust = false;
      double close = iClose(NULL, TimeFrame, shift);
      double high  = iHigh(NULL, TimeFrame, shift);
      double low   = iLow(NULL, TimeFrame, shift);
      double hi_i;
      double lo_i;

      if (FastUpPts[shift] > 0.001)
      {
         // a zigzag high point
         isWeak = true;
         if (SlowUpPts[shift] > 0.001)
            isWeak = false;

         hival = high;
         if (zone_extend == true)
            hival += fu;

         loval = MathMax(MathMin(close, high-fu), high-fu*2);
         turned = false;
         hasturned = false;
         isBust = false;

         bustcount = 0;
         testcount = 0;
         brokebar = 0;

         for (i=shift-1; i>=0; i--)
         {
            hi_i = iHigh(NULL, TimeFrame, i);
            lo_i = iLow(NULL, TimeFrame, i);

            if ((turned == false && FastUpPts[i] >= loval && FastUpPts[i] <= hival) ||
                (turned == true && FastDnPts[i] <= hival && FastDnPts[i] >= loval))
            {
               // Potential touch, just make sure its been 10+candles since the prev one
               touchOk = true;
               for (j=i+1; j<i+11; j++)
               {
                  if ((turned == false && FastUpPts[j] >= loval && FastUpPts[j] <= hival) ||
                      (turned == true && FastDnPts[j] <= hival && FastDnPts[j] >= loval))
                  {
                     touchOk = false;
                     break;
                  }
               }

               if (touchOk == true)
               {
                  // we have a touch.  If its been busted once, remove bustcount
                  // as we know this level is still valid & has just switched sides
                  bustcount = 0;
                  testcount++;
               }
            }

            if ((turned == false && hi_i > hival) ||
                (turned == true && lo_i < loval))
            {
               // this level has been busted at least once
               bustcount++;
               brokebar = MathMax(brokebar, i);

               if (bustcount > 1 || isWeak == true)
               {
                  // busted twice or more
                  isBust = true;
                  break;
               }

               if (turned == true)
                  turned = false;
               else if (turned == false)
                  turned = true;

               hasturned = true;

               // forget previous hits
               testcount = 0;
            }
         }

         if (isBust == false)
         {
            // level is still valid, add to our list
            temp_hi[temp_count] = hival;
            temp_lo[temp_count] = loval;
            temp_turn[temp_count] = hasturned;
            temp_hits[temp_count] = testcount;
            temp_start[temp_count] = shift;
            temp_merge[temp_count] = false;
            
            if (testcount > 3)
               temp_strength[temp_count] = ZONE_PROVEN;
            else if (testcount > 0)
               temp_strength[temp_count] = ZONE_VERIFIED;
            else if (hasturned == true)
               temp_strength[temp_count] = ZONE_TURNCOAT;
            else if (isWeak == false)
               temp_strength[temp_count] = ZONE_UNTESTED;
            else
               temp_strength[temp_count] = ZONE_WEAK;

            temp_count++;
         }
         else if (zone_showbroken)
         {
            // level is broken, but we're showing it anyway
            bust_hi[bust_count] = hival;
            bust_lo[bust_count] = loval;
            bust_turn[bust_count] = hasturned;
            bust_hits[bust_count] = testcount;
            bust_start[bust_count] = shift;
            bust_end[bust_count] = brokebar;
            bust_merge[bust_count] = false;

            if (testcount > 3)
               bust_strength[bust_count] = ZONE_PROVEN;
            else if (testcount > 0)
               bust_strength[bust_count] = ZONE_VERIFIED;
            else if (hasturned == true)
               bust_strength[bust_count] = ZONE_TURNCOAT;
            else if (isWeak == false)
               bust_strength[bust_count] = ZONE_UNTESTED;
            else
               bust_strength[bust_count] = ZONE_WEAK;

            bust_count++;
         }
      }
      else if (FastDnPts[shift] > 0.001)
      {
         // a zigzag low point
         isWeak = true;
         if (SlowDnPts[shift] > 0.001)
            isWeak = false;

         loval = low;
         if (zone_extend == true)
            loval -= fu;

         hival = MathMin(MathMax(close, low+fu), low+fu*2);
         turned = false;
         hasturned = false;

         bustcount = 0;
         testcount = 0;
         brokebar  = 0;
         isBust = false;

         for (i=shift-1; i>=0; i--)
         {
            hi_i = iHigh(NULL, TimeFrame, i);
            lo_i = iLow(NULL, TimeFrame, i);

            if ((turned == true && FastUpPts[i] >= loval && FastUpPts[i] <= hival) ||
                (turned == false && FastDnPts[i] <= hival && FastDnPts[i] >= loval))
            {
               // Potential touch, just make sure its been 10+candles since the prev one
               touchOk = true;
               for (j=i+1; j<i+11; j++)
               {
                  if ((turned == true && FastUpPts[j] >= loval && FastUpPts[j] <= hival) ||
                      (turned == false && FastDnPts[j] <= hival && FastDnPts[j] >= loval))
                  {
                     touchOk = false;
                     break;
                  }
               }

               if (touchOk == true)
               {
                  // we have a touch.  If its been busted once, remove bustcount
                  // as we know this level is still valid & has just switched sides
                  bustcount = 0;
                  testcount++;
               }
            }

            if ((turned == true && hi_i > hival) ||
                (turned == false && lo_i < loval))
            {
               // this level has been busted at least once
               bustcount++;
               brokebar = MathMax(brokebar, i);

               if (bustcount > 1 || isWeak == true)
               {
                  // busted twice or more
                  isBust = true;
                  break;
               }

               if (turned == true)
                  turned = false;
               else if (turned == false)
                  turned = true;

               hasturned = true;

               // forget previous hits
               testcount = 0;
            }
         }

         if (isBust == false)
         {
            // level is still valid, add to our list
            temp_hi[temp_count] = hival;
            temp_lo[temp_count] = loval;
            temp_turn[temp_count] = hasturned;
            temp_hits[temp_count] = testcount;
            temp_start[temp_count] = shift;
            temp_merge[temp_count] = false;

            if (testcount > 3)
               temp_strength[temp_count] = ZONE_PROVEN;
            else if (testcount > 0)
               temp_strength[temp_count] = ZONE_VERIFIED;
            else if (hasturned == true)
               temp_strength[temp_count] = ZONE_TURNCOAT;
            else if (isWeak == false)
               temp_strength[temp_count] = ZONE_UNTESTED;
            else
               temp_strength[temp_count] = ZONE_WEAK;

            temp_count++;
         }
         else if (zone_showbroken)
         {
            // level is broken, but we're showing it anyway
            bust_hi[bust_count] = hival;
            bust_lo[bust_count] = loval;
            bust_turn[bust_count] = hasturned;
            bust_hits[bust_count] = testcount;
            bust_start[bust_count] = shift;
            bust_end[bust_count] = brokebar;
            bust_merge[bust_count] = false;

            if (testcount > 3)
               bust_strength[bust_count] = ZONE_PROVEN;
            else if (testcount > 0)
               bust_strength[bust_count] = ZONE_VERIFIED;
            else if (hasturned == true)
               bust_strength[bust_count] = ZONE_TURNCOAT;
            else if (isWeak == false)
               bust_strength[bust_count] = ZONE_UNTESTED;
            else
               bust_strength[bust_count] = ZONE_WEAK;

            bust_count++;
         }
      }
   }

   // look for overlapping zones...
   if (zone_merge == true)
   {
      merge_count = 1;
      int iterations = 0, target, source;
      while (merge_count > 0 && iterations < 3)
      {
         merge_count = 0;
         iterations++;

         for (i = 0; i < temp_count; i++)
            temp_merge[i] = false;

         for (i = 0; i < temp_count-1; i++)
         {
            if (temp_hits[i] == -1 || temp_merge[j] == true)
               continue;

            for (j = i+1; j < temp_count; j++)
            {
               if (temp_hits[j] == -1 || temp_merge[j] == true)
                  continue;

               if ((temp_hi[i] >= temp_lo[j] && temp_hi[i] <= temp_hi[j]) ||
                   (temp_lo[i] <= temp_hi[j] && temp_lo[i] >= temp_lo[j]) ||
                   (temp_hi[j] >= temp_lo[i] && temp_hi[j] <= temp_hi[i]) ||
                   (temp_lo[j] <= temp_hi[i] && temp_lo[j] >= temp_lo[i]))
               {
                  merge1[merge_count] = i;
                  merge2[merge_count] = j;
                  temp_merge[i] = true;
                  temp_merge[j] = true;
                  merge_count++;
               }
            }
         }

         // ... and merge them ...
         for (i=0; i<merge_count; i++)
         {
            target = merge1[i];
            source = merge2[i];

            temp_hi[target] = MathMax(temp_hi[target], temp_hi[source]);
            temp_lo[target] = MathMin(temp_lo[target], temp_lo[source]);
            temp_hits[target] += temp_hits[source];
            temp_start[target] = MathMax(temp_start[target], temp_start[source]);
            temp_strength[target] = MathMax(temp_strength[target], temp_strength[source]);
            if (temp_hits[target] > 3)
               temp_strength[target] = ZONE_PROVEN;

            if (temp_hits[target] == 0 && temp_turn[target] == false)
            {
               temp_hits[target] = 1;
               if (temp_strength[target] < ZONE_VERIFIED)
                  temp_strength[target] = ZONE_VERIFIED;
            }

            if (temp_turn[target] == false || temp_turn[source] == false)
               temp_turn[target] = false;
            if (temp_turn[target] == true)
               temp_hits[target] = 0;

            temp_hits[source] = -1;
         }
      }
   
      if (zone_showbroken)
      {
         // merge busted zones
         berge_count = 1;
         iterations = 0;
         while (berge_count > 0 && iterations < 3)
         {
            berge_count = 0;
            iterations++;
   
            for (i = 0; i < bust_count; i++)
               bust_merge[i] = false;

            for (i = 0; i < bust_count-1; i++)
            {
               if (bust_hits[i] == -1 || bust_merge[j] == true)
                  continue;

               for (j = i+1; j < bust_count; j++)
               {
                  if (bust_hits[j] == -1 || bust_merge[j] == true)
                     continue;

                  if ((bust_hi[i] >= bust_lo[j] && bust_hi[i] <= bust_hi[j]) ||
                      (bust_lo[i] <= bust_hi[j] && bust_lo[i] >= bust_lo[j]) ||
                      (bust_hi[j] >= bust_lo[i] && bust_hi[j] <= bust_hi[i]) ||
                      (bust_lo[j] <= bust_hi[i] && bust_lo[j] >= bust_lo[i]))
                  {
                     berge1[berge_count] = i;
                     berge2[berge_count] = j;
                     bust_merge[i] = true;
                     bust_merge[j] = true;
                     berge_count++;
                  }
               }
            }

            // ... and merge them ...
            for (i=0; i<berge_count; i++)
            {
               target = berge1[i];
               source = berge2[i];

               bust_hi[target] = MathMax(bust_hi[target], bust_hi[source]);
               bust_lo[target] = MathMin(bust_lo[target], bust_lo[source]);
               bust_hits[target] += bust_hits[source];
               bust_start[target] = MathMax(bust_start[target], bust_start[source]);
               bust_end[target] = MathMax(bust_end[target], bust_end[source]);
               bust_strength[target] = MathMax(bust_strength[target], bust_strength[source]);
               if (bust_hits[target] > 3)
                  bust_strength[target] = ZONE_PROVEN;

               if (bust_hits[target] == 0 && bust_turn[target] == false)
               {
                  bust_hits[target] = 1;
                  if (bust_strength[target] < ZONE_VERIFIED)
                     bust_strength[target] = ZONE_VERIFIED;
               }

               if (bust_turn[target] == false || bust_turn[source] == false)
                  bust_turn[target] = false;
               if (bust_turn[target] == true)
                  bust_hits[target] = 0;

               bust_hits[source] = -1;
            }
         }
      }
   }

   // copy the remaining list into our official zones arrays
   zone_count = 0;
   for (i=0; i<temp_count; i++)
   {
      if (temp_hits[i] >= 0 && zone_count < zone_limit)
      {
         zone_hi[zone_count]       = temp_hi[i];
         zone_lo[zone_count]       = temp_lo[i];
         zone_hits[zone_count]     = temp_hits[i];
         zone_turn[zone_count]     = temp_turn[i];
         zone_start[zone_count]    = temp_start[i];
         zone_strength[zone_count] = temp_strength[i];
         zone_end[zone_count]      = 0;
         
         if (zone_hi[zone_count] < Close[4])
            zone_type[zone_count] = ZONE_SUPPORT;
         else if (zone_lo[zone_count] > Close[4])
            zone_type[zone_count] = ZONE_RESIST;
         else
         {
            for (j=5; j<1000; j++)
            {
               if (iClose(NULL, TimeFrame, j) < zone_lo[zone_count])
               {
                  zone_type[zone_count] = ZONE_RESIST;
                  break;
               }
               else if (iClose(NULL, TimeFrame, j) > zone_hi[zone_count])
               {
                  zone_type[zone_count] = ZONE_SUPPORT;
                  break;
               }
            }

            if (j == 1000)
               zone_type[zone_count] = ZONE_SUPPORT;
         }

         zone_count++;
      }
   }

   if (zone_showbroken)
   {
      for (i=bust_count-1; i>=0; i--)
      {
         if (bust_hits[i] >= 0 && zone_count < zone_limit)
         {
            zone_hi[zone_count]       = bust_hi[i];
            zone_lo[zone_count]       = bust_lo[i];
            zone_hits[zone_count]     = bust_hits[i];
            zone_turn[zone_count]     = bust_turn[i];
            zone_start[zone_count]    = bust_start[i];
            zone_strength[zone_count] = bust_strength[i];
            zone_end[zone_count]      = bust_end[i];
            zone_type[zone_count]     = ZONE_BROKEN;
            zone_count++;
         }
      }
   }
}

void DrawZones()
{

ResHigh[0] = ResLow[0] = 99999.0;
SupHigh[0] = SupLow[0] = -99999.0;

   if (SetGlobals == true)
   {
      GlobalVariableSet("SSSR_Count_"+Symbol()+TimeFrame, zone_count);
      GlobalVariableSet("SSSR_Updated_"+Symbol()+TimeFrame, TimeCurrent());
   }

int i;

   for (i=0; i<zone_count; i++)
   {
      if (zone_strength[i] == ZONE_WEAK && zone_show_weak == false)
         continue;

      string s = "SSSR#"+i+" Strength=";
      if (zone_strength[i] == ZONE_PROVEN)
         s = s + "Proven, Test Count=" + zone_hits[i];
      else if (zone_strength[i] == ZONE_VERIFIED)
         s = s + "Verified, Test Count=" + zone_hits[i];
      else if (zone_strength[i] == ZONE_UNTESTED)
         s = s + "Untested";
      else if (zone_strength[i] == ZONE_TURNCOAT)
         s = s + "Turncoat";
      else
         s = s + "Weak";

      ObjectCreate(s, OBJ_RECTANGLE, 0, 0, 0, 0, 0);
      ObjectSet(s, OBJPROP_TIME1, iTime(NULL, TimeFrame, zone_start[i]));
      ObjectSet(s, OBJPROP_TIME2, iTime(NULL, TimeFrame, zone_end[i]));
      ObjectSet(s, OBJPROP_PRICE1, zone_hi[i]);
      ObjectSet(s, OBJPROP_PRICE2, zone_lo[i]);
      ObjectSet(s, OBJPROP_BACK, zone_solid);
      ObjectSet(s, OBJPROP_WIDTH, zone_linewidth);
      ObjectSet(s, OBJPROP_STYLE, zone_style);

      if (zone_type[i] == ZONE_SUPPORT)
      {
         // support zone
         if (zone_strength[i] == ZONE_TURNCOAT)
            ObjectSet(s, OBJPROP_COLOR, color_support_turncoat);
         else if (zone_strength[i] == ZONE_PROVEN)
            ObjectSet(s, OBJPROP_COLOR, color_support_proven);
         else if (zone_strength[i] == ZONE_VERIFIED)
            ObjectSet(s, OBJPROP_COLOR, color_support_verified);
         else if (zone_strength[i] == ZONE_UNTESTED)
            ObjectSet(s, OBJPROP_COLOR, color_support_untested);
         else
            ObjectSet(s, OBJPROP_COLOR, color_support_weak);
      }
      else if (zone_type[i] == ZONE_RESIST)
      {
         // resistance zone
         if (zone_strength[i] == ZONE_TURNCOAT)
            ObjectSet(s, OBJPROP_COLOR, color_resist_turncoat);
         else if (zone_strength[i] == ZONE_PROVEN)
            ObjectSet(s, OBJPROP_COLOR, color_resist_proven);
         else if (zone_strength[i] == ZONE_VERIFIED)
            ObjectSet(s, OBJPROP_COLOR, color_resist_verified);
         else if (zone_strength[i] == ZONE_UNTESTED)
            ObjectSet(s, OBJPROP_COLOR, color_resist_untested);
         else
            ObjectSet(s, OBJPROP_COLOR, color_resist_weak);
      }
      else  // broken zones
      {
         if (zone_strength[i] == ZONE_PROVEN)
            ObjectSet(s, OBJPROP_COLOR, color_broken_proven);
         else if (zone_strength[i] == ZONE_VERIFIED)
            ObjectSet(s, OBJPROP_COLOR, color_broken_verified);
         else
            ObjectSet(s, OBJPROP_COLOR, color_broken_other);
      }

      if (zone_type[i] == ZONE_RESIST && zone_strength[i] == ZONE_VERIFIED && zone_hi[i] < ResHigh[0]) {
         ResHigh[0] = zone_hi[i];
         ResLow[0] = zone_lo[i];
//Print("RES "+i+" "+ResHigh[0]+"  "+ResLow[0]);
      }
      if (zone_type[i] == ZONE_SUPPORT && zone_strength[i] == ZONE_VERIFIED && zone_hi[i] > SupHigh[0]) {
         SupHigh[0] = zone_hi[i];
         SupLow[0] = zone_lo[i];
//Print("SUPP "+i+" "+SupHigh[0]+"  "+SupLow[0]);
      }

      if (SetGlobals == true && zone_type[i] != ZONE_BROKEN)
      {
         GlobalVariableSet("SSSR_HI_"+Symbol()+TimeFrame+i, zone_hi[i]);
         GlobalVariableSet("SSSR_LO_"+Symbol()+TimeFrame+i, zone_lo[i]);
         GlobalVariableSet("SSSR_HITS_"+Symbol()+TimeFrame+i, zone_hits[i]);
         GlobalVariableSet("SSSR_STRENGTH_"+Symbol()+TimeFrame+i, zone_strength[i]);
         GlobalVariableSet("SSSR_AGE_"+Symbol()+TimeFrame+i, zone_start[i]);
      }

   }
Print("SUPP "+i+" "+SupHigh[0]+"  "+SupLow[0]);
Print("RES "+i+" "+ResHigh[0]+"  "+ResLow[0]);
}

bool Fractal(int M, int P, int shift)
{
   if (TimeFrame > P)
      P = TimeFrame;
   
   P = P / TimeFrame*2 + MathCeil(P / TimeFrame / 2);
   
   if (shift < P)
      return(false);

   if (shift > iBars(Symbol(), TimeFrame)-P)
      return(false); 
   
   for (int i=1; i<=P; i++)
   {
      if (M == UP_POINT)
      {
         if (iHigh(NULL, TimeFrame, shift+i) > iHigh(NULL, TimeFrame, shift))
            return(false);
         if (iHigh(NULL, TimeFrame, shift-i) >= iHigh(NULL, TimeFrame, shift))
            return(false);     
      }
      if (M == DN_POINT)
      {
         if (iLow(NULL, TimeFrame, shift+i) < iLow(NULL, TimeFrame, shift))
            return(false);
         if (iLow(NULL, TimeFrame, shift-i) <= iLow(NULL, TimeFrame, shift))
            return(false);
      }        
   }
   return(true);   
}  

void FastFractals()
{
   int counted = IndicatorCounted();
   int shift, limit;
   int P = TimeFrame * fractal_fast_factor;

   if (counted < 0) return;
   if (counted > 0) 
      limit = MathMin(BackLimit, MathMax(P, Bars - counted));
   else
      limit = MathMin(BackLimit, Bars-1);

   limit = MathMin(Bars-1, limit);

   FastUpPts[0] = 0.0; FastUpPts[1] = 0.0;
   FastDnPts[0] = 0.0; FastDnPts[1] = 0.0;

   for (shift=limit; shift>1; shift--)
   {
      if (Fractal(UP_POINT, P, shift) == true)
         FastUpPts[shift] = iHigh(NULL, TimeFrame, shift);
      else
         FastUpPts[shift] = 0.0;

      if (Fractal(DN_POINT, P, shift) == true)
         FastDnPts[shift] = iLow(NULL, TimeFrame, shift);
      else
         FastDnPts[shift] = 0.0;
   }
}

void SlowFractals()
{
   int counted = IndicatorCounted();
   int shift, limit;
   int P = TimeFrame * fractal_slow_factor;

   if (counted < 0) return;
   if (counted > 0) 
      limit = MathMin(BackLimit, MathMax(P, Bars - counted));
   else
      limit = MathMin(BackLimit, Bars-1);

   limit = MathMin(Bars-1, limit);

   SlowUpPts[0] = 0.0; SlowUpPts[1] = 0.0;
   SlowDnPts[0] = 0.0; SlowDnPts[1] = 0.0;

   for (shift=limit; shift>1; shift--)
   {
      if (Fractal(UP_POINT, P, shift) == true)
         SlowUpPts[shift] = iHigh(NULL, TimeFrame, shift);
      else
         SlowUpPts[shift] = 0.0;

      if (Fractal(DN_POINT, P, shift) == true)
         SlowDnPts[shift] = iLow(NULL, TimeFrame, shift);
      else
         SlowDnPts[shift] = 0.0;
   }
}

bool NewBar()
{
   static datetime LastTime = 0;
   if (iTime(NULL, TimeFrame, 0) != LastTime)
   {
      LastTime = iTime(NULL, TimeFrame, 0)+time_offset;
      return (true);
   }
   else
      return (false);
}

void DeleteZones()
{
   int len = 5;
   int i;

   while (i < ObjectsTotal())
   {
      string objName = ObjectName(i);
      string objDesc = ObjectDescription(i);
      if (StringSubstr(objName, 0, len) != "SSSR#")
      {
         i++;
         continue;
      }

      ObjectDelete(objName);
   }
}

string TimeFrameToString(int tf) //code by TRO
{
   string tfs;

   switch(tf)
   {
      case PERIOD_M1:
         tfs = "M1"  ;
         break;
      case PERIOD_M5:
         tfs = "M5"  ;
         break;
      case PERIOD_M15:
         tfs = "M15" ;
         break;
      case PERIOD_M30:
         tfs = "M30" ;
         break;
      case PERIOD_H1:
         tfs = "H1"  ;
         break;
      case PERIOD_H4:
         tfs = "H4"  ;
         break;
      case PERIOD_D1:
         tfs = "D1"  ;
         break;
      case PERIOD_W1:
         tfs = "W1"  ;
         break;
      case PERIOD_MN1:
         tfs = "MN";
   }

   return(tfs);
}

string StringRepeat(string str, int n = 1)
{
  string outstr = "";
  for(int i = 0; i < n; i++) outstr = outstr + str;
  return(outstr);
}

string StringRightPad(string str, int n=1, string str2=" ")
{
  return(str + StringRepeat(str2,n-StringLen(str)));
}

Important conditions i use:

- If between the Area of resistance sell
- if between the area of support buy
- if above area resistance buy
- if below area resistance sell
- If above area support buy
- if below area support sell

I divided for mt4 in 10  indicators one for each type of area, one indicator only for proven support one only for verfied support, oe only for wea, one only for turncoat one only for untested, same for resistances.

the results for my tests are as this for 1 year trading 2.000 - 5.000.000 USD, my only problem is looking for the best config including when the price starts going short, so this ea and indi is working good only for longtrend orders. i would like to use the software you created to look for the best confog for long trades and for short trades. I created a bug into the EA so will work only in demo (EA is free). Lets make this free for all too, would anybody like to share this for free? and i share the EA for all of you without the bug...thanks

http://i59.tinypic.com/347f9qa.png