Requests & Ideas, the beginning - page 146

 
Henrypips:

Dear Mladen.

Thanks for your help in times past, and your untiring support to this forum.


I would like to have the classic Bollinger bands modified so that the inputs could be wider.

For instance the Moving average could be changed to EMA, SSMA, or LWMA instead of just the traditional SMA.

The Price field could have the options of Open, Close, High, Low, Median, typical and Weighted.

We would still retain the options to vary the Shift and Standard Deviation to suit the users purposes.

To make it truly exceptional, if the middle line could change colour to show Bullish/Bearish bias.

Thanks in advance.

Someone gave me this, only thing needed is the middle line colour change
Files:
bands_mod.mq4  3 kb
 

dear mladen

 

cud u pls tell me if the way the following indicator calculates volume is equivalent to bid ask volume   ? 

 
mladen:

mntiwana


Here is the upgraded version :


Dearest MLADEN

so many thanks for updating/upgrading (adding HA prices) "onchart cci" it really helped reducing few false signals ...... do you think it also needs adding some thing (1 or 1_1) in indicator name so that differentiate it from previous ver

regards

 

dear Mladen,

 

inserted codes from line 205  to 239 to get the delta values in each swing point instead of the total tick volume...but nothing shows on the chart...cud u please correct it..

Files:
 
rashme:

dear Mladen,

 

I inserted codes from line 205  to 239 to get the delta values in each swing point instead of the total tick volume...but nothing shows on the chart...cud u please correct it..

rashme

I still can not see uploaded files. Can you post the code as described here : https://www.forex-tsd.com/forum/announcements-forex-press/1809030-temporary-workaround-for-source-mq4-files-upload

 
mladen:

rashme

I still can not see uploaded files. Can you post the code as described here : https://www.forex-tsd.com/forum/announcements-forex-press/1809030-temporary-workaround-for-source-mq4-files-upload

 

//+------------------------------------------------------------------+
//|                                                    WeisWave3.mq4 |
//|         This code comes as is and carries NO WARRANTY whatsoever |
//|                                            Use at your own risk! |
//+------------------------------------------------------------------+
#property strict
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_buffers 2
#property indicator_plots   2
//--- plot upVolume
#property indicator_label1  "upVolume"
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrGreen
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2
//--- plot dnVolume
#property indicator_label2  "dnVolume"
#property indicator_type2   DRAW_HISTOGRAM
#property indicator_color2  clrFireBrick
#property indicator_style2  STYLE_SOLID
#property indicator_width2  2
//--- input parameters
input int      Difference = 100;
input int      LabelShift = 25;
input bool     ShowVolumeLabels = true;
input int      DivBy = 1;
input color    WaveColor  = clrWheat;
input int      WaveWidth  = 1;

//--- indicator buffers
double         upVolumeBuffer[];
double         dnVolumeBuffer[];
double         barDirection[];
double         trendDirection[];
double         waveDirection[];

double         P1Buffer[];
double         P2Buffer[];
long           volumeTracker = 0;

double         highestHigh = EMPTY_VALUE;
double         lowestLow   = EMPTY_VALUE;
int            hhBar = EMPTY_VALUE;
int            llBar = EMPTY_VALUE;

double P1;
double P2;
double         Delta[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   IndicatorBuffers(5);

   SetIndexBuffer(0, upVolumeBuffer);
   SetIndexBuffer(1, dnVolumeBuffer);
   SetIndexBuffer(2, barDirection);
   SetIndexBuffer(3, trendDirection);
   SetIndexBuffer(4, waveDirection);
   SetIndexBuffer(5, P1Buffer);
   SetIndexBuffer(6, P2Buffer);
   SetIndexBuffer(6, Delta);
  

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   for(int i = ObjectsTotal() - 1; i >= 0; i--)
     {
       string Label = ObjectName(i);
       if (StringCompare("ED8847DC", StringSubstr(Label, 0, 12), true) == 0)
       {
         ObjectDelete(Label);
       }
     }

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   // Only compute bars on new bar
   if (rates_total == prev_calculated) return(rates_total);
   RefreshRates();
   int limit = rates_total - 1;

   int  waveChangeBar = limit - 1;

   // Initialise values
   if (highestHigh == EMPTY_VALUE) highestHigh = close[waveChangeBar];
   if (lowestLow == EMPTY_VALUE) lowestLow = close[waveChangeBar];
   if (hhBar == EMPTY_VALUE) hhBar = waveChangeBar;
   if (llBar == EMPTY_VALUE) llBar = waveChangeBar;

   string waveID = "ED8847DC-" + TimeToString(time[waveChangeBar], TIME_DATE|TIME_MINUTES) + "-TL";
                    if (!ObjectFind(0, waveID))
                      {
                          ObjectCreate(0, waveID, OBJ_TREND, 0, time[waveChangeBar], close[waveChangeBar], time[waveChangeBar], close[waveChangeBar]);
                          ObjectSet(waveID, OBJPROP_RAY, false);
                          ObjectSet(waveID, OBJPROP_WIDTH, WaveWidth);
                          ObjectSet(waveID, OBJPROP_COLOR, WaveColor);
                      }
           double shift = LabelShift / MathPow(10, Digits);

                     for(int i=limit-1; i>=0; i--)
                     {
                            // Determine this bar's direction
                                if (close[i] - close[i+1] >  0) barDirection[i] =  1;    // current close higher
                                if (close[i] - close[i+1] == 0) barDirection[i] =  0;    // current close equal
                                if (close[i] - close[i+1] <  0) barDirection[i] = -1;    // current close lower

                                if (barDirection[limit]   == EMPTY_VALUE) barDirection[limit]   = barDirection[i];
                                if (trendDirection[limit] == EMPTY_VALUE) trendDirection[limit] = barDirection[i];
                                if (waveDirection[limit]  == EMPTY_VALUE) waveDirection[limit]  = barDirection[i];

                                   // Determine highset high and lowest low
                                         if (close[i] > highestHigh)
                                                  {
                                                      highestHigh = close[i];
                                                      hhBar = i;
                                                  }
                                          else if (close[i] < lowestLow)
                                                 {
                                                   lowestLow = close[i];
                                                   llBar = i;
                                                 }
                                   // Determine if this bar has started a new trend
                                          if ((barDirection[i] != 0) && (barDirection[i] != barDirection[i+1]))
                                               trendDirection[i] = barDirection[i];
                                          else  trendDirection[i] = trendDirection[i+1];

                                  // Determine if this bar has started a new wave
                                                   double waveTest = 0.0;
                                          if (waveDirection[i+1] == 1)
                                             {
                                                  waveTest = highestHigh;
                                             }
                                          if (waveDirection[i+1] == -1)
                                             {
                                                  waveTest = lowestLow;
                                             }
                                                     double waveDifference = (MathAbs(waveTest - close[i])) * MathPow(10, Digits);
                                           if (trendDirection[i] != waveDirection[i+1])
                                                  {
                                                    if (waveDifference >= Difference)
                                                        waveDirection[i] = trendDirection[i];
                                                    else waveDirection[i] = waveDirection[i+1];
                                                  }
                                           else waveDirection[i] = waveDirection[i+1];

                                                  // Determine if we have started a new wave
                                                       if (waveDirection[i] != waveDirection[i+1])
                                                            {
                                                                if (waveDirection[i] == 1)
                                                                    {
                                                                         highestHigh = close[i];
                                                                         hhBar = i;
                                                                         waveChangeBar = llBar;
                                                                     }
                                                                 else
                                                                     {
                                                                          lowestLow = close[i];
                                                                          llBar = i;
                                                                          waveChangeBar = hhBar;
                                                                     }


         if (waveDirection[waveChangeBar] == 1)
               ObjectSet(waveID, OBJPROP_PRICE2, high[waveChangeBar]);
         else  ObjectSet(waveID, OBJPROP_PRICE2, low[waveChangeBar]);
         ObjectSet(waveID, OBJPROP_TIME2, time[waveChangeBar]);
         waveID = "ED8847DC-" + TimeToString(time[waveChangeBar], TIME_DATE|TIME_MINUTES) + "-TL";
         if (waveDirection[i] == 1)
               ObjectCreate(0, waveID, OBJ_TREND, 0, time[waveChangeBar], low[waveChangeBar], time[i], high[i]);
         else  ObjectCreate(0, waveID, OBJ_TREND, 0, time[waveChangeBar], high[waveChangeBar], time[i], low[i]);

         ObjectSet(waveID, OBJPROP_RAY, false);
         ObjectSet(waveID, OBJPROP_WIDTH, WaveWidth);
         ObjectSet(waveID, OBJPROP_COLOR, WaveColor);

         volumeTracker = 0;
         int ii;
         static int pii=-1;
                               for (int k=waveChangeBar-1; k>=i; k--)
                                      {
                                                 {
                                                      ii = iBarShift(Symbol(), Period(), iTime(Symbol(),PERIOD_M1,k), true);
                                                           //----
                                                             if (pii!=ii)
                                                                     {
                                                                          P1=0;
                                                                          P2=0;
                                                                          P1Buffer[ii]=0;
                                                                          P2Buffer[ii]=0;
                                                                         
                                                                     }
      
                                                              if (ii != -1)
                                                                  {
                                                                    if (iClose(Symbol(),PERIOD_M1,k)>iClose(Symbol(),PERIOD_M1,k+1))
                                                                       {
                                                                          P1 = P1+(iVolume(Symbol(),PERIOD_M1,k));
                                                                       }
                                                                    if (iClose(Symbol(),PERIOD_M1,k)<iClose(Symbol(),PERIOD_M1,k+1))
                                                                       {
                                                                          P2 = P2-(iVolume(Symbol(),PERIOD_M1,k));
                                                                       }
                                                                    if (iClose(Symbol(),PERIOD_M1,k)==iClose(Symbol(),PERIOD_M1,k+1))
                                                                       {
                                                                          P1 = P1+(iVolume(Symbol(),PERIOD_M1,k)/2);
                                                                          P2 = P2-(iVolume(Symbol(),PERIOD_M1,k)/2);
                                                                       }
                                                                   }
                                                                           P1Buffer[ii]=P1;
                                                                           P2Buffer[ii]=P2;
                                                                       //    P3Buffer[ii]= P1+P2;
                                                                           Delta[k]=P1+P2;

                                                                           pii=ii;
                                                     }
                                     
                                     
                                     
                                     
                                         volumeTracker += Delta[k];
                                        
                                        
                                        
                                        if (waveDirection[i] ==  1)
                                           {
                                             upVolumeBuffer[k] = volumeTracker;
                                             dnVolumeBuffer[k] = 0;
                                            }
                                         if (waveDirection[i] == -1)
                                             {
                                               upVolumeBuffer[k] = 0;
                                               dnVolumeBuffer[k] = volumeTracker;
                                             }
                                       }

                 if (ShowVolumeLabels == true)
                         {
                              string volLabel = "ED8847DC-" + TimeToString(time[waveChangeBar], TIME_DATE|TIME_MINUTES) + "-VOL";
                               if (waveDirection[i] == 1)
                                     {
                                           ObjectCreate(0, volLabel, OBJ_TEXT, 0, time[waveChangeBar], low[waveChangeBar]-shift);
                                           ObjectSet(volLabel, OBJPROP_ANGLE, -0);
                                           ObjectSet(volLabel, OBJPROP_ANCHOR, ANCHOR_LEFT);
                                           ObjectSetText(volLabel, DoubleToString(dnVolumeBuffer[waveChangeBar]/DivBy, 0), 12, NULL, clrFireBrick);
                                      }
                                else
                                      {
                                           ObjectCreate(0, volLabel, OBJ_TEXT, 0, time[waveChangeBar], high[waveChangeBar]+shift);
                                           ObjectSet(volLabel, OBJPROP_ANGLE, 0);
                                           ObjectSet(volLabel, OBJPROP_ANCHOR, ANCHOR_LEFT);
                                           ObjectSetText(volLabel, DoubleToString(upVolumeBuffer[waveChangeBar]/DivBy, 0), 12, NULL, clrLightGreen);
                                      }
                          }
      }
      else
      {
         volumeTracker += Delta[i];
      }

      // Add the volume of this bar to the wave, or start again
     
//      if (waveDirection[i] == waveDirection[i+1])
//        {
//         volumeTracker += tick_volume[i];
//      }
//      else {
         //volumeTracker = 0;
         //for (int k=waveChangeBar-1; k>=i; k--) {
         //   volumeTracker += tick_volume[k];
         //   if (waveDirection[i] ==  1) {
         //      upVolumeBuffer[k] = volumeTracker;
         //      dnVolumeBuffer[k] = 0;
         //   }
         //   if (waveDirection[i] == -1) {
         //      upVolumeBuffer[k] = 0;
         //      dnVolumeBuffer[k] = volumeTracker;
         //   }
         //}
//      }

      // Set the indicators
      if (waveDirection[i] ==  1)
      {
         upVolumeBuffer[i] = volumeTracker;
         dnVolumeBuffer[i] = 0;
      }
      if (waveDirection[i] == -1)
       {
         upVolumeBuffer[i] = 0;
         dnVolumeBuffer[i] = volumeTracker;
      }
   }

   ObjectSet(waveID, OBJPROP_PRICE2, close[0]);
   ObjectSet(waveID, OBJPROP_TIME2, time[0]);

//--- return value of prev_calculated for next call
   return(rates_total);
  }

string StringPadLeft (string inStr, ushort padStr, int totalStrLen)
 {
   string result;
   StringInit(result, totalStrLen, padStr);
   result = StringConcatenate(result, inStr);
  
   int pos = StringLen(inStr);
  
   return StringSubstr(result, pos, totalStrLen);
}
//+------------------------------------------------------------------+
 

 
rashme:

rashme

Now it will display it but the values are not correct as far as I see. Will try to find out why

Files:
WeisWave3.1.mq4  17 kb
 

so i been reading alot about market in general & actually found some interesting ideas. one was fractal market hypothesis , i searched about

the rescaled range analysis and it turns out their solid . there's alot of papers about hurst exponent and long memory & modified rescaled range analysis out there showing good result . but i couldnt find any hurst exponent indicator for metatrader with good reviews.why is that ?

another field that showed good result was hidden markov model  which again no "free" indicator is available for it .

 
mladen:

rashme

Now it will display it but the values are not correct as far as I see. Will try to find out why

Dear @mladen,

Can you please attach "cci study 3.4" (or if there is a new version) here?

Because  search function does not work in the forum, i couldn't find it. :(


Can you also make its histo version and attach both?

Thank you...

 
oguz:

Dear @mladen,

Can you please attach "cci study 3.4" (or if there is a new version) here?

Because  search function does not work in the forum, i couldn't find it. :(


Can you also make its histo version and attach both?

Thank you...

I think it is here.

just be care about some extra dashes that are not in original name.

Files:
Reason: