Download MetaTrader 5

Examples: Displaying of Support/Resistance Levels

To add comments, please log in or register
Interested in Signals activity? Come and track!
MetaQuotes Software Corp.
Moderator
181381
MetaQuotes Software Corp. 2007.04.25 17:21 

New article Displaying of Support/Resistance Levels has been published:

The article deals with detecting and indicating Support/Resistance Levels in the MetaTrader 4 program. The convenient and universal indicator is based on a simple algorithm. The article also tackles such a useful topic as creation of a simple indicator that can display results from different timeframes in one workspace.

Author: Slobodov Gleb

MQL4 Comments
16319
MQL4 Comments 2007.04.30 18:00  
Dear Friend,
I just downloaded your Findlevels indicator.
Indicator is fine.I applied it to 1M chart of GBP/USD.I appllied 15 and 60 min levels. It showed up nicely.I tried to apply 240 min level.It got stuck.It is not responding. When I tried to close that 1M chart,it closes the platform.
When I strat the MT4 again, the same screen of 1M appears,saying 'it is not responding'.
How can I delete this 1M chart only so that I can have platform running properly?
I would appriciate your kind and valued help.
Dilip
Slobodov Gleb
106
Slobodov Gleb 2007.05.21 13:00  
Heh =)
Today i found that my articles have been translated to english by MetaQuotes
This is realy nice =)

dlppat:

I hope that I understood the question in spite of my poor English =)
When you using bigmin charts (for ex. 240min) you should be shure that you have enough history size.  The indicator uses 1000bars of history by default (as i remember =)).  So if you dont have enough long history,  you shound change varaible MaxT.
Frans
78
Frans 2010.01.18 18:47  

Hello,

I like the indicator. It works on the different timeframes. What I can not get to work is the support/ resistance lines from different timeframes in one chart, as described in your report. Can you tell me what the settings must be ?

Thanks

Dropje

whroeder1
14532
whroeder1 2011.05.23 23:06  
I have analyzed the code and found problems. In no particular order:
  1. #define MaxLines 1000
    string LineName[MaxLines];
    int LineIndex = 0;
    ...
         ObjectSet(LineName[LineIndex], OBJPROP_STYLE, LineStyle);
         LineIndex++;
    
    LineIndex and LineName[] is never adjusted when lines are moved.
  2. int counted_bars = IndicatorCounted();
    int limit = MathMin(Bars - counted_bars, MaxLimit);
     
    double d1 = prLow(iLowest(NULL, TimePeriod, MODE_LOW, limit, 0));
    double d2 = prHigh(iHighest(NULL, TimePeriod, MODE_HIGH, limit, 0));
    
    Except for the first pass, limit will be zero and d1,d2 garbage, and the rest of the algorithm fails.
  3. if(d1Num != d1 && d1Num != 0.0){
            ArrayCopy(CrossBarsNum, CrossBarsNum, 0, (d1Num - d1)*10000);
    
    The code assumes 4 digits, would be extremely slow on they Yen. I don't think that the copy moves counts in the correct direction (up or down is possible. )
  4.  if(Time[limit] != TMaxI&&TMaxI != 0)
            if(d > prLow(iBarShift(NULL, 0, TMaxI)) && 
               d < prHigh(iBarShift(NULL, 0, TMaxI)))
                CrossBarsNum[di]--;
      }
    TMaxI = Time[limit] - 1;
    Definitely should be Time[limit-1] but still has other problems such as moving multiple bars from counts.
  5. ArrayResize(CrossBarsNum, (d2 - d1)*10000);
    
    Array size one pip too small, need d1 to d2 inclusive.
  6. di = (d - d1)*10000;
        if(!CrossBarsMin[di] && CrossBarsNum[ArrayMaximum(CrossBarsNum, 2*l, di - l)]
    
    ArrayMaximum scans beyond array bounds

So I rewrote the code but kept the same functionality.
The original code took about ten seconds to refresh. My code is instantaneous.

whroeder1
14532
whroeder1 2011.05.26 22:16  
I didn't like the MaxCrossesLevel and MaxR idea. For one it doesn't show the min/max lines because of long tails. I replaced that portion with different algorithm.
  1. Roll down hill and find the lowest low. Line found.
  2. Climb uphill after the lowest low.
  3. Roll down hill forward from the last highest high.
  4. ...
MQL4 Comments
16319
MQL4 Comments 2013.05.07 09:56  
WHRoeder:
I have analyzed the code and found problems. In no particular order:
  1. #define MaxLines 1000
    string LineName[MaxLines];
    int LineIndex = 0;
    ...
         ObjectSet(LineName[LineIndex], OBJPROP_STYLE, LineStyle);
         LineIndex++;
    
    LineIndex and LineName[] is never adjusted when lines are moved.
  2. int counted_bars = IndicatorCounted();
    int limit = MathMin(Bars - counted_bars, MaxLimit);
     
    double d1 = prLow(iLowest(NULL, TimePeriod, MODE_LOW, limit, 0));
    double d2 = prHigh(iHighest(NULL, TimePeriod, MODE_HIGH, limit, 0));
    
    Except for the first pass, limit will be zero and d1,d2 garbage, and the rest of the algorithm fails.
  3. if(d1Num != d1 && d1Num != 0.0){
            ArrayCopy(CrossBarsNum, CrossBarsNum, 0, (d1Num - d1)*10000);
    
    The code assumes 4 digits, would be extremely slow on they Yen. I don't think that the copy moves counts in the correct direction (up or down is possible. )
  4.  if(Time[limit] != TMaxI&&TMaxI != 0)
            if(d > prLow(iBarShift(NULL, 0, TMaxI)) && 
               d < prHigh(iBarShift(NULL, 0, TMaxI)))
                CrossBarsNum[di]--;
      }
    TMaxI = Time[limit] - 1;
    Definitely should be Time[limit-1] but still has other problems such as moving multiple bars from counts.
  5. ArrayResize(CrossBarsNum, (d2 - d1)*10000);
    
    Array size one pip too small, need d1 to d2 inclusive.
  6. di = (d - d1)*10000;
        if(!CrossBarsMin[di] && CrossBarsNum[ArrayMaximum(CrossBarsNum, 2*l, di - l)]
    
    ArrayMaximum scans beyond array bounds

So I rewrote the code but kept the same functionality.
The original code took about ten seconds to refresh. My code is instantaneous.

Hi,  Have you tried to include the Fractal in the algoritm?. It would increase a filtering of low/high from the  indicator and let more accurated S/R levels. 
WHRoeder:
I didn't like the MaxCrossesLevel and MaxR idea. For one it doesn't show the min/max lines because of long tails. I replaced that portion with different algorithm.
  1. Roll down hill and find the lowest low. Line found.
  2. Climb uphill after the lowest low.
  3. Roll down hill forward from the last highest high.
  4. ...
To add comments, please log in or register