Elite indicators :) - page 397

forexts2
588
forexts2  

Request for another new indi

Mladen,

Here is a request for another new indicator called Mogalef bands

This code has gone public in May this year on a traders meeting

They are different versions on forums for it now: Ninja, PRT, GraphAT (see attached documents)etc.

but the GrapAT version seems OK

Could please make a Mql4 translation of this code, I think everybody will like it...

Please feel free to do your own modification if needed

Thank you

devinci

****************************************************************

//=======================

// Mogalef Bands - GrapAT

//=======================

//1---- Weighted prices "Mogalef"

//

CP(0)=(High+Low+Open+2*Close)/5

//2---- linear regression Weighted prices P1 periods

//

If RangHisto>=P1 Then

somx = 0

somy = 0

somxx = 0

somxy = 0

For P1 Prices

somx = somx+RangPour

somy = somy+CP

somxx = somxx+RangPour*RangPour

somxy = somxy+RangPour*CP

EndFor

a = (P1*somxy-somx*somy)/(P1*somxx-somx*somx)

b = (somy-a*somx)/P1

MogRegLin = b + a*P1

EndIf

//3---Standard deviation of linear regression on P2 periods

//

If RangHisto>= P1+P2-1 Then

StanDev(0)=StandarDeviation(MogRegLin,P2)

EndIf

//4---- "Mogalef" Bands

//

If RangHisto>=P1+P2 Then

If MogRegLinMogB(1) // NO LAG if Lin Reg is within inside bands

Then

StanDev=StanDev(1)

MogM=MogM(1)

MogH=MogH(1)

MogB=MogB(1)

IfNot // shift/lag when computing new band values

MogM=MogRegLin

MogH=MogRegLin+P3*StanDev

MogB=MogRegLin-P3*StanDev

EndIf

EndIf

//end of code

**************************************************************************

other version:

{*********************************************************

Mogalef Bands easy language Multicharts

**********************************************************}

variables: var0(0), var1(0), HighBand(0), LowBand(0), Mediane(0);

var0 = LinearRegValue((Open+High+Low+(2*Close))/5,3,0);

var1 = StandardDev(var0,7,1);

if currentbar=8 then

begin

HighBand = var0 + 2*var1;

LowBand = var0 - 2*var1;

Mediane = var0;

end

else

if var0 HighBand then

begin

HighBand = var0 + 2*var1;

LowBand = var0 - 2*var1;

Mediane = var0;

end;

Plot1(HighBand,"HighBand");

Plot2(LowBand,"LowBand");

Plot3(Mediane,"Mediane");

*********************************************************

other version:

**************************

Mogalef Bands Ninja trader

**************************

#region Using declarations

using System;

using System.ComponentModel;

using System.Diagnostics;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Xml.Serialization;

using NinjaTrader.Cbi;

using NinjaTrader.Data;

using NinjaTrader.Gui.Chart;

#endregion

// This namespace holds all indicators and is required. Do not change it.

namespace NinjaTrader.Indicator

{

///

/// Enter the description of your new custom indicator here

///

[Description("Enter the description of your new custom indicator here")]

public class MogalefBands : Indicator

{

#region Variables

// Wizard generated variables

// User defined variables (add any user defined variables below)

private DataSeries CPSerie, ESerie, FSerie;

private double nMedian = 0, nHigh = 0, nLow = 0;

private int LinRegPeriode = 3, StdDevPeriode = 7;

#endregion

///

/// This method is used to configure the indicator and is called once before any bar data is loaded.

///

protected override void Initialize()

{

Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "MMedian"));

Add(new Plot(Color.FromKnownColor(KnownColor.Gray), PlotStyle.Line, "MHigh"));

Add(new Plot(Color.FromKnownColor(KnownColor.Gray), PlotStyle.Line, "MLow"));

Overlay = true;

CPSerie = new DataSeries( this );

ESerie = new DataSeries( this );

FSerie = new DataSeries( this );

}

///

/// Called on each bar update event (incoming tick)

///

protected override void OnBarUpdate()

{

// Use this method for calculating your indicator values. Assign a value to each

// plot below by replacing 'Close[0]' with your own formula.

if (CurrentBar < 8)

{

CPSerie.Set((Open[0] + High[0] + Low[0] + (2*Close[0]))/5);

nMedian = CPSerie[0];

nHigh = 0;

nLow = 0;

return;

}

CPSerie.Set((Open[0] + High[0] + Low[0] + (2*Close[0]))/5);

if (CurrentBar > 8 + StdDevPeriode)

{

FSerie.Set(LinReg(CPSerie,LinRegPeriode)[0]);

ESerie.Set(StdDev(FSerie,StdDevPeriode)[0]);

}

else

{

FSerie.Set(CPSerie[0]);

ESerie.Set(0);

}

if (FSerie[0] nHigh)

{

nMedian = FSerie[0];

nHigh = nMedian + (2*ESerie[0]);

nLow = nMedian - (2*ESerie[0]);

}

MMedian.Set(nMedian);

MHigh.Set(nHigh);

MLow.Set(nLow);

}

#region Properties

// this line prevents the data series from being displayed in the indicator properties dialog, do not remove

[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove

public DataSeries MMedian

{

get { return Values[0]; }

}

// this line prevents the data series from being displayed in the indicator properties dialog, do not remove

[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove

public DataSeries MHigh

{

get { return Values[1]; }

}

// this line prevents the data series from being displayed in the indicator properties dialog, do not remove

[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove

public DataSeries MLow

{

get { return Values[2]; }

}

[Description("")]

[Category("Parameters")]

[Gui.Design.DisplayName("LinReg periode")]

public int LinRegPERIODE

{

get { return LinRegPeriode; }

set { LinRegPeriode = Math.Max(1, value); }

}

[Description("")]

[Category("Parameters")]

[Gui.Design.DisplayName("StdDev periode")]

public int StdDevPERIODE

{

get { return StdDevPeriode; }

set { StdDevPeriode = Math.Max(1, value); }

}

#endregion

}

}

******************************************************************

******************************************************************
Files:
example1.png 37 kb
William Snyder
9496
William Snyder  
camisa:
arrows, please? (same for Mladen's new QQE please)

Hi Camisa,

Here's the arrows versions also added alerts to the QQE when all 3 cross.

updated versions posted here: https://www.mql5.com/en/forum/general

Mladen Rakic
151616
Mladen Rakic  

devinci

Here you go Used default parameters they are using and added the price they are using (the (High+Low+Open+2*Close)/5 which does not exist in metatrader) Use 8 in BandsPrice parameter to get that price.

PS: I edited your post in order to make it "visually shorter". Nothing else was altered in it. Hope you don't mind

regards

Mladen

devinci:
Mladen,

Here is a request for another new indicator called Mogalef bands

This code has gone public in May this year on a traders meeting

They are different versions on forums for it now: Ninja, PRT, GraphAT (see attached documents)etc.

but the GrapAT version seems OK

Could please make a Mql4 translation of this code, I think everybody will like it...

Please feel free to do your own modification if needed

Thank you

devinci

****************************************************************

//=======================

// Mogalef Bands - GrapAT

//=======================

//1---- Weighted prices "Mogalef"

//

CP(0)=(High+Low+Open+2*Close)/5

//2---- linear regression Weighted prices P1 periods

//

If RangHisto>=P1 Then

somx = 0

somy = 0

somxx = 0

somxy = 0

For P1 Prices

somx = somx+RangPour

somy = somy+CP

somxx = somxx+RangPour*RangPour

somxy = somxy+RangPour*CP

EndFor

a = (P1*somxy-somx*somy)/(P1*somxx-somx*somx)

b = (somy-a*somx)/P1

MogRegLin = b + a*P1

EndIf

//3---Standard deviation of linear regression on P2 periods

//

If RangHisto>= P1+P2-1 Then

StanDev(0)=StandarDeviation(MogRegLin,P2)

EndIf

//4---- "Mogalef" Bands

//

If RangHisto>=P1+P2 Then

If MogRegLinMogB(1) // NO LAG if Lin Reg is within inside bands

Then

StanDev=StanDev(1)

MogM=MogM(1)

MogH=MogH(1)

MogB=MogB(1)

IfNot // shift/lag when computing new band values

MogM=MogRegLin

MogH=MogRegLin+P3*StanDev

MogB=MogRegLin-P3*StanDev

EndIf

EndIf

//end of code

**************************************************************************

other version:

{*********************************************************

Mogalef Bands easy language Multicharts

**********************************************************}

variables: var0(0), var1(0), HighBand(0), LowBand(0), Mediane(0);

var0 = LinearRegValue((Open+High+Low+(2*Close))/5,3,0);

var1 = StandardDev(var0,7,1);

if currentbar=8 then

begin

HighBand = var0 + 2*var1;

LowBand = var0 - 2*var1;

Mediane = var0;

end

else

if var0 HighBand then

begin

HighBand = var0 + 2*var1;

LowBand = var0 - 2*var1;

Mediane = var0;

end;

Plot1(HighBand,"HighBand");

Plot2(LowBand,"LowBand");

Plot3(Mediane,"Mediane");

*********************************************************

other version:

**************************

Mogalef Bands Ninja trader

**************************

#region Using declarations

using System;

using System.ComponentModel;

using System.Diagnostics;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Xml.Serialization;

using NinjaTrader.Cbi;

using NinjaTrader.Data;

using NinjaTrader.Gui.Chart;

#endregion

// This namespace holds all indicators and is required. Do not change it.

namespace NinjaTrader.Indicator

{

///

/// Enter the description of your new custom indicator here

///

[Description("Enter the description of your new custom indicator here")]

public class MogalefBands : Indicator

{

#region Variables

// Wizard generated variables

// User defined variables (add any user defined variables below)

private DataSeries CPSerie, ESerie, FSerie;

private double nMedian = 0, nHigh = 0, nLow = 0;

private int LinRegPeriode = 3, StdDevPeriode = 7;

#endregion

///

/// This method is used to configure the indicator and is called once before any bar data is loaded.

///

protected override void Initialize()

{

Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "MMedian"));

Add(new Plot(Color.FromKnownColor(KnownColor.Gray), PlotStyle.Line, "MHigh"));

Add(new Plot(Color.FromKnownColor(KnownColor.Gray), PlotStyle.Line, "MLow"));

Overlay = true;

CPSerie = new DataSeries( this );

ESerie = new DataSeries( this );

FSerie = new DataSeries( this );

}

///

/// Called on each bar update event (incoming tick)

///

protected override void OnBarUpdate()

{

// Use this method for calculating your indicator values. Assign a value to each

// plot below by replacing 'Close[0]' with your own formula.

if (CurrentBar < 8)

{

CPSerie.Set((Open[0] + High[0] + Low[0] + (2*Close[0]))/5);

nMedian = CPSerie[0];

nHigh = 0;

nLow = 0;

return;

}

CPSerie.Set((Open[0] + High[0] + Low[0] + (2*Close[0]))/5);

if (CurrentBar > 8 + StdDevPeriode)

{

FSerie.Set(LinReg(CPSerie,LinRegPeriode)[0]);

ESerie.Set(StdDev(FSerie,StdDevPeriode)[0]);

}

else

{

FSerie.Set(CPSerie[0]);

ESerie.Set(0);

}

if (FSerie[0] nHigh)

{

nMedian = FSerie[0];

nHigh = nMedian + (2*ESerie[0]);

nLow = nMedian - (2*ESerie[0]);

}

MMedian.Set(nMedian);

MHigh.Set(nHigh);

MLow.Set(nLow);

}

#region Properties

// this line prevents the data series from being displayed in the indicator properties dialog, do not remove

[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove

public DataSeries MMedian

{

get { return Values[0]; }

}

// this line prevents the data series from being displayed in the indicator properties dialog, do not remove

[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove

public DataSeries MHigh

{

get { return Values[1]; }

}

// this line prevents the data series from being displayed in the indicator properties dialog, do not remove

[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove

public DataSeries MLow

{

get { return Values[2]; }

}

[Description("")]

[Category("Parameters")]

[Gui.Design.DisplayName("LinReg periode")]

public int LinRegPERIODE

{

get { return LinRegPeriode; }

set { LinRegPeriode = Math.Max(1, value); }

}

[Description("")]

[Category("Parameters")]

[Gui.Design.DisplayName("StdDev periode")]

public int StdDevPERIODE

{

get { return StdDevPeriode; }

set { StdDevPeriode = Math.Max(1, value); }

}

#endregion

}

}

******************************************************************

******************************************************************
Files:
forexts2
588
forexts2  

Mogalef bands

Mladen,

Thanks a lot , this is perfect

Have a good day

devinci

barbaron
18
barbaron  

And now a histo if possible please

Hi Mladen,

Can you please make from 2 QQE advanced in different time frames the same histogram you made before with the simple QQE (with red green and grey bars)

Thanks in advance

barbaron
18
barbaron  

Mogalef Bands

BTW Nice description of Mogalef Bands and how to use them here http://www.whselfinvest.com/en/trading_strategies_26_Mogalef_Bands.php Enjoy.

Mladen Rakic
151616
Mladen Rakic  

khaliddxd, barbaron

I guess this one covers both requests It is the advanced "combined" version (made to use 2 time frames) but if you use same time frames for time frame 1 and time frame 2 it will show a single advanced QQE as histogram. Just as a quick observation from using the previous version of "combined" too : the 2 time frames combined idea seems to be very good for excluding some false signals in times of strong trend

PS: barbaron, thanks for the link. Nice one PPS : this indicator uses single WP factor. The "other" usual WP factor (the "faster" one) is 2.618

_______________________

Updated version posted here https://www.mql5.com/en/forum/general

barbaron
18
barbaron  

As usual

I know that yo're covered by thousends thanks already, but here is an other one. THANK YOU!

Mladen Rakic
151616
Mladen Rakic  

CCI study ...

Some more fooling around


As a reminder - average methods that can be used are the following :

0 - simple moving average (SMA)

1 - exponential moving average (EMA)

2 - double smoothed exponential moving average *

3 - Double EMA (DEMA) *

4 - Triple EMA (TEMA) *

5 - Smoothed MA (SMMA)

6 - Linear weighted MA (LWMA)

7 - Parabolic weighted MA *

8 - Alexander MA

9 - Volume weighted MA

10 - Hull MA *

11 - Triangular MA

12 - Sine weighted MA

13 - Liner regression value *

14 - NonLag MA *

15 - Zero lag EMA *

* are placed at average name that from my tests were "fast enough" to be used even with longer smoothing periods (above examples are all 15 period smoothed, which is anything but insignificant smoothing)

Files:
cci_1.gif 31 kb
cci_2.gif 28 kb
khaliddxd
52
khaliddxd  

Mladen

Thank you is not sufficient,, so I will say it like that ( how can we live with out you in this forum!!)

Yours,

Khaliddxd