Requests & Ideas - page 541

 
nevar:

Thanks Mladen,

I have found something interesting about prediction.

To my surprise it is producing logical results even in a case when all prices are the same (with some prices sorting prior to calculations, just for the sake of keeping the inputs as logical as possible - lower example is for all close prices)

Here it is (some upgrades too, not just the prices) : HiLow channel 2 Jurik double smooth (prices).mq4

 

Thank you very much

 
lucmat:

Thanks a lot Tampa!

You are welcome

 

Hey,


i am looking for an indicator that draw an arror.

If Support or Ressistance is touched the 3rd time, there should be drawn the arrow.


Did you have something like this?

Thank you

FrankM.

 
FrankM:

Hey,


i am looking for an indicator that draw an arror.

If Support or Ressistance is touched the 3rd time, there should be drawn the arrow.


Did you have something like this?

Thank you

FrankM.

for start : what SR?
 

Hey mladen,

it should work on horizontal S/R Lines.

It will be absolute perfect if it will work in S/R Channels, but channels are more complex in code.

So i am happy if there is anything out there.


Actually i draw S/R manually in Time Frame 1h or 15 min than i trade in 1 min.

I just want to automate this a little bid.

In effect there should be Arrows ...


If you would have anything like this, it will be "super"

I have no claim into a special Indicator in the background.


Thank you for response,

FrankM

 
FrankM:

Hey mladen,

it should work on horizontal S/R Lines.

It will be absolute perfect if it will work in S/R Channels, but channels are more complex in code.

So i am happy if there is anything out there.


Actually i draw S/R manually in Time Frame 1h or 15 min than i trade in 1 min.

I just want to automate this a little bid.

In effect there should be Arrows ...


If you would have anything like this, it will be "super"

I have no claim into a special Indicator in the background.


Thank you for response,

FrankM

Will have to check that
 

Dear Mladen, 

Please add some alert in this better bollinger bands smooth b nrp mtf 2.01 

 

#property indicator_separate_window

#property indicator_buffers     3

#property indicator_color1      LimeGreen

#property indicator_color2      Red

#property indicator_color3      Red

#property indicator_width1      2

#property indicator_width2      2

#property indicator_width3      2

#property indicator_level1      0

#property indicator_level2      0.50

#property indicator_level3      1.00

#property indicator_levelcolor  MediumOrchid


//

//

//

//

//


extern ENUM_TIMEFRAMES    TimeFrame      = PERIOD_CURRENT;

extern double             BandsPeriod    = 20;

extern ENUM_APPLIED_PRICE BandsPrice     = 0;

extern double             BandsDeviation = 2.0;

extern double             T3Hot          = 1.0;

extern bool               T3Original     = false;

//

//

//

//

//


double Buffer[];

double BufferDa[];

double BufferDb[];

double trend[];

double tBuffer[][4];

string indicatorFileName;

bool   returnBars;


//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

//

//

//

//

//


int init()

{

    IndicatorBuffers(4);

    SetIndexBuffer(0,Buffer);

    SetIndexBuffer(1,BufferDa);

    SetIndexBuffer(2,BufferDb);

    SetIndexBuffer(3,trend);

   

    //

    //

    //

    //

    //

    

    indicatorFileName = WindowExpertName();

    returnBars        = TimeFrame==-99;

    TimeFrame         = MathMax(TimeFrame,_Period);

      

    //

    //

    //

    //

    //

   

    IndicatorShortName(timeFrameToString(TimeFrame)+"   BB Percent");

 return(0);

}


int deinit() { return(0); }


//

//

//

//

//


#define iMt1 0

#define iMt2 1

#define iUt1 2

#define iUt2 3


int start() 

{

   int counted_bars=IndicatorCounted();

   int i,r,limit;


   if(counted_bars<0) return(-1);

   if(counted_bars>0) counted_bars--;

         limit=MathMin(Bars-1,Bars-counted_bars-1);

         if (returnBars) { Buffer[0] = limit+1; return(0); }

         if (ArrayRange(tBuffer,0) != Bars) ArrayResize(tBuffer,Bars);  

         

   //

   //

   //

   //

   //

   

   double alpha =  2.0/(BandsPeriod+1.0);

   if (TimeFrame == Period())

   {

      if (trend[limit] == -1) ClearPoint(limit,BufferDa,BufferDb);

      for (i=limit, r=Bars-i-1; i>=0; i--,r++)

      {

          double price = iMA(NULL,0,1,0,MODE_SMA,BandsPrice,i);

         

          //

          //

          //

          //

          //

         

            tBuffer[r][iMt1] = tBuffer[r-1][iMt1] + alpha*(price           -tBuffer[r-1][iMt1]);

            tBuffer[r][iUt1] = tBuffer[r-1][iUt1] + alpha*(tBuffer[r][iMt1]-tBuffer[r-1][iUt1]);

               double dt  = ((2-alpha)*tBuffer[r][iMt1]-tBuffer[r][iUt1])/(1-alpha);

            

            tBuffer[r][iMt2] = tBuffer[r-1][iMt2] + alpha*(MathAbs(price-dt)-tBuffer[r-1][iMt2]);

            tBuffer[r][iUt2] = tBuffer[r-1][iUt2] + alpha*(tBuffer[r][iMt2] -tBuffer[r-1][iUt2]);

               double dt2 = ((2-alpha)*tBuffer[r][iMt2]-tBuffer[r][iUt2])/(1-alpha);


         //

         //

         //

         //

      

         double Upper  = dt+BandsDeviation*dt2;

         double Lower  = dt-BandsDeviation*dt2;

         double diff   = (Upper-Lower);

             if (diff != 0)

                  Buffer[i] = iT3((Close[i]-Lower)/(Upper-Lower),BandsPeriod,T3Hot,T3Original,i);

             else Buffer[i] = iT3(0                             ,BandsPeriod,T3Hot,T3Original,i);;

             

             //

             //

             //

             //

             //

             

             BufferDa[i] = EMPTY_VALUE;

             BufferDb[i] = EMPTY_VALUE;

             trend[i]    = trend[i+1];

             if (Buffer[i]>Buffer[i+1]) trend[i] = 1;

             if (Buffer[i]<Buffer[i+1]) trend[i] =-1;

             if (trend[i] == -1) PlotPoint(i,BufferDa,BufferDb,Buffer);

      }

   return(0);

   }

   

   //

   //

   //

   //

   //

   

   limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,TimeFrame,indicatorFileName,-99,0,0)*TimeFrame/Period()));

   if (trend[limit]==-1) ClearPoint(limit,BufferDa,BufferDb); 

   for (i=limit; i>=0; i--)

   {

       int y = iBarShift(NULL,TimeFrame,Time[i]);

          Buffer[i]   = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,BandsPeriod,BandsPrice,BandsDeviation,T3Hot,T3Original,0,y);

          trend[i]    = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,BandsPeriod,BandsPrice,BandsDeviation,T3Hot,T3Original,3,y);

          BufferDa[i] = EMPTY_VALUE; 

          BufferDb[i] = EMPTY_VALUE;

   }

   for(i=limit; i>=0; i--) if (trend[i]== -1) PlotPoint(i,BufferDa,BufferDb,Buffer);

   return(0);

}


//-------------------------------------------------------------------

//

//-------------------------------------------------------------------

//

//

//

//

//


string sTfTable[] = {"M1","M5","M10","M15","M30","H1","H4","D1","W1","MN"};

int    iTfTable[] = {1,5,10,15,30,60,240,1440,10080,43200};


string timeFrameToString(int tf)

{

   for (int i=ArraySize(iTfTable)-1; i>=0; i--) 

         if (tf==iTfTable[i]) return(sTfTable[i]);

                              return("");

}


//+------------------------------------------------------------------

//|

//+------------------------------------------------------------------

//

//

//

//

//


double workT3[][6];

double workT3Coeffs[][6];

#define _period 0

#define _c1     1

#define _c2     2

#define _c3     3

#define _c4     4

#define _alpha  5


//

//

//

//

//


double iT3(double price, double period, double hot, bool original, int i, int forInstance=0)

{

   if (ArrayRange(workT3,0) !=Bars)                  ArrayResize(workT3,Bars);

   if (ArrayRange(workT3Coeffs,0) < (forInstance+1)) ArrayResize(workT3Coeffs,forInstance+1);


   if (workT3Coeffs[forInstance][_period] != period)

   {

     workT3Coeffs[forInstance][_period] = period;

        double a = hot;

            workT3Coeffs[forInstance][_c1] = -a*a*a;

            workT3Coeffs[forInstance][_c2] = 3*a*a+3*a*a*a;

            workT3Coeffs[forInstance][_c3] = -6*a*a-3*a-3*a*a*a;

            workT3Coeffs[forInstance][_c4] = 1+3*a+a*a*a+3*a*a;

            if (original)

                 workT3Coeffs[forInstance][_alpha] = 2.0/(1.0 + period);

            else workT3Coeffs[forInstance][_alpha] = 2.0/(2.0 + (period-1.0)/2.0);

   }

   

   //

   //

   //

   //

   //

   

   int buffer = forInstance*6;

   int r = Bars-i-1;

   if (r == 0)

      {

         workT3[r][0+buffer] = price;

         workT3[r][1+buffer] = price;

         workT3[r][2+buffer] = price;

         workT3[r][3+buffer] = price;

         workT3[r][4+buffer] = price;

         workT3[r][5+buffer] = price;

      }

   else

      {

         workT3[r][0+buffer] = workT3[r-1][0+buffer]+workT3Coeffs[forInstance][_alpha]*(price              -workT3[r-1][0+buffer]);

         workT3[r][1+buffer] = workT3[r-1][1+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][0+buffer]-workT3[r-1][1+buffer]);

         workT3[r][2+buffer] = workT3[r-1][2+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][1+buffer]-workT3[r-1][2+buffer]);

         workT3[r][3+buffer] = workT3[r-1][3+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][2+buffer]-workT3[r-1][3+buffer]);

         workT3[r][4+buffer] = workT3[r-1][4+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][3+buffer]-workT3[r-1][4+buffer]);

         workT3[r][5+buffer] = workT3[r-1][5+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][4+buffer]-workT3[r-1][5+buffer]);

      }


   //

   //

   //

   //

   //

   

   return(workT3Coeffs[forInstance][_c1]*workT3[r][5+buffer] + 

          workT3Coeffs[forInstance][_c2]*workT3[r][4+buffer] + 

          workT3Coeffs[forInstance][_c3]*workT3[r][3+buffer] + 

          workT3Coeffs[forInstance][_c4]*workT3[r][2+buffer]);

}


//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

//

//

//

//

//


void ClearPoint(int i,double& first[],double& second[])

{

   if ((second[i]  != EMPTY_VALUE) && (second[i+1] != EMPTY_VALUE))

        second[i+1] = EMPTY_VALUE;

   else

      if ((first[i] != EMPTY_VALUE) && (first[i+1] != EMPTY_VALUE) && (first[i+2] == EMPTY_VALUE))

          first[i+1] = EMPTY_VALUE;

}


//

//

//

//

//


void PlotPoint(int i,double& first[],double& second[],double& from[])

{

   if (first[i+1] == EMPTY_VALUE)

      {

      if (first[i+2] == EMPTY_VALUE) {

          first[i]    = from[i];

          first[i+1]  = from[i+1];

          second[i]   = EMPTY_VALUE;

         }

      else {

          second[i]   = from[i];

          second[i+1] = from[i+1];

          first[i]    = EMPTY_VALUE;

         }

      }

   else

      {

         first[i]   = from[i];

         second[i]  = EMPTY_VALUE;

      }

}


 
NKTrade:

Dear Mladen, 

Please add some alert in this better bollinger bands smooth b nrp mtf 2.01 

 

#property indicator_separate_window

#property indicator_buffers     3

#property indicator_color1      LimeGreen

#property indicator_color2      Red

#property indicator_color3      Red

#property indicator_width1      2

#property indicator_width2      2

#property indicator_width3      2

#property indicator_level1      0

#property indicator_level2      0.50

#property indicator_level3      1.00

#property indicator_levelcolor  MediumOrchid


//

//

//

//

//


extern ENUM_TIMEFRAMES    TimeFrame      = PERIOD_CURRENT;

extern double             BandsPeriod    = 20;

extern ENUM_APPLIED_PRICE BandsPrice     = 0;

extern double             BandsDeviation = 2.0;

extern double             T3Hot          = 1.0;

extern bool               T3Original     = false;

//

//

//

//

//


double Buffer[];

double BufferDa[];

double BufferDb[];

double trend[];

double tBuffer[][4];

string indicatorFileName;

bool   returnBars;


//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

//

//

//

//

//


int init()

{

    IndicatorBuffers(4);

    SetIndexBuffer(0,Buffer);

    SetIndexBuffer(1,BufferDa);

    SetIndexBuffer(2,BufferDb);

    SetIndexBuffer(3,trend);

   

    //

    //

    //

    //

    //

    

    indicatorFileName = WindowExpertName();

    returnBars        = TimeFrame==-99;

    TimeFrame         = MathMax(TimeFrame,_Period);

      

    //

    //

    //

    //

    //

   

    IndicatorShortName(timeFrameToString(TimeFrame)+"   BB Percent");

 return(0);

}


int deinit() { return(0); }


//

//

//

//

//


#define iMt1 0

#define iMt2 1

#define iUt1 2

#define iUt2 3


int start() 

{

   int counted_bars=IndicatorCounted();

   int i,r,limit;


   if(counted_bars<0) return(-1);

   if(counted_bars>0) counted_bars--;

         limit=MathMin(Bars-1,Bars-counted_bars-1);

         if (returnBars) { Buffer[0] = limit+1; return(0); }

         if (ArrayRange(tBuffer,0) != Bars) ArrayResize(tBuffer,Bars);  

         

   //

   //

   //

   //

   //

   

   double alpha =  2.0/(BandsPeriod+1.0);

   if (TimeFrame == Period())

   {

      if (trend[limit] == -1) ClearPoint(limit,BufferDa,BufferDb);

      for (i=limit, r=Bars-i-1; i>=0; i--,r++)

      {

          double price = iMA(NULL,0,1,0,MODE_SMA,BandsPrice,i);

         

          //

          //

          //

          //

          //

         

            tBuffer[r][iMt1] = tBuffer[r-1][iMt1] + alpha*(price           -tBuffer[r-1][iMt1]);

            tBuffer[r][iUt1] = tBuffer[r-1][iUt1] + alpha*(tBuffer[r][iMt1]-tBuffer[r-1][iUt1]);

               double dt  = ((2-alpha)*tBuffer[r][iMt1]-tBuffer[r][iUt1])/(1-alpha);

            

            tBuffer[r][iMt2] = tBuffer[r-1][iMt2] + alpha*(MathAbs(price-dt)-tBuffer[r-1][iMt2]);

            tBuffer[r][iUt2] = tBuffer[r-1][iUt2] + alpha*(tBuffer[r][iMt2] -tBuffer[r-1][iUt2]);

               double dt2 = ((2-alpha)*tBuffer[r][iMt2]-tBuffer[r][iUt2])/(1-alpha);


         //

         //

         //

         //

      

         double Upper  = dt+BandsDeviation*dt2;

         double Lower  = dt-BandsDeviation*dt2;

         double diff   = (Upper-Lower);

             if (diff != 0)

                  Buffer[i] = iT3((Close[i]-Lower)/(Upper-Lower),BandsPeriod,T3Hot,T3Original,i);

             else Buffer[i] = iT3(0                             ,BandsPeriod,T3Hot,T3Original,i);;

             

             //

             //

             //

             //

             //

             

             BufferDa[i] = EMPTY_VALUE;

             BufferDb[i] = EMPTY_VALUE;

             trend[i]    = trend[i+1];

             if (Buffer[i]>Buffer[i+1]) trend[i] = 1;

             if (Buffer[i]<Buffer[i+1]) trend[i] =-1;

             if (trend[i] == -1) PlotPoint(i,BufferDa,BufferDb,Buffer);

      }

   return(0);

   }

   

   //

   //

   //

   //

   //

   

   limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,TimeFrame,indicatorFileName,-99,0,0)*TimeFrame/Period()));

   if (trend[limit]==-1) ClearPoint(limit,BufferDa,BufferDb); 

   for (i=limit; i>=0; i--)

   {

       int y = iBarShift(NULL,TimeFrame,Time[i]);

          Buffer[i]   = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,BandsPeriod,BandsPrice,BandsDeviation,T3Hot,T3Original,0,y);

          trend[i]    = iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,BandsPeriod,BandsPrice,BandsDeviation,T3Hot,T3Original,3,y);

          BufferDa[i] = EMPTY_VALUE; 

          BufferDb[i] = EMPTY_VALUE;

   }

   for(i=limit; i>=0; i--) if (trend[i]== -1) PlotPoint(i,BufferDa,BufferDb,Buffer);

   return(0);

}


//-------------------------------------------------------------------

//

//-------------------------------------------------------------------

//

//

//

//

//


string sTfTable[] = {"M1","M5","M10","M15","M30","H1","H4","D1","W1","MN"};

int    iTfTable[] = {1,5,10,15,30,60,240,1440,10080,43200};


string timeFrameToString(int tf)

{

   for (int i=ArraySize(iTfTable)-1; i>=0; i--) 

         if (tf==iTfTable[i]) return(sTfTable[i]);

                              return("");

}


//+------------------------------------------------------------------

//|

//+------------------------------------------------------------------

//

//

//

//

//


double workT3[][6];

double workT3Coeffs[][6];

#define _period 0

#define _c1     1

#define _c2     2

#define _c3     3

#define _c4     4

#define _alpha  5


//

//

//

//

//


double iT3(double price, double period, double hot, bool original, int i, int forInstance=0)

{

   if (ArrayRange(workT3,0) !=Bars)                  ArrayResize(workT3,Bars);

   if (ArrayRange(workT3Coeffs,0) < (forInstance+1)) ArrayResize(workT3Coeffs,forInstance+1);


   if (workT3Coeffs[forInstance][_period] != period)

   {

     workT3Coeffs[forInstance][_period] = period;

        double a = hot;

            workT3Coeffs[forInstance][_c1] = -a*a*a;

            workT3Coeffs[forInstance][_c2] = 3*a*a+3*a*a*a;

            workT3Coeffs[forInstance][_c3] = -6*a*a-3*a-3*a*a*a;

            workT3Coeffs[forInstance][_c4] = 1+3*a+a*a*a+3*a*a;

            if (original)

                 workT3Coeffs[forInstance][_alpha] = 2.0/(1.0 + period);

            else workT3Coeffs[forInstance][_alpha] = 2.0/(2.0 + (period-1.0)/2.0);

   }

   

   //

   //

   //

   //

   //

   

   int buffer = forInstance*6;

   int r = Bars-i-1;

   if (r == 0)

      {

         workT3[r][0+buffer] = price;

         workT3[r][1+buffer] = price;

         workT3[r][2+buffer] = price;

         workT3[r][3+buffer] = price;

         workT3[r][4+buffer] = price;

         workT3[r][5+buffer] = price;

      }

   else

      {

         workT3[r][0+buffer] = workT3[r-1][0+buffer]+workT3Coeffs[forInstance][_alpha]*(price              -workT3[r-1][0+buffer]);

         workT3[r][1+buffer] = workT3[r-1][1+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][0+buffer]-workT3[r-1][1+buffer]);

         workT3[r][2+buffer] = workT3[r-1][2+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][1+buffer]-workT3[r-1][2+buffer]);

         workT3[r][3+buffer] = workT3[r-1][3+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][2+buffer]-workT3[r-1][3+buffer]);

         workT3[r][4+buffer] = workT3[r-1][4+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][3+buffer]-workT3[r-1][4+buffer]);

         workT3[r][5+buffer] = workT3[r-1][5+buffer]+workT3Coeffs[forInstance][_alpha]*(workT3[r][4+buffer]-workT3[r-1][5+buffer]);

      }


   //

   //

   //

   //

   //

   

   return(workT3Coeffs[forInstance][_c1]*workT3[r][5+buffer] + 

          workT3Coeffs[forInstance][_c2]*workT3[r][4+buffer] + 

          workT3Coeffs[forInstance][_c3]*workT3[r][3+buffer] + 

          workT3Coeffs[forInstance][_c4]*workT3[r][2+buffer]);

}


//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

//

//

//

//

//


void ClearPoint(int i,double& first[],double& second[])

{

   if ((second[i]  != EMPTY_VALUE) && (second[i+1] != EMPTY_VALUE))

        second[i+1] = EMPTY_VALUE;

   else

      if ((first[i] != EMPTY_VALUE) && (first[i+1] != EMPTY_VALUE) && (first[i+2] == EMPTY_VALUE))

          first[i+1] = EMPTY_VALUE;

}


//

//

//

//

//


void PlotPoint(int i,double& first[],double& second[],double& from[])

{

   if (first[i+1] == EMPTY_VALUE)

      {

      if (first[i+2] == EMPTY_VALUE) {

          first[i]    = from[i];

          first[i+1]  = from[i+1];

          second[i]   = EMPTY_VALUE;

         }

      else {

          second[i]   = from[i];

          second[i+1] = from[i+1];

          first[i]    = EMPTY_VALUE;

         }

      }

   else

      {

         first[i]   = from[i];

         second[i]  = EMPTY_VALUE;

      }

}


On price breaks?
 
Any update in post #5419

mladen: Will have to check that

I hope so ;-)