Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам - страница 2014

 
Tretyakov Rostyslav #:

 я вставил перед настройками иникатора мне выдал ошибку компиляции - в чем моя ошибка - по идее фунция простая

#property indicator_separate_window

#property indicator_buffers 8

#property indicator_plots 8



#property indicator_label1 "Bar Height"

#property indicator_type1 DRAW_HISTOGRAM

#property indicator_color1 clrYellow

#property indicator_style1 STYLE_SOLID

#property indicator_width1 2


#property indicator_label2 "Bar Height > Upper Band = Buy"

#property indicator_type2 DRAW_HISTOGRAM

#property indicator_color2 clrDodgerBlue

#property indicator_style2 STYLE_SOLID

#property indicator_width2 3


#property indicator_label3 "Bar Height > Upper Band = Sell"

#property indicator_type3 DRAW_HISTOGRAM

#property indicator_color3 clrRed

#property indicator_style3 STYLE_SOLID

#property indicator_width3 3


#property indicator_label4 "Bar Height > Average Bar Height = Buy"

#property indicator_type4 DRAW_HISTOGRAM

#property indicator_color4 clrAqua

#property indicator_style4 STYLE_SOLID

#property indicator_width4 2


#property indicator_label5 "Bar Height > Average Bar Height = Sell"

#property indicator_type5 DRAW_HISTOGRAM

#property indicator_color5 clrMagenta

#property indicator_style5 STYLE_SOLID

#property indicator_width5 2


#property indicator_label6 "Average Bar Height"

#property indicator_type6 DRAW_LINE

#property indicator_color6 clrOrange

#property indicator_style6 STYLE_SOLID

#property indicator_width6 0


#property indicator_label7 "Upper Band"

#property indicator_type7 DRAW_LINE

#property indicator_color7 clrDeepPink

#property indicator_style7 STYLE_SOLID

#property indicator_width7 0


#property indicator_label8 "Lower Band"

#property indicator_type8 DRAW_LINE

#property indicator_color8 clrSpringGreen

#property indicator_style8 STYLE_SOLID

#property indicator_width8 0




input uint Bands_Period = 14; // Period

input ENUM_MA_METHOD Bands_Method = MODE_SMA; // Method

input double Bands_Deviations = 1; // Deviations

uint Bands_Shift = 0; // Shift

input bool Bands_Show = true; // Show


input uint History_Bars_Limit = 300; // History Bars Limit




double

buff_Bar_Height[],

buff_Bullish_Strong[], buff_Bearish_Strong[], buff_Bullish_Weak[], buff_Bearish_Weak[],

buff_Average_Bar_Height[], buff_Upper_Band[], buff_Lower_Band[]

;

datetime gt_Last_Bar_Time = 0;

bool gb_Init = true;



int OnInit() {

gb_Init = true;

SetIndexBuffer(0, buff_Bar_Height, INDICATOR_DATA);

PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(1, buff_Bullish_Strong, INDICATOR_DATA);

PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(2, buff_Bearish_Strong, INDICATOR_DATA);

PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(3, buff_Bullish_Weak, INDICATOR_DATA);

PlotIndexSetDouble(3, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(4, buff_Bearish_Weak, INDICATOR_DATA);

PlotIndexSetDouble(4, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(5, buff_Average_Bar_Height, INDICATOR_DATA);

PlotIndexSetInteger(5, PLOT_DRAW_TYPE, Bands_Show ? DRAW_LINE : DRAW_NONE);

PlotIndexSetDouble(5, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(6, buff_Upper_Band, INDICATOR_DATA);

PlotIndexSetInteger(6, PLOT_DRAW_TYPE, Bands_Show ? DRAW_LINE : DRAW_NONE);

PlotIndexSetDouble(6, PLOT_EMPTY_VALUE, 0);

SetIndexBuffer(7, buff_Lower_Band, INDICATOR_DATA);

PlotIndexSetInteger(7, PLOT_DRAW_TYPE, Bands_Show ? DRAW_LINE : DRAW_NONE);

PlotIndexSetDouble(7, PLOT_EMPTY_VALUE, 0);

IndicatorSetInteger(INDICATOR_DIGITS, _Digits);

IndicatorSetString(INDICATOR_SHORTNAME, "KAVLOWBOL");

return(INIT_SUCCEEDED);

}




void OnDeinit(const int reason) {

gb_Init = true;

}




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[]

) {

if(gb_Init) {

ArrayInitialize(buff_Bar_Height, 0);

ArrayInitialize(buff_Bullish_Weak, 0);

ArrayInitialize(buff_Bullish_Strong, 0);

ArrayInitialize(buff_Bearish_Weak, 0);

ArrayInitialize(buff_Bearish_Strong, 0);

ArrayInitialize(buff_Average_Bar_Height, 0);

ArrayInitialize(buff_Upper_Band, 0);

ArrayInitialize(buff_Lower_Band, 0);

}

bool

b_Is_New_Bar = gb_Init || gt_Last_Bar_Time != Time[rates_total - 1]

;

gt_Last_Bar_Time = Time[rates_total - 1];

int

i_Oldest_Bar = int(fmax(0, rates_total - int(History_Bars_Limit))),

i_Bar = prev_calculated > rates_total || prev_calculated <= 0 ? i_Oldest_Bar : int(fmax(i_Oldest_Bar, prev_calculated - 1)),

i_Period_Bar,

i_Period

;

double

d_Sum = 0

;

while(++i_Bar < rates_total) {

buff_Bar_Height[i_Bar] = High[i_Bar] - Low[i_Bar];

buff_Average_Bar_Height[i_Bar] = fd_MA_On_Array(buff_Bar_Height, i_Bar, Bands_Period, Bands_Method);

d_Sum = 0;

i_Period = 0;

i_Period_Bar = int(fmax(WRONG_VALUE, i_Bar - int(Bands_Period) + 1));

while(i_Period_Bar++ < i_Bar) {

d_Sum += pow(buff_Bar_Height[i_Period_Bar] - buff_Average_Bar_Height[i_Bar], 2);

i_Period++;

}

buff_Upper_Band[i_Bar] = buff_Average_Bar_Height[i_Bar] + Bands_Deviations * sqrt(d_Sum / double(Bands_Period));

buff_Lower_Band[i_Bar] = buff_Average_Bar_Height[i_Bar] - Bands_Deviations * sqrt(d_Sum / double(Bands_Period));

if(buff_Bar_Height[i_Bar] > buff_Upper_Band[i_Bar]) {

if(Close[i_Bar] > Open[i_Bar]) buff_Bullish_Strong[i_Bar] = buff_Bar_Height[i_Bar];

if(Close[i_Bar] < Open[i_Bar]) buff_Bearish_Strong[i_Bar] = buff_Bar_Height[i_Bar];

}


if(buff_Bar_Height[i_Bar] <= buff_Upper_Band[i_Bar] && buff_Bar_Height[i_Bar] > buff_Average_Bar_Height[i_Bar]) {

if(Close[i_Bar] > Open[i_Bar]) buff_Bullish_Weak[i_Bar] = buff_Bar_Height[i_Bar];

if(Close[i_Bar] < Open[i_Bar]) buff_Bearish_Weak[i_Bar] = buff_Bar_Height[i_Bar];

}

}

gb_Init = false;

return(rates_total);

}




double fd_MA_On_Array(double& da_Values[], int i_Bar, int i_Period, ENUM_MA_METHOD e_MA_Method = MODE_SMA) {

switch(e_MA_Method) {

case MODE_SMA: return(fd_Get_SMA(da_Values, i_Period, i_Bar));

case MODE_EMA: return(fd_Get_EMA(da_Values[i_Bar], da_Values[fmax(0, i_Bar - 1)], i_Period, i_Bar));

case MODE_SMMA: return(fd_Get_SMMA(da_Values, da_Values[fmax(0, i_Bar - 1)], i_Period, i_Bar));

case MODE_LWMA: return(fd_Get_LWMA(da_Values, i_Period, i_Bar));

}

return(0);

}




template <typename T>

double fd_Get_SMA(T& da_Values[], int i_Period, int i_Bar) {

double d_Sum = 0;

int i_Real_Period = 0;

for(int i_Period_Bar = 0; i_Period_Bar < i_Period; i_Period_Bar++) {

if(i_Bar - i_Period_Bar < 0) break;

d_Sum += da_Values[i_Bar - i_Period_Bar];

i_Real_Period++;

}

return(d_Sum / i_Real_Period);




template <typename T>

double fd_Get_SMMA(T& da_Values[], double d_Value_Prev, int i_Period, int i_Bar) {

double d_SMMA = 0;

if(i_Bar == i_Period) d_SMMA = fd_Get_SMA(da_Values, i_Period, i_Bar);

else if(i_Bar > i_Period) {

double d_Sum = 0;

for(int i_Period_Bar = 0; i_Period_Bar < i_Period; i_Period_Bar++)

d_Sum += da_Values[i_Bar - (i_Period_Bar + 1)];

d_SMMA = (d_Sum - d_Value_Prev + da_Values[i_Bar]) / i_Period;

}

return(d_SMMA);

}                




double fd_Get_EMA(double d_Value_Curr, double d_Value_Prev, int i_Period, int i_Bar) {

if(i_Bar <= 2) return(d_Value_Curr);

return(d_Value_Prev + 2.0 / (1 + i_Period) * (d_Value_Curr - d_Value_Prev));

}




template <typename T>

double fd_Get_LWMA(T& da_Values[], int i_Period, int i_Bar) {

double

d_LWMA = 0,

d_Sum = 0,

d_Weight = 0

;

for(int i_Period_Bar = 0;i_Period_Bar < i_Period;i_Period_Bar++) { 

d_Weight += (i_Period - i_Period_Bar);

d_Sum += da_Values[i_Bar - i_Period_Bar] * (i_Period - i_Period_Bar);

}

if(d_Weight > 0) d_LWMA = d_Sum / d_Weight;

return(d_LWMA);


 
int OnInit() {
gb_Init = true;
SetIndexBuffer(0, buff_Bar_Height, INDICATOR_DATA);
SetIndexLabel(0,NULL);
PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(1, buff_Bullish_Strong, INDICATOR_DATA);
PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(2, buff_Bearish_Strong, INDICATOR_DATA);
PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(3, buff_Bullish_Weak, INDICATOR_DATA);
PlotIndexSetDouble(3, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(4, buff_Bearish_Weak, INDICATOR_DATA);
PlotIndexSetDouble(4, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(5, buff_Average_Bar_Height, INDICATOR_DATA);
PlotIndexSetInteger(5, PLOT_DRAW_TYPE, Bands_Show ? DRAW_LINE : DRAW_NONE);
PlotIndexSetDouble(5, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(6, buff_Upper_Band, INDICATOR_DATA);
PlotIndexSetInteger(6, PLOT_DRAW_TYPE, Bands_Show ? DRAW_LINE : DRAW_NONE);
PlotIndexSetDouble(6, PLOT_EMPTY_VALUE, 0);
SetIndexBuffer(7, buff_Lower_Band, INDICATOR_DATA);
PlotIndexSetInteger(7, PLOT_DRAW_TYPE, Bands_Show ? DRAW_LINE : DRAW_NONE);
PlotIndexSetDouble(7, PLOT_EMPTY_VALUE, 0);
IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
IndicatorSetString(INDICATOR_SHORTNAME, "KAVLOWBOL");
return(INIT_SUCCEEDED);
}
 
Добрый день! У меня в MegaTreder5 но я не понимаю в этом счёт или она не легальный или ещё что то ! В роде можно торговать и заработать но нельзя снимать средства а щас не могу заходит не знаю за какой причине надеюсь вы поможете мне разберёмся в этом 
 
ruslan #:

ну в общем суть такая дотестился хард с изолированого ПК

Рекомендация: слить данные, пролить диск нулями, прогнать тест заново. Очень вероятно, что ещё долго поживёт.

И да, smartctl из smartmontools может дать больше информации о состоянии диска.

 
JRandomTrader #:

Рекомендация: слить данные, пролить диск нулями, прогнать тест заново. Очень вероятно, что ещё долго поживёт.

И да, smartctl из smartmontools может дать больше информации о состоянии диска.

Можете объяснить как это сделать?

 
Tretyakov Rostyslav #:

Можете объяснить как это сделать?

Для этого есть специальные утилиты. Например я пользуюсь HDDLLF.4.40 который запускается с загрузочного диска.

 
Tretyakov Rostyslav #:

Можете объяснить как это сделать?

Я делаю из-под Линукса, например, с systemrescuecd.

dd if=/dev/zero of=/dev/<disk> bs=1M

Главное, правильно диск указать, чтобы не обнулить не тот.

 
Alexey Viktorov #:
JRandomTrader #:

Спасибо, пригодится)

 

На всякий случай:

Прогнать полный селфтест диска

smartctl -t long /dev/<disk>

Посмотреть инфу о состоянии диска (не только атрибуты, но и логи ошибок, результаты селфтестов, график температуры...)

smartctl -x /dev/<disk>

Тут будет большая портянка, лучше в файл перенаправить.

 
JRandomTrader #:

На всякий случай:

Прогнать полный селфтест диска

smartctl -t long /dev/<disk>

Посмотреть инфу о состоянии диска (не только атрибуты, но и логи ошибок, результаты селфтестов, график температуры...)

smartctl -x /dev/<disk>

Тут будет большая портянка, лучше в файл перенаправить.

Я с линуксом еще не подружился, но пытаюсь)
Причина обращения: