Function returns the amount of bars visible on the chart.
Sample
// work with visible bars.
int bars_count=BarsPerWindow();
int bar=FirstVisibleBar();
for(int i=0; i<bars_count; i++,bar--)
{
// ...
}
Function returns index of the first visible bar.
Sample
// work with visible bars.
int bars_count=BarsPerWindow();
int bar=FirstVisibleBar();
for(int i=0; i<bars_count; i++,bar--)
{
// ...
}
Returns price part of dropped point where expert or script was dropped. This value is valid when expert or script dropped by mouse.
Note: For custom indicators this value is undefined.
Sample
double drop_price=PriceOnDropped();
datetime drop_time=TimeOnDropped();
//---- may be undefined (zero)
if(drop_time>0)
{
ObjectCreate("Dropped price line", OBJ_HLINE, 0, drop_price);
ObjectCreate("Dropped time line", OBJ_VLINE, 0, drop_time);
}
datetime TimeOnDropped(
)
Returns time part of dropped point where expert or script was dropped. This value is valid when expert or script dropped by mouse.
Note: For custom indicators this value is undefined.
Sample
double drop_price=PriceOnDropped();
datetime drop_time=TimeOnDropped();
//---- may be undefined (zero)
if(drop_time>0)
{
ObjectCreate("Dropped price line", OBJ_HLINE, 0, drop_price);
ObjectCreate("Dropped time line", OBJ_VLINE, 0, drop_time);
}
int WindowFind(
string name)
If indicator with name found returns the window index containing specified indicator, otherwise returns -1.
Note: WindowFind() returns -1 if ٌustom indicator searches itself when init() function works.
Parameters
name
-
Indicator short name.
Sample
int win_idx=WindowFind("MACD(12,26,9)");
int WindowHandle(
string symbol, int timeframe)
If chart of symbol and timeframe is currently opened returns the window handle, otherwise returns 0.
Parameters
Sample
int win_handle=WindowHandle("USDX",PERIOD_H1);
if(win_handle!=0)
Print("Window with USDX,H1 detected. Rates array will be copied immediately.");
bool WindowIsVisible(
int index)
Returns true if the chart subwindow is visible, otherwise returns false.
Parameters
index
-
Chart subwindow index.
Sample
int maywin=WindowFind("MyMACD");
if(maywin>-1 && WindowIsVisible(maywin)==true)
Print("window of MyMACD is visible");
else
Print("window of MyMACD not found or is not visible");
Returns window index where expert, custom indicator or script was dropped. This value is valid when expert, custom indicator or script dropped by mouse.
Note: For custom indicators this index is undefined when init() function works and returning index is window index where custom indicator works (may be different from dropping window index, because custom indicator can create its own new window). See also WindowXOnDropped(), WindowYOnDropped()
Sample
if(WindowOnDropped()!=0)
{
Print("Indicator 'MyIndicator' must be applied to main chart window!");
return(false);
}
Returns count of indicator windows on the chart (including main chart).
Sample
Print("Windows count = ", WindowsTotal());
Returns x-axis coordinate in pixels were expert or script dropped to the chart. See also WindowYOnDropped(), WindowOnDropped()
Sample
Print("Expert dropped point x=",WindowXOnDropped()," y=",WindowYOnDropped());
Returns y-axis coordinate in pixels were expert or script dropped to the chart. See also WindowYOnDropped(), WindowOnDropped()
Sample
Print("Expert dropped point x=",WindowXOnDropped()," y=",WindowYOnDropped());