Add Pivot point supports (S1,S2,S3) and resistances (R1,R2,R3) to an existing Support Resistance indicator that use fractals.

Tâche terminée

Temps d'exécution 68 jours

Spécifications

Hello !

I use the SS_SupportResistance indicator and I love it :

It draw zones based on Fractals.

But I would like to have Daily, Weekly and Monthly Pivot point supports (S1,S2,S3) and resistances (R1,R2,R3) to be drawed as zone like the rests and merged when they overlap.
Daily, Weekly and Monthly should be switched with parameters.

This it the part that get the zone, it should be easy to add the Pivot Points supports and resistances :
The whole indicator is attached.

void FindZones()
{
   int i, j, shift, bustcount=0, testcount = 0;
   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];
   int merge1[1000], merge2[1000], merge_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>IgnoreShift; 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;

         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++;

               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 (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;
         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++;

               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++;
         }
      }
   }

   // look for overlapping zones...
   if (zone_merge == true)
   {
      merge_count = 1;
      int iterations = 0;
      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++)
         {
            int target = merge1[i];
            int 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;
         }
      }
   }

   // 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 < 1000)
      {
         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];
         
         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++;
      }
   }
}


Répondu

1
Développeur 1
Évaluation
(30)
Projets
93
49%
Arbitrage
18
56% / 17%
En retard
38
41%
Gratuit
2
Développeur 2
Évaluation
(790)
Projets
1109
43%
Arbitrage
47
49% / 23%
En retard
84
8%
Gratuit
3
Développeur 3
Évaluation
(1235)
Projets
2820
80%
Arbitrage
156
22% / 43%
En retard
488
17%
Gratuit
Commandes similaires
I am looking for an experienced C#/.NET developer to build a MetaTrader 5 (MT5) trade copier that executes trades between a master account and multiple slave accounts instantly, with no delay and full support for bulk order execution. The copier must communicate between the master and slave accounts via a dedicated server IP or socket connection to achieve real-time synchronization. Key Requirements: • Strong
LUCKY ROBOTICS 3.1 ok. Here is a professional / marketplace grade description for this specific bot you now have (RSI CROSS + SL/TP + TRAIL TYPE A + CLOSE OPPOSITE) Use this inside code header, in Market , GitHub, documentation, YouTube, selling page etc. EA Description (Meaningful Professional Description) RSI Crossover AutoTrader EA is a precision technical entry Expert Advisor that opens trades when market
Need a professional MQL4/MQL5 developer to build a trend-following scalping EA for MT4 & MT5. EA should trade with the trend using engulfing candles , support multiple entries at the same price , include equity protection , and stop after one winning trade per day . Must have adjustable TP, SL, trailing %, and inputs for risk control
Xbort 30 - 180 USD
This code fetches the current XAU/USD and BTC/USD data, calculates the 50 1. The code fetches the current XAU/USD data using the `yfinance` library. 2. It calculates the 50% and 61.8% Fibonacci retracement levels based on the high and low prices. 3. It gets the current price and compares it to the Fibonacci levels. 4. If the current price is above the 50% level, it generates a "Buy" signal. If it's below the 61.8%
We are building a Python-based backend that integrates with a MetaTrader 5 Expert Advisor (EA) . The EA sends structured market data (pair, session, ATR, volume, previous highs/lows, etc.) to a FastAPI server , and the server responds with AI-driven trade recommendations and parameters . This backend will act as the “brain” of the EA , managing all decision logic, learning models, and data storage. This is a serious
We are developing a next-generation Expert Advisor for MetaTrader 5 that integrates with a Python-based AI backend . This EA will act as the execution engine, communicating with the AI via API requests to receive trading bias, entry logic, and risk parameters in real time. This is not a basic robot — it’s a professional build intended for mass distribution under a subscription model. Only apply if you have experience
🧠 Request to Develop and Improve Trading Bot to a Smart Professional System with Enhanced Dashboard News Hello, I have a highly advanced trading bot that works very well and generates good profits. The bot currently includes: Indicators: RSI, Moving Average, Price Action. Multi-timeframe analysis for trade entries. Risk management: Trailing Stop, Daily Loss, Daily Profit. Martingale / Enhancement System, Take
Robô “Caçador de Tendência” (MT5) 🔹 1. Lógica principal O robô deve: Operar com base em um preço de referência definido pelo usuário. A partir desse preço, crie uma grade horizontal (grade) com distância fixa definida pelo usuário entre níveis (por exemplo: 1.000 pontos). Em cada nível acima do preço de referência, deve haver uma ordem de compra definida. Em cada nível abaixo do preço de referência, deve haver uma
Sadam Hussain 150 - 200 USD
Hello everyone, I need a developer who can create an expert advisor for mt4 that trades gold USDT, US 30,crude oil,silver USDT and major currency pairs whose loss is in cents and profit is in dollars and with it there is also a VPS facility. Buying Range 150 to 200$
I want to create a simple Expert Advisor for MT5 focused on XAU/USD scalping. Requirements: • Timeframe: M1 or M5 (auto-detect if possible) • Entry logic: follow trend using 2 Moving Averages (MA 9 and MA 50) • Buy when MA 9 crosses above MA 50 and candle closes above both • Sell when MA 9 crosses below MA 50 and candle closes below both • Lot size: 0.01 (customizable) • Take Profit: 10–15 pips (customizable) • Stop

Informations sur le projet

Budget
65+ USD
Pour le développeur
58.5 USD
Délais
à 5 jour(s)