Здравствуйте, подскажите пожалуйста, как сделать так, чтобы индикатор в платформе MT5 работал по файлу истории из папки Custom? Например путь C:\Users\User\AppData\Roaming\MetaQuotes\Terminal\9C77805739CF02E21F689407B196C82A\bases\Custom\history\EURUSD_S40
Здравствуйте. Помогите добавить в советник (стр.117 и стр.135) функцию, чтобы при закрытии позиции выполнялись условия: для бай ордера - последний бар закрылся ниже МА и текущая цена была бы выше цены открытия ордера; для селл - наоборот.
Есть робот который при включении его тестере должен создавать свой автономный график. Обычно работает нормально, но на одном из пк при его включении мелькает окно windows power shell и график не создается.
Есть робот который при включении его тестере должен создавать свой автономный график. Обычно работает нормально, но на одном из пк при его включении мелькает окно windows power shell и график не создается.
Не могу понять, почему отсутствует повторяемость в сериях прогонов моего робота в тестере стратегий на одних и тех же исходный данных.
Попробуйте в режиме OHLC. Если и там расхождение, то проверьте советник из поставки, если там расхождения нет, то ошибка у Вас в коде (весьма вероятно).
Подскажите, пожалуйста, можно ли как-то выводить описание трендовой линии на саму линию?
Чтобы не наводить мышкой на неё, не ждать, не прибегать к построению дополнительного текста (объекта)
OBJPROP_TEXT
Описание объекта (текст, содержащийся в объекте)
string
https://www.mql5.com/ru/docs/constants/objectconstants/enum_object_property
OBJPROP_TEXT
Благодарю
Здравствуйте, подскажите пожалуйста, как сделать так, чтобы индикатор в платформе MT5 работал по файлу истории из папки Custom? Например путь C:\Users\User\AppData\Roaming\MetaQuotes\Terminal\9C77805739CF02E21F689407B196C82A\bases\Custom\history\EURUSD_S40
//+------------------------------------------------------------------+
//| Stochastic Other TimeFrame.mq5 |
//| Copyright © 2020, Vladimir Karputov |
//| https://www.mql5.com/ru/market/product/43161 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property link "https://www.mql5.com/ru/market/product/43161"
#property version "1.000"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots 2
//--- plot STO
#property indicator_label1 "STO Main"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrLightSeaGreen
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
//--- plot STO_
#property indicator_label2 "STO Signal"
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrRed
#property indicator_style2 STYLE_DASH
#property indicator_width2 1
//--- input parameters
input group "Stochastic Other"
input ENUM_TIMEFRAMES Inp_STO_Other_period = PERIOD_D1; // Stochastic Other: timeframe
input int Inp_STO_Other_Kperiod = 5; // Stochastic Other: K-period (number of bars for calculations)
input int Inp_STO_Other_Dperiod = 3; // Stochastic Other: D-period (period of first smoothing)
input int Inp_STO_Other_slowing = 3; // Stochastic Other: final smoothing
input ENUM_MA_METHOD Inp_STO_Other_ma_method = MODE_SMA; // Stochastic Other: type of smoothing
input ENUM_STO_PRICE Inp_STO_Other_price_field = STO_LOWHIGH; // Stochastic Other: stochastic calculation method
//--- indicator buffers
double MainBuffer[];
double SignalBuffer[];
//---
int handle_iStochastic_other; // variable for storing the handle of the iStochastic indicator
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,MainBuffer,INDICATOR_DATA);
SetIndexBuffer(1,SignalBuffer,INDICATOR_DATA);
//--- set accuracy
IndicatorSetInteger(INDICATOR_DIGITS,2);
//--- set levels
IndicatorSetInteger(INDICATOR_LEVELS,2);
IndicatorSetDouble(INDICATOR_LEVELVALUE,0,20);
IndicatorSetDouble(INDICATOR_LEVELVALUE,1,80);
//--- set maximum and minimum for subwindow
IndicatorSetDouble(INDICATOR_MINIMUM,0);
IndicatorSetDouble(INDICATOR_MAXIMUM,100);
//--- name for DataWindow and indicator subwindow label
string other_timeframe=StringSubstr(EnumToString(Inp_STO_Other_period),7);
string parameters="("+IntegerToString(Inp_STO_Other_Kperiod)+","+
IntegerToString(Inp_STO_Other_Dperiod)+","+IntegerToString(Inp_STO_Other_slowing)+")";
IndicatorSetString(INDICATOR_SHORTNAME,"Stoch,"+other_timeframe+parameters);
PlotIndexSetString(0,PLOT_LABEL,"STO"+parameters+"Main,"+other_timeframe);
PlotIndexSetString(1,PLOT_LABEL,"STO"+parameters+"Signal,"+other_timeframe);
//---
if(Inp_STO_Other_period<Period())
{
string current_timeframe=StringSubstr(EnumToString(Period()),7);
string err_text=(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian")?
"'Stochastic Other: timeframe' ("+other_timeframe+") не может быть меньше текущего таймфрейма ("+current_timeframe+")!":
"'Stochastic Other: timeframe' ("+other_timeframe+") cannot be less than the current timeframe ("+current_timeframe+")!";
//--- when testing, we will only output to the log about incorrect input parameters
if(MQLInfoInteger(MQL_TESTER))
{
Print(__FILE__," ",__FUNCTION__,", ERROR: ",err_text);
return(INIT_PARAMETERS_INCORRECT);
}
else // if the Expert Advisor is run on the chart, tell the user about the error
{
Alert(__FILE__," ",__FUNCTION__,", ERROR: ",err_text);
return(INIT_PARAMETERS_INCORRECT);
}
}
//--- create handle of the indicator iStochastic
handle_iStochastic_other=iStochastic(Symbol(),Inp_STO_Other_period,
Inp_STO_Other_Kperiod,Inp_STO_Other_Dperiod,Inp_STO_Other_slowing,
Inp_STO_Other_ma_method,Inp_STO_Other_price_field);
//--- if the handle is not created
if(handle_iStochastic_other==INVALID_HANDLE)
{
//--- tell about the failure and output the error code
PrintFormat("Failed to create handle of the iStochastic indicator for the symbol %s/%s, error code %d",
Symbol(),
EnumToString(Inp_STO_Other_period),
GetLastError());
//--- the indicator is stopped early
return(INIT_FAILED);
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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[])
{
//--- determine the number of values calculated in the indicator
int calculated=BarsCalculated(handle_iStochastic_other);
if(calculated<=0)
{
PrintFormat("BarsCalculated(Other) returned %d, error code %d",calculated,GetLastError());
return(0);
}
//--- main loop
int limit=prev_calculated-1;
if(prev_calculated==0)
limit=0;
for(int i=limit; i<rates_total; i++)
{
int i_bar_shift=iBarShift(Symbol(),Inp_STO_Other_period,time[i],false);
if(i_bar_shift<0)
return(0);
datetime i_time=iTime(Symbol(),Inp_STO_Other_period,i_bar_shift);
if(i_time==D'1970.01.01 00:00')
return(0);
//---
double main_buffer[],signal_buffer[];
int copy_main=CopyBuffer(handle_iStochastic_other,MAIN_LINE,i_time,1,main_buffer);
int copy_signal=CopyBuffer(handle_iStochastic_other,SIGNAL_LINE,i_time,1,signal_buffer);
if(copy_main<1 || copy_signal<1)
return(0);
MainBuffer[i]=main_buffer[0];
SignalBuffer[i]=signal_buffer[0];
}
//--- return the prev_calculated value for the next call
return(rates_total);
}
//+------------------------------------------------------------------+
//| Indicator deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
if(handle_iStochastic_other!=INVALID_HANDLE)
IndicatorRelease(handle_iStochastic_other);
}
//+------------------------------------------------------------------+
Подскажите, пожалста.
Есть робот который при включении его тестере должен создавать свой автономный график. Обычно работает нормально, но на одном из пк при его включении мелькает окно windows power shell и график не создается.
В чем может быть проблема и как исправить?
Вопрос по тестеру стратегий в MQL5.
Подскажите, пожалста.
Есть робот который при включении его тестере должен создавать свой автономный график. Обычно работает нормально, но на одном из пк при его включении мелькает окно windows power shell и график не создается.
В чем может быть проблема и как исправить?
Может, использует dll, которой нет на этом ПК?
Попробуйте в режиме OHLC. Если и там расхождение, то проверьте советник из поставки, если там расхождения нет, то ошибка у Вас в коде (весьма вероятно).
Может, использует dll, которой нет на этом ПК?
Вы про длл винды или отдельную для робота? С этим роботом в комплекте длл не идет, хотя по его инструкции разрешение для длл должно быть включено.
Вы про длл винды или отдельную для робота? С этим роботом в комплекте длл не идет, хотя по его инструкции разрешение для длл должно быть включено.
Возможно, робот использует некую библиотеку, которая ставится в пакетах фреймворк - обычно есть, но на том компьютере нет - проверьте установку.