And in general, you're ignoring help. I'm out of the dialogue. I have given you all the data to make the code work properly, but you don't want to hear it and you do things your own way. It's a pity about the time.
Artyom Trishkin: Anyway, you're ignoring the help. I'm out of the dialogue. I have given you all the data for the code to work properly, but you don't want to hear it, and do things your own way. It's a pity about the time.
Thanks for your attention and time.... I guess I haven't figured it out yet... About the wheels and motor I agree.
I'll probably give up the handheld and calculate the iClose average for the average period.
Thanks for your attention and time.... I guess I haven't figured it out yet... About the wheels and motor I agree.
I'll probably give up the handheld and calculate the iClose average for the average period.
//+------------------------------------------------------------------+//| TestMA.mq5 |//| Copyright 2018, MetaQuotes Software Corp. |//| https://mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2018, MetaQuotes Software Corp."#property link"https://mql5.com"#property version"1.00"#property description"Выводит данные скользящей средней с заданного таймфрейма на любом текущем"#property indicator_chart_window#property indicator_buffers1#property indicator_plots1//--- plot LWMA#property indicator_label1"MA"#property indicator_type1DRAW_LINE#property indicator_color1clrBlue#property indicator_style1STYLE_SOLID#property indicator_width11//--- input parametersinputuint InpPeriod = 14; // MA periodinputint InpShift = 0; // MA shiftinputENUM_MA_METHOD InpMethod = MODE_SMA; // MA methodinputENUM_APPLIED_PRICE InpApplierPrice = PRICE_CLOSE; // MA applied priceinputENUM_TIMEFRAMES InpTimeframe = PERIOD_H1; // LRMA timeframe//--- indicator buffersdouble BufferMA[];
//--- global variables//ENUM_TIMEFRAMES timeframe1;int period_ma;
int shift_ma;
int handle_ma;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- timerEventSetTimer(90);
//--- set global variables
period_ma=int(InpPeriod<1 ? 1 : InpPeriod);
shift_ma=InpShift;
//timeframe1=(InpTimeframe>Period() ? InpTimeframe : Period());//--- indicator buffers mappingSetIndexBuffer(0,BufferMA,INDICATOR_DATA);
//--- setting indicator parametersIndicatorSetString(INDICATOR_SHORTNAME,"Any TF MA on current");
IndicatorSetInteger(INDICATOR_DIGITS,Digits());
//--- setting plot buffer parametersstring label=TimeframeToString(InpTimeframe)+" "+MethodToString(InpMethod)+"("+(string)period_ma+")";
PlotIndexSetString(0,PLOT_LABEL,label);
//--- setting buffer arrays as timeseriesArraySetAsSeries(BufferMA,true);
//--- create handlesResetLastError();
handle_ma=iMA(NULL,InpTimeframe,period_ma,shift_ma,InpMethod,InpApplierPrice);
if(handle_ma==INVALID_HANDLE)
{
Print("The ",TimeframeToString(InpTimeframe)," iMA(",(string)period_ma,") object was not created: Error ",GetLastError());
returnINIT_FAILED;
}
//--- get timeframeTime(NULL,InpTimeframe,1);
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//--- Проверка количества доступных баровif(rates_total<fmax(period_ma,4)) return0;
//--- Проверка и расчёт количества просчитываемых баровint limit=rates_total-prev_calculated;
if(limit>1)
{
limit=rates_total-1;
ArrayInitialize(BufferMA,EMPTY_VALUE);
}
//--- Подготовка данныхif(Time(NULL,InpTimeframe,1)==0)
return0;
int bars=(InpTimeframe==PERIOD_CURRENT ? rates_total : Bars(NULL,InpTimeframe));
int count=(limit>1 ? fmin(bars,rates_total) : 1),copied=0;
copied=CopyBuffer(handle_ma,0,0,count,BufferMA);
Comment(TimeframeToString(InpTimeframe)," ",MethodToString(InpMethod),": copied=",copied,", count=",count,", bars=",bars,", rates_total=",rates_total);
if(copied!=count) return0;
//--- Расчёт индикатора//for(int i=limit; i>=0 && !IsStopped(); i--)// {// // }//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+//| Custom indicator timer function |//+------------------------------------------------------------------+voidOnTimer()
{
Time(NULL,InpTimeframe,1);
}
//+------------------------------------------------------------------+//| Возвращает Time |//+------------------------------------------------------------------+datetimeTime(conststring symbol_name,constENUM_TIMEFRAMES timeframe,constint shift)
{
datetime array[];
ArraySetAsSeries(array,true);
return(CopyTime(symbol_name,timeframe,shift,1,array)==1 ? array[0] : 0);
}
//+------------------------------------------------------------------+//| Возвращает наименование таймфрейма |//+------------------------------------------------------------------+string TimeframeToString(constENUM_TIMEFRAMES timeframe)
{
returnStringSubstr(EnumToString(timeframe),7);
}
//+------------------------------------------------------------------+//| Возвращает наименование метода МА |//+------------------------------------------------------------------+string MethodToString(ENUM_MA_METHOD method)
{
returnStringSubstr(EnumToString(method),5);
}
//+------------------------------------------------------------------+
Removed everything unnecessary.
Don't forget that there are no ticks at the weekend and the line will only be output at the same timeframes - working one and the one in the settings.
If you run it on a timeframe other than the one specified in the settings, then without ticks at the weekend, you need to forcibly refresh the chart with the right mouse button: Refresh, so that the line will be drawn.
Do not forget that there are no ticks at the weekend and the line will be displayed only on the matching timeframes - the working one and the one in the settings.
If you run it on a timeframe other than the one specified in the settings, then without ticks at the weekend, you need to forcibly refresh the chart with the right mouse button: Refresh, so that the line will be drawn.
Thanks many times !!1 I've been messing around all day.... my eyes are stitched up. Thanks again
Good afternoon, all. Faced with the problem of time mismatch, please help in solving it. Trying to figure out why orders are running late, I am logging debugging information in my EA, it is absolutely correct, you can see it in the screenshot. I notice that the time of message is 4.5 hours more than the start time of bars (TF=M30) and it is this lag that causes the orders to be late. I.e., according to the debugging information I see that the condition for entering the market has been fulfilled, for example, the time on the bar is 10:00 but the order is placed at the bar with the time 14:30. This is the first time I have encountered such a situation. What to do?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
for now
other (non-native) timeframe
Anyway, you're ignoring the help. I'm out of the dialogue. I have given you all the data for the code to work properly, but you don't want to hear it, and do things your own way. It's a pity about the time.
Thanks for your attention and time.... I guess I haven't figured it out yet... About the wheels and motor I agree.
I'll probably give up the handheld and calculate the iClose average for the average period.
Thanks for your attention and time.... I guess I haven't figured it out yet... About the wheels and motor I agree.
I'll probably give up the handheld and calculate the iClose average for the average period.
Removed everything unnecessary.
Don't forget that there are no ticks at the weekend and the line will only be output at the same timeframes - working one and the one in the settings.
If you run it on a timeframe other than the one specified in the settings, then without ticks at the weekend, you need to forcibly refresh the chart with the right mouse button: Refresh, so that the line will be drawn.
Removed everything unnecessary.
Do not forget that there are no ticks at the weekend and the line will be displayed only on the matching timeframes - the working one and the one in the settings.
If you run it on a timeframe other than the one specified in the settings, then without ticks at the weekend, you need to forcibly refresh the chart with the right mouse button: Refresh, so that the line will be drawn.
Good afternoon, everyone.
Faced with the problem of time mismatch, please help in solving it.
Trying to figure out why orders are running late, I am logging debugging information in my EA, it is absolutely correct, you can see it in the screenshot. I notice that the time of message is 4.5 hours more than the start time of bars (TF=M30) and it is this lag that causes the orders to be late. I.e., according to the debugging information I see that the condition for entering the market has been fulfilled, for example, the time on the bar is 10:00 but the order is placed at the bar with the time 14:30. This is the first time I have encountered such a situation. What to do?
Found trailing stop code on youtube, how can it be used?
Found trailing stop code on youtube, how can it be used?
This trawl is for buy only and is implemented poorly, it cannot be used.
this trawl is for buy only and is implemented poorly, it cannot be used.