Multi-Timeframe-Indikatoren - Seite 669

 
alessandromagno:
Hallo, kann jemand diese Datei in eine MTF-Datei umwandeln?

Herzlichen Dank!!!

wprv2.mq4

alessandromagno

Probieren Sie es jetzt aus

Aktualisierte Version hier gepostet: https: //www.mql5.com/en/forum/173574

Dateien:
wprv2_mtf.mq4  8 kb
 

Hilfe, bitte!

Brauche Zeitzoneneinstellungen.

 
DMNIK:
Hilfe, bitte! Ich brauche Zeitzoneneinstellungen.

Dmnik, dieser Indikator ist eine dekompilierte Version, haben Sie vielleicht den ursprünglichen Quellcode?

 

Aktualisierter neuer Trendindikator : newtrend_mtf_nmc.mq4

Ursprünglich wurde er hier veröffentlicht: https: //www.mql5.com/en/forum/173574/page389

Dateien:
 
vaider:
newtrend.mq4mtf version_ Danke!

Vaider, hat es mtf gemacht.

Aktualisierte Version hier gepostet: https: //www.mql5.com/en/forum/173574

Dateien:
 

Aktualisierter 3-Barren-Stop-Loss : 3barstoploss_mtf_nmc.mq4

Das Original wurde hier veröffentlicht: https: //www.mql5.com/en/forum/173574/page389

Dateien:
 
niqcom:
Hallo, kann diese indi ein MTF machen ??? Bitte.....

3barstoploss.mq4

Ich danke Ihnen sehr!

niqcom

Hier ist eine Multi-Time-Frame-Version dieses Indikators

Aktualisierte Version hier gepostet: https: //www.mql5.com/en/forum/173574

Dateien:
 

Hallo Programmierer, nur mal eine Frage am Rande.

Bei einem Backtest fand ich diesen Laguerre-Filter besonders interessant. Wird er zurückgemalt? Ich frage das, weil ich in den Optionen die Variable "lookback" sehe.

Handelt es sich um eine Art adaptiven/wiederholenden Indikator?

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

//

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

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 LimeGreen

#property indicator_color2 Orange

#property indicator_color3 Orange

#property indicator_width1 2

#property indicator_width2 2

#property indicator_width3 2

extern string TimeFrame = "Current time frame";

extern int LookBack = 20;

extern int Median = 5;

extern int Price = PRICE_MEDIAN;

double Filter[];

double Filterda[];

double Filterdb[];

double Diff[];

double Slope[];

double sortDiff[];

string indicatorFileName;

bool returnBars;

int timeFrame;

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

//

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

//

//

//

//

//

int init()

{

IndicatorBuffers(5);

SetIndexBuffer(0,Filter);

SetIndexBuffer(1,Filterda);

SetIndexBuffer(2,Filterdb);

SetIndexBuffer(3,Diff);

SetIndexBuffer(4,Slope);

ArrayResize(sortDiff,Median);

indicatorFileName = WindowExpertName();

returnBars = TimeFrame == "returnBars"; if (returnBars) return(0);

timeFrame = stringToTimeFrame(TimeFrame);

return (0);

}

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

//

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

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted();

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

if(counted_bars>0) counted_bars--;

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

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

if (timeFrame!=Period())

{

limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period()));

if (Slope[limit]==-1) CleanPoint(limit,Filterda,Filterdb);

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

{

int y = iBarShift(NULL,timeFrame,Time);

Filter = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",LookBack,Median,Price,0,y);

Slope = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",LookBack,Median,Price,4,y);

Filterda = EMPTY_VALUE;

Filterdb = EMPTY_VALUE;

if (Slope == -1) PlotPoint(i,Filterda,Filterdb,Filter);

}

return(0);

}

//

//

//

//

//

if (Slope[limit]==-1) CleanPoint(limit,Filterda,Filterdb);

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

{

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

Diff = MathAbs(price - Filter);

double hi = Diff[ArrayMaximum(Diff,LookBack,i)];

double lo = Diff[ArrayMinimum(Diff,LookBack,i)];

double alpha = 0;

if (hi!=lo)

{

for (int j=0; j<Median; j++) sortDiff[j] = (Diff-lo)/(hi-lo);

ArraySort(sortDiff,WHOLE_ARRAY,0,MODE_ASCEND);

if (MathMod(Median,2.0) != 0) alpha = sortDiff[Median/2];

else alpha = (sortDiff[Median/2]+sortDiff[(Median/2)-1])/2;

}

Filter = iLaGuerreFilter(price, 1.0-alpha, i, 0);

Filterda = EMPTY_VALUE;

Filterdb = EMPTY_VALUE;

Slope = Slope;

if (Filter>Filter) Slope = 1;

if (Filter<Filter) Slope = -1;

if (Slope == -1) PlotPoint(i,Filterda,Filterdb,Filter);

}

return (0);

}

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

//

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

//

//

//

//

//

double workLagFil[][4];

double iLaGuerreFilter(double price, double gamma, int i, int instanceNo=0)

{

if (ArrayRange(workLagFil,0)!=Bars) ArrayResize(workLagFil,Bars); i=Bars-i-1; instanceNo*=4;

if (gamma<=0) return(price);

//

//

//

//

//

workLagFil = (1.0 - gamma)*price + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

//

//

//

//

//

return((workLagFil+2.0*workLagFil+2.0*workLagFil+workLagFil)/6.0);

}

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

//

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

//

//

//

//

//

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

{

if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE;

else

if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE;

}

//

//

//

//

//

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

{

if (first == EMPTY_VALUE)

{

if (first == EMPTY_VALUE) {

first = from;

first = from;

second = EMPTY_VALUE;

}

else {

second = from;

second = from;

first = EMPTY_VALUE;

}

}

else

{

first = from;

second = EMPTY_VALUE;

}

}

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

//

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

//

//

//

//

//

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

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

//

//

//

//

//

int stringToTimeFrame(string tfs)

{

tfs = stringUpperCase(tfs);

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

if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period()));

return(Period());

}

//

//

//

//

//

string stringUpperCase(string str)

{

string s = str;

for (int length=StringLen(str)-1; length>=0; length--)

{

int tchar = StringGetChar(s, length);

if((tchar > 96 && tchar 223 && tchar < 256))

s = StringSetChar(s, length, tchar - 32);

else if(tchar > -33 && tchar < 0)

s = StringSetChar(s, length, tchar + 224);

}

return(s);

}

 
thefxpros:
Hallo Programmierer, nur eine Frage auf die Schnelle.

Bei einem Backtest fand ich diesen Laguerre-Filter besonders interessant. Stellt er sich neu ein? Ich frage das, weil ich in den Optionen die Variable "lookback" sehe.

Ist es eine Art von adaptiven / repainting Indikator?

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

//

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

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 LimeGreen

#property indicator_color2 Orange

#property indicator_color3 Orange

#property indicator_width1 2

#property indicator_width2 2

#property indicator_width3 2

extern string TimeFrame = "Current time frame";

extern int LookBack = 20;

extern int Median = 5;

extern int Price = PRICE_MEDIAN;

double Filter[];

double Filterda[];

double Filterdb[];

double Diff[];

double Slope[];

double sortDiff[];

string indicatorFileName;

bool returnBars;

int timeFrame;

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

//

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

//

//

//

//

//

int init()

{

IndicatorBuffers(5);

SetIndexBuffer(0,Filter);

SetIndexBuffer(1,Filterda);

SetIndexBuffer(2,Filterdb);

SetIndexBuffer(3,Diff);

SetIndexBuffer(4,Slope);

ArrayResize(sortDiff,Median);

indicatorFileName = WindowExpertName();

returnBars = TimeFrame == "returnBars"; if (returnBars) return(0);

timeFrame = stringToTimeFrame(TimeFrame);

return (0);

}

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

//

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

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted();

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

if(counted_bars>0) counted_bars--;

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

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

if (timeFrame!=Period())

{

limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period()));

if (Slope[limit]==-1) CleanPoint(limit,Filterda,Filterdb);

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

{

int y = iBarShift(NULL,timeFrame,Time);

Filter = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",LookBack,Median,Price,0,y);

Slope = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",LookBack,Median,Price,4,y);

Filterda = EMPTY_VALUE;

Filterdb = EMPTY_VALUE;

if (Slope == -1) PlotPoint(i,Filterda,Filterdb,Filter);

}

return(0);

}

//

//

//

//

//

if (Slope[limit]==-1) CleanPoint(limit,Filterda,Filterdb);

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

{

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

Diff = MathAbs(price - Filter);

double hi = Diff[ArrayMaximum(Diff,LookBack,i)];

double lo = Diff[ArrayMinimum(Diff,LookBack,i)];

double alpha = 0;

if (hi!=lo)

{

for (int j=0; j<Median; j++) sortDiff[j] = (Diff-lo)/(hi-lo);

ArraySort(sortDiff,WHOLE_ARRAY,0,MODE_ASCEND);

if (MathMod(Median,2.0) != 0) alpha = sortDiff[Median/2];

else alpha = (sortDiff[Median/2]+sortDiff[(Median/2)-1])/2;

}

Filter = iLaGuerreFilter(price, 1.0-alpha, i, 0);

Filterda = EMPTY_VALUE;

Filterdb = EMPTY_VALUE;

Slope = Slope;

if (Filter>Filter) Slope = 1;

if (Filter<Filter) Slope = -1;

if (Slope == -1) PlotPoint(i,Filterda,Filterdb,Filter);

}

return (0);

}

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

//

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

//

//

//

//

//

double workLagFil[][4];

double iLaGuerreFilter(double price, double gamma, int i, int instanceNo=0)

{

if (ArrayRange(workLagFil,0)!=Bars) ArrayResize(workLagFil,Bars); i=Bars-i-1; instanceNo*=4;

if (gamma<=0) return(price);

//

//

//

//

//

workLagFil = (1.0 - gamma)*price + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

//

//

//

//

//

return((workLagFil+2.0*workLagFil+2.0*workLagFil+workLagFil)/6.0);

}

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

//

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

//

//

//

//

//

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

{

if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE;

else

if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE;

}

//

//

//

//

//

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

{

if (first == EMPTY_VALUE)

{

if (first == EMPTY_VALUE) {

first = from;

first = from;

second = EMPTY_VALUE;

}

else {

second = from;

second = from;

first = EMPTY_VALUE;

}

}

else

{

first = from;

second = EMPTY_VALUE;

}

}

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

//

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

//

//

//

//

//

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

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

//

//

//

//

//

int stringToTimeFrame(string tfs)

{

tfs = stringUpperCase(tfs);

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

if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period()));

return(Period());

}

//

//

//

//

//

string stringUpperCase(string str)

{

string s = str;

for (int length=StringLen(str)-1; length>=0; length--)

{

int tchar = StringGetChar(s, length);

if((tchar > 96 && tchar 223 && tchar < 256))

s = StringSetChar(s, length, tchar - 32);

else if(tchar > -33 && tchar < 0)

s = StringSetChar(s, length, tchar + 224);

}

return(s);

}

Thefxpros, ich würde sagen adaptiv aber nicht repainting.

 
thefxpros:
Hallo Programmierer, nur eine Frage auf die Schnelle.

Bei einem Backtest fand ich diesen Laguerre-Filter besonders interessant. Stellt er sich neu ein? Ich frage das, weil ich in den Optionen die Variable "lookback" sehe.

Handelt es sich um eine Art adaptiven/nachmalenden Indikator?

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

//

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

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 LimeGreen

#property indicator_color2 Orange

#property indicator_color3 Orange

#property indicator_width1 2

#property indicator_width2 2

#property indicator_width3 2

extern string TimeFrame = "Current time frame";

extern int LookBack = 20;

extern int Median = 5;

extern int Price = PRICE_MEDIAN;

double Filter[];

double Filterda[];

double Filterdb[];

double Diff[];

double Slope[];

double sortDiff[];

string indicatorFileName;

bool returnBars;

int timeFrame;

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

//

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

//

//

//

//

//

int init()

{

IndicatorBuffers(5);

SetIndexBuffer(0,Filter);

SetIndexBuffer(1,Filterda);

SetIndexBuffer(2,Filterdb);

SetIndexBuffer(3,Diff);

SetIndexBuffer(4,Slope);

ArrayResize(sortDiff,Median);

indicatorFileName = WindowExpertName();

returnBars = TimeFrame == "returnBars"; if (returnBars) return(0);

timeFrame = stringToTimeFrame(TimeFrame);

return (0);

}

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

//

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

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted();

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

if(counted_bars>0) counted_bars--;

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

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

if (timeFrame!=Period())

{

limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period()));

if (Slope[limit]==-1) CleanPoint(limit,Filterda,Filterdb);

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

{

int y = iBarShift(NULL,timeFrame,Time);

Filter = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",LookBack,Median,Price,0,y);

Slope = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",LookBack,Median,Price,4,y);

Filterda = EMPTY_VALUE;

Filterdb = EMPTY_VALUE;

if (Slope == -1) PlotPoint(i,Filterda,Filterdb,Filter);

}

return(0);

}

//

//

//

//

//

if (Slope[limit]==-1) CleanPoint(limit,Filterda,Filterdb);

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

{

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

Diff = MathAbs(price - Filter);

double hi = Diff[ArrayMaximum(Diff,LookBack,i)];

double lo = Diff[ArrayMinimum(Diff,LookBack,i)];

double alpha = 0;

if (hi!=lo)

{

for (int j=0; j<Median; j++) sortDiff[j] = (Diff-lo)/(hi-lo);

ArraySort(sortDiff,WHOLE_ARRAY,0,MODE_ASCEND);

if (MathMod(Median,2.0) != 0) alpha = sortDiff[Median/2];

else alpha = (sortDiff[Median/2]+sortDiff[(Median/2)-1])/2;

}

Filter = iLaGuerreFilter(price, 1.0-alpha, i, 0);

Filterda = EMPTY_VALUE;

Filterdb = EMPTY_VALUE;

Slope = Slope;

if (Filter>Filter) Slope = 1;

if (Filter<Filter) Slope = -1;

if (Slope == -1) PlotPoint(i,Filterda,Filterdb,Filter);

}

return (0);

}

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

//

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

//

//

//

//

//

double workLagFil[][4];

double iLaGuerreFilter(double price, double gamma, int i, int instanceNo=0)

{

if (ArrayRange(workLagFil,0)!=Bars) ArrayResize(workLagFil,Bars); i=Bars-i-1; instanceNo*=4;

if (gamma<=0) return(price);

//

//

//

//

//

workLagFil = (1.0 - gamma)*price + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

workLagFil = -gamma*workLagFil + workLagFil + gamma*workLagFil;

//

//

//

//

//

return((workLagFil+2.0*workLagFil+2.0*workLagFil+workLagFil)/6.0);

}

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

//

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

//

//

//

//

//

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

{

if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE;

else

if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE;

}

//

//

//

//

//

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

{

if (first == EMPTY_VALUE)

{

if (first == EMPTY_VALUE) {

first = from;

first = from;

second = EMPTY_VALUE;

}

else {

second = from;

second = from;

first = EMPTY_VALUE;

}

}

else

{

first = from;

second = EMPTY_VALUE;

}

}

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

//

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

//

//

//

//

//

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

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

//

//

//

//

//

int stringToTimeFrame(string tfs)

{

tfs = stringUpperCase(tfs);

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

if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period()));

return(Period());

}

//

//

//

//

//

string stringUpperCase(string str)

{

string s = str;

for (int length=StringLen(str)-1; length>=0; length--)

{

int tchar = StringGetChar(s, length);

if((tchar > 96 && tchar 223 && tchar < 256))

s = StringSetChar(s, length, tchar - 32);

else if(tchar > -33 && tchar < 0)

s = StringSetChar(s, length, tchar + 224);

}

return(s);

}

thefxpros

Einen Indikator adaptiv zu machen, bedeutet nicht, ihn neu zu malen. Adaptiv zu sein, bedeutete nie, ihn neu zu malen (von vielen adaptiven Indikatoren kann ich mich im Moment an keinen einzigen erinnern, der neu gemalt hätte). Anpassen ist etwas ganz anderes.

Was diesen Laguerre betrifft: Nein, er wird nicht neu gemalt. Die lookBack ist einfach eine Periode, die verwendet wird, um Daten, die dann für die Anpassung verwendet werden (und es ist mit einer Art von "rohen stochastischen" der Preis zu früheren laguerre Werte Unterschiede/Momente für die Anpassung)