The main indicator is located on the euro-dollar pair. This indicator calls indicators from other pairs of gold, dollar index, and euro currency. This indicator works on 1-minute pairs and sometimes there is no quotes on the dollar index, for example, the euro has a 15-minute candlestick, but the dollar index does not have such a candlestick, the index is frozen and does not tick. Then, after some time, the 16-minute candlestick appears on the EUR and the 16-minute candlestick appears on the USD index. What is the question? How to synchronise the calculation of the indicator, so it is only counted when the bars on all called symbols coincide in time????
I tried this construction
It seems to be cool, but the calculation is performed only for the current day, there are no signals for the previous days. Maybe there is a standard solution for synchronization of symbols????
Try in a timer in the loop SymbolInfoTick() to get data on the symbols. And there already synchronize as you need.
The thing is, that on the current symbol, the program starts only with the arrival of the tick for this symbol. Therefore, you will not be able to get the ticks from the other symbols in time. But in a timer that runs independently of the ticks, you will be able to get ticks from other symbols.
The timer can be set to millisecond if you need a fast response to a tick on a symbol that is not your own.
artmedia70: And you have a terribly blurred question and only you can understand it.
HAIL TO YOU!!! THANK YOU! HAPPY HOLIDAYS!
2 more points, dear. 1) you can remove the indicator from a separate window?
2)add a function, if the current ATR is higher than the ATR (for H period), then the ATR above the bar, would it be highlighted in a different colour? or the value would be written only above this bar?
2 more points, dear. 1) Can you remove the indicator from a separate window?
2)add a function, if current ATR is more than ATR (for H period), then ATR above the bar would be highlighted in a different colour? or the value would be written only above this bar?
Oh, dear... Here, edit it yourself:
//+------------------------------------------------------------------+//| iATRwithData.mq4 |//| Copyright 2016, Artem A. Trishkin, Skype artmedia70 |//| https://login.mql5.com/ru/users/artmedia70 |//+------------------------------------------------------------------+#property copyright"Copyright 2016, Artem A. Trishkin, Skype artmedia70"#property link"https://login.mql5.com/ru/users/artmedia70"#property version"1.00"#property strict#property indicator_separate_window#property indicator_buffers1#property indicator_plots1//--- plot ATR#property indicator_label1 "ATR"#property indicator_type1 DRAW_LINE#property indicator_color1 clrDodgerBlue#property indicator_style1 STYLE_SOLID#property indicator_width1 1//+------------------------------------------------------------------+//| enums |//+------------------------------------------------------------------+enum enumYN
{
enYes=1, // Yes
enNo=0, // No
};
//+------------------------------------------------------------------+//| input parameters |//+------------------------------------------------------------------+inputint PeriodATR=14; // ATRs calculation periodint periodATR=(PeriodATR<1)?1:PeriodATR;
sinput enumYN DrawGraphic=enYes; // Drawing ATR data over the candlessinputint StartDrawingBar=100; // Max bar for drawing ATRs dataint startDrawingBar;
sinputint TextSize=5; // Text sizesinputcolor TextColor=clrDodgerBlue; // Text color//--- indicator buffersdouble BufferATR[];
string Prefix;
//+------------------------------------------------------------------+//| Classes |//+------------------------------------------------------------------+//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- indicator buffers mappingSetIndexBuffer(0,BufferATR);
Prefix="iATRwd("+IntegerToString(periodATR)+")";
IndicatorSetString(INDICATOR_SHORTNAME,Prefix);
int bars=Bars(Symbol(),Period());
startDrawingBar=(StartDrawingBar<1)?1:(StartDrawingBar>bars)?bars:StartDrawingBar;
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//--- delete graphicsObjectsDeleteAll(0,Prefix,0);
//---
}
//+------------------------------------------------------------------+//| 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<periodATR) return(0);
int limit=rates_total-prev_calculated;
if(limit>1) limit=rates_total-periodATR-1;
//---for(int i=limit; i>=0; i--) {
BufferATR[i]=iATR(Symbol(),Period(),periodATR,i);
if(DrawGraphic && i<startDrawingBar) {
string tm_txt=TimeToString(time[i],TIME_DATE|TIME_MINUTES);
string nm=Prefix+"_"+tm_txt;
string text=IntegerToString(int(BufferATR[i]/Point()));
string tooltip="ATRs period for candle on "+tm_txt+" is "+text;
SetArrowText(0,nm,TextColor,text,0,ANCHOR_LOWER,time[i],high[i],"Arial",TextSize,tooltip);
}
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+//| Timer function |//+------------------------------------------------------------------+voidOnTimer()
{
//---
}
//+------------------------------------------------------------------+//| ChartEvent function |//+------------------------------------------------------------------+voidOnChartEvent(constint id,
constlong &lparam,
constdouble &dparam,
conststring &sparam)
{
//---
}
//+------------------------------------------------------------------+//| Functions |//+------------------------------------------------------------------+void SetArrowText(long chart_id, string name, color text_color, string text, int sub_window,
long text_anchor, long text_time1, double text_price1, string font="Arial", long font_size=5,
string tooltip="\n", bool selection=false, bool hidden=true) {
if(ObjectFind(chart_id,name)<0) ObjectCreate(chart_id,name,OBJ_TEXT,sub_window,text_time1,text_price1);
ObjectSetInteger(chart_id,name,OBJPROP_ANCHOR,text_anchor);
ObjectSetInteger(chart_id,name,OBJPROP_WIDTH,font_size);
ObjectSetString(chart_id,name,OBJPROP_FONT,font);
ObjectSetString(chart_id,name,OBJPROP_TEXT,text);
ObjectSetInteger(chart_id,name,OBJPROP_COLOR,text_color);
ObjectSetInteger(chart_id,name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,name,OBJPROP_TIME1,text_time1);
ObjectSetDouble(chart_id,name,OBJPROP_PRICE1,text_price1);
ObjectSetInteger(chart_id,name,OBJPROP_SELECTED,selection);
ObjectSetInteger(chart_id,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_id,name,OBJPROP_HIDDEN,hidden);
ObjectSetString(chart_id,name,OBJPROP_TOOLTIP,tooltip);
}
//+------------------------------------------------------------------+
Or do you want me to do everything for you as well?
Good evening, is it possible to make the indicator display buffer data in two windows, part on the main chart and part in the sub-end? If so, please advise how ...
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.
I will describe it well in more detail.
The main indicator is located on the euro-dollar pair. This indicator calls indicators from other pairs of gold, dollar index, and euro currency. This indicator works on 1-minute pairs and sometimes there is no quotes on the dollar index, for example, the euro has a 15-minute candlestick, but the dollar index does not have such a candlestick, the index is frozen and does not tick. Then, after some time, the 16-minute candlestick appears on the EUR and the 16-minute candlestick appears on the USD index. What is the question? How to synchronise the calculation of the indicator, so it is only counted when the bars on all called symbols coincide in time????
I tried this construction
It seems to be cool, but the calculation is performed only for the current day, there are no signals for the previous days. Maybe there is a standard solution for synchronization of symbols????
Try in a timer in the loop SymbolInfoTick() to get data on the symbols. And there already synchronize as you need.
The thing is, that on the current symbol, the program starts only with the arrival of the tick for this symbol. Therefore, you will not be able to get the ticks from the other symbols in time. But in a timer that runs independently of the ticks, you will be able to get ticks from other symbols.
The timer can be set to millisecond if you need a fast response to a tick on a symbol that is not your own.
And you have a terribly blurred question and only you can understand it.
HAIL TO YOU!!! THANK YOU! HAPPY HOLIDAYS!
2 more points, dear. 1) you can remove the indicator from a separate window?
2)add a function, if the current ATR is higher than the ATR (for H period), then the ATR above the bar, would it be highlighted in a different colour? or the value would be written only above this bar?
HAIL TO YOU!!! THANK YOU! HAPPY HOLIDAYS!
2 more points, dear. 1) Can you remove the indicator from a separate window?
2)add a function, if current ATR is more than ATR (for H period), then ATR above the bar would be highlighted in a different colour? or the value would be written only above this bar?
Oh, dear... Here, edit it yourself:
Or do you want me to do everything for you as well?
Oh, dear... Here, you do it yourself:
Or should I do it for you too?
Thank you very much! kind man!
You're welcome. If it's no secret, why do you need a timestamp showing the time of the last run of your program - the time in it won't change.
Just idle curiosity...
It's for the offline tick chart.
What functions can be used to send variables between two MT4 terminals? If possible, please add a link to the documentation.
int Flags=FILE_WRITE+FILE_TXT+FILE_COMMON;
int Info = FileOpen(fName,Flags);
FileWrite(Info,What's Up); On the other terminal, read. Cursor on FileOpen and F1 - get help
int Flags=FILE_WRITE+FILE_TXT+FILE_COMMON;
int Info = FileOpen(fName,Flags);
FileWrite(Info,What's Up); On the other terminal, read. Cursor on FileOpen and F1 - get help