Uniwersytet Futures i Opcji
Czy chcesz zareagować na tę wiadomość? Zarejestruj się na forum za pomocą kilku kliknięć lub zaloguj się, aby kontynuować.
Uniwersytet Futures i Opcji

pod kierownictwem prof. SzFagra
 
IndeksIndeks  PortalePortale  SzukajSzukaj  Latest imagesLatest images  RejestracjaRejestracja  Zaloguj  

 

 Posba o pomoc-mql4

Go down 
AutorWiadomość
Gość
Gość




Posba o pomoc-mql4 Empty
PisanieTemat: Posba o pomoc-mql4   Posba o pomoc-mql4 EmptyPon 18 Lut 2008, 19:10

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 LightBlue
#property indicator_color2 Orange
#property indicator_width1 2
#property indicator_width2 2
#property indicator_color3 LightBlue
#property indicator_color4 Orange
#property indicator_width3 1
#property indicator_width4 1
//---- indicator parameters
extern int MA_Period = 10;
extern int MA_Method = 0;
extern int UseSignal = 0;
extern int AlertMode = 0;
extern int WarningMode = 0;

//---- indicator buffers
double UpBuffer[];
double DnBuffer[];
double UpSignal[];
double DnSignal[];
double smax[];
double smin[];
double trend[];

//----
int ExtCountedBars=0;
bool UpTrendAlert=false, DownTrendAlert=false;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
int draw_begin;
string short_name;
//---- drawing settings
IndicatorBuffers(7);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,108);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,108);

IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
if(MA_Period<2) MA_Period=10;
draw_begin=MA_Period-1;
//---- indicator short name
IndicatorShortName("TrendEnvelopes("+MA_Period+")");
SetIndexLabel(0,"UpTrendEnv");
SetIndexLabel(1,"DnTrendEnv");
SetIndexLabel(2,"UpSignal");
SetIndexLabel(3,"DnSignal");
SetIndexDrawBegin(0,draw_begin);
SetIndexDrawBegin(1,draw_begin);
SetIndexDrawBegin(2,draw_begin);
SetIndexDrawBegin(3,draw_begin);
//---- indicator buffers mapping
SetIndexBuffer(0,UpBuffer);
SetIndexBuffer(1,DnBuffer);
SetIndexBuffer(2,UpSignal);
SetIndexBuffer(3,DnSignal);
SetIndexBuffer(4,smax);
SetIndexBuffer(5,smin);
SetIndexBuffer(6,trend);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
if(Bars<=MA_Period) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
limit=Bars-ExtCountedBars;
//---- EnvelopesM counted in the buffers
for(int i=limit; i>=0; i--)
{
smax[i] = iMA(NULL,0,MA_Period,0,MA_Method,PRICE_HIGH,i);
smin[i] = iMA(NULL,0,MA_Period,0,MA_Method,PRICE_LOW,i);

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

if (Close[i]>smax[i+1]) trend[i]=1;
if (Close[i]<smin[i+1]) trend[i]=-1;

if(trend[i]>0)
{
if (smin[i]<smin[i+1]) smin[i]=smin[i+1];
UpBuffer[i]=smin[i];
if (UseSignal>0)
{
if (trend[i+1]<0)
{
UpSignal[i] = smin[i];
if (WarningMode>0 && i==0) PlaySound("alert2.wav");
}
else UpSignal[i] = EMPTY_VALUE;
}
DnBuffer[i]=EMPTY_VALUE;
DnSignal[i]=EMPTY_VALUE;
}
else
{
if(smax[i]>smax[i+1]) smax[i]=smax[i+1];
DnBuffer[i]=smax[i];
if (UseSignal>0)
{
if (trend[i+1]>0)
{
DnSignal[i] = smax[i];
if (WarningMode>0 && i==0) PlaySound("alert2.wav");
}
else DnSignal[i] = EMPTY_VALUE;
}
UpBuffer[i]=EMPTY_VALUE;
UpSignal[i]=EMPTY_VALUE;
}
}
//----------
string Message;

if ( trend[2]<0 && trend[1]>0 && Volume[0]>1 && !UpTrendAlert)
{
Message = " "+Symbol()+" M"+Period()+": Signal for BUY";
if ( AlertMode>0 ) Alert (Message);
UpTrendAlert=true; DownTrendAlert=false;
}

if ( trend[2]>0 && trend[1]<0 && Volume[0]>1 && !DownTrendAlert)
{
Message = " "+Symbol()+" M"+Period()+": Signal for SELL";
if ( AlertMode>0 ) Alert (Message);
DownTrendAlert=true; UpTrendAlert=false;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+




Potrafi ktos to przekonwertowac na jezyk programowania uzywany w amibrokerze?
Powrót do góry Go down
Gość
Gość




Posba o pomoc-mql4 Empty
PisanieTemat: Re: Posba o pomoc-mql4   Posba o pomoc-mql4 EmptyPon 18 Lut 2008, 19:14

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 LightBlue
#property indicator_width2 2
#property indicator_color3 Tomato
#property indicator_width3 2
//---- input parameters
extern int RSILength = 14; // Period of evaluation
extern int Smooth = 5; // Period of smoothing
extern double K = 4.236; // Multiplier
//---- buffers
double SmRSI[];
double UpTrend[];
double DnTrend[];
double Delta [];
double ATRRSI[];
double smin[];
double smax[];
double trend[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(Cool;
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(0,SmRSI);
SetIndexBuffer(1,UpTrend);
SetIndexBuffer(2,DnTrend);
SetIndexBuffer(3,Delta);
SetIndexBuffer(4,ATRRSI);
SetIndexBuffer(5,smin);
SetIndexBuffer(6,smax);
SetIndexBuffer(7,trend);
//---- name for DataWindow and indicator subwindow label
string short_name="TrendStrength("+RSILength+","+Smooth+")";
IndicatorShortName(short_name);
SetIndexLabel(0,"Smoothed RSI");
SetIndexLabel(1,"UpTrend");
SetIndexLabel(2,"DnTrend");
//----
SetIndexDrawBegin(0,3*RSILength+Smooth);
SetIndexDrawBegin(1,3*RSILength+Smooth);
SetIndexDrawBegin(2,3*RSILength+Smooth);

return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int shift, limit,counted_bars=IndicatorCounted();
//----
if (Bars-1<3*RSILength+Smooth+1)return(0);
if (counted_bars<0)return(-1);
if (counted_bars>0) counted_bars--;

limit=Bars-counted_bars-1;

for( shift=limit; shift>=0; shift--)
{
double RSI = iRSI(NULL,0,RSILength,PRICE_CLOSE,shift);
SmRSI[shift]= SmRSI[shift+1] + 2./(Smooth+1)*(RSI - SmRSI[shift+1]); //iMAOnArray(RSI,0,Smooth,0,1,shift);

if(SmRSI[shift] > SmRSI[shift+1]) {double hRSI = SmRSI[shift]; double lRSI = SmRSI[shift+1];}
else
if(SmRSI[shift] < SmRSI[shift+1]) {hRSI = SmRSI[shift+1]; lRSI = SmRSI[shift];}
else
{hRSI = SmRSI[shift]; lRSI = SmRSI[shift];}

ATRRSI[shift] = hRSI - lRSI;
}

for( shift=limit; shift>=0; shift--)
Delta[shift] = iMAOnArray(ATRRSI,0,2*RSILength-1,0,1,shift);

for( shift=limit; shift>=0; shift--)
{
double del = iMAOnArray(Delta,0,2*RSILength-1,0,1,shift);

smin[shift] = SmRSI[shift] - K*del;
smax[shift] = SmRSI[shift] + K*del;

trend[shift] = trend[shift+1];

if (SmRSI[shift]>smax[shift+1]) trend[shift]= 1;
if (SmRSI[shift]<smin[shift+1]) trend[shift]=-1;

if(trend[shift]>0)
{
if (smin[shift]<smin[shift+1]) smin[shift]=smin[shift+1];
UpTrend[shift]=smin[shift];
DnTrend[shift]=EMPTY_VALUE;
}
else
if(trend[shift]<0)
{
if(smax[shift]>smax[shift+1]) smax[shift]=smax[shift+1];
DnTrend[shift]=smax[shift];
UpTrend[shift]=EMPTY_VALUE;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+

a to juz sRSI tez potrzebne i tez nie mam pojecia jak to przekonwertowac
Powrót do góry Go down
 
Posba o pomoc-mql4
Powrót do góry 
Strona 1 z 1
 Similar topics
-
» UFO - 31.08.2007
» Prośba o pomoc starszych kolegów :)
» UFO - 05.09.2007
» UFO - 09.03.2022r.

Permissions in this forum:Nie możesz odpowiadać w tematach
Uniwersytet Futures i Opcji  :: FAQ & P.U.P.A.-
Skocz do: