Re: MT4 Indicator requests and ideas

17983
Hello fellow traders I was wondering if @mrtools or @Kvak could help with this code for identifying wedges. I'm no coder and was wondering if at all possible that either of you could take a look and see if it can be completed. Here is the code below....

Code: Select all

#property indicator_chart_window
#property indicator_buffers 7

// Input parameters
input bool BullishFallingWedge = true;
input bool BullishRisingWedge = true;
input bool BearishFallingWedge = true;
input bool BearishRisingWedge = true;

// Indicator buffers
double BearishFallingWedgeTopBuffer[];
double BearishFallingWedgeBottomBuffer[];
double BearishRisingWedgeTopBuffer[];
double BearishRisingWedgeBottomBuffer[];
double BullishFallingWedgeTopBuffer[];
double BullishFallingWedgeBottomBuffer[];
double BullishRisingWedgeTopBuffer[];
double BullishRisingWedgeBottomBuffer[];

// Indicator calculation function
int start()
{
   // Loop through the bars on the chart
   for(int i = Bars - 1; i > 2; i--)
   {
      // Bearish Falling Wedge pattern
      if(BearishFallingWedge)
      {
         double resistanceLine = High[i];
         double supportLine = Low[i];
         int resistanceCount = 0;
         int supportCount = 0;
         bool found = false;
         
         // Loop through the previous bars to check for the pattern
         for(int j = i - 1; j > 0; j--)
         {
            if(High[j] >= resistanceLine && Low[j] > supportLine)
            {
               resistanceCount++;
               resistanceLine = High[j];
               supportLine = Low[j];
            }
            else if(Low[j] <= supportLine && High[j] < resistanceLine)
            {
               supportCount++;
               resistanceLine = High[j];
               supportLine = Low[j];
            }
            else
            {
               break;
            }
            
            if(resistanceCount >= 2 && supportCount >= 2)
            {
               found = true;
               break;
            }
         }
         
         // If the pattern is found, plot the lines
         if(found)
         {
            BearishFallingWedgeTopBuffer[i] = resistanceLine;
            BearishFallingWedgeBottomBuffer[i] = supportLine;
         }
      }
      
      // Bearish Rising Wedge pattern
      if(BearishRisingWedge)
      {
         double resistanceLine = High[i];
         double supportLine = Low[i];
         int resistanceCount = 0;
         int supportCount = 0;
         bool found = false;
         
         // Loop through the previous bars to check for the pattern
         for(int j = i - 1; j > 0; j--)
         {
            if(High[j] >= resistanceLine && Low[j] > supportLine)
            {
               resistanceCount++;
               resistanceLine = High[j];
               supportLine = Low[j];
            }
            else if(Low[j] <= supportLine && High[j] < resistanceLine)
            {
               supportCount++;
               resistanceLine = High[j];
               supportLine = Low[j];
            }
            else
            {
               break;
            }
            
            if(resistanceCount >= 2 && supportCount >= 2)
            {
               found = true;
               break;
            }
         }
         
         // If the pattern is found, plot the lines
         if(found)
         {
            BearishRisingWedgeTopBuffer[i] = resistanceLine;
            BearishRisingWedgeBottomBuffer[i] = supportLine;
         }
      }
      
      // Bullish Falling Wedge pattern
      if(BullishFallingWedge)
      {
         double resistanceLine


Re: MT4 Indicator requests and ideas

17989
kvak wrote: Thu Mar 16, 2023 10:32 am Look here mtf HA smoothed
Only for 1 hr timeframe, you mean hard coded only 1 hour?
OOOO thank you !!!! that works too

i thought it would be easier and smoother if there was only one option because you dont have to pick it
all the user would have to do is edit the time in the code for their specific timeframe
These users thanked the author Chickenspicy for the post:
kvak
0 + 0 = 0
Infinite / Infinite = 1
1 way to Heaven & it matters


Who is online

Users browsing this forum: Amazon [Bot], Jimmy, Majestic-12 [Bot], mrtools, rudiarius, SEMrush [Bot], Xxcoincoin and 95 guests