• Home
  • Forums
  • News
  • Calendar
  • Coins
  • Market
  • Login
  • Join
  • User/Email: Password:
  • 9:49pm
Menu
  • Forums
  • News
  • Calendar
  • Coins
  • Market
  • Login
  • Join
  • 9:49pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Forex Factory

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

1min chart moving averages 0 replies

MQL4 Language Most Recent Version is it updated beyond the tutorial on the mql4 websi 6 replies

Across the Board Moving Averages On 1 Chart??? 4 replies

Moving averages: A 4hr 18EMA = ? EMA on a 1hr chart... 3 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

How to get List of Moving Averages on a Chart in using MQL4?

  • Post #1
  • Quote
  • First Post: Feb 25, 2021 4:37pm Feb 25, 2021 4:37pm
  •  atif58
  • | Joined Feb 2013 | Status: Member | 86 Posts
I am wondering if there is any way to get the List of Indicators with Input values in MQL4. Actually, I am coding an EA which will list all the Moving Averages (SMA as well as EMA) on the chart. Currently, I used ChartIndicatorsTotal() & and ChartIndicatorName() of MQL4 only returns the list of MA's without the information of type (SMA or EMA).

Following code could be helpful for my required task but unfortunately it is written in MQL5. I am looking for its alternate in MQL4.

The mentioned code prints List of All Indicators and each Indicator's parameters.

https://www.mql5.com/en/docs/series/indicatorparameters

//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{

//--- The number of windows on the chart (at least one main window is always present)
int windows=(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL);
//--- Go through the chart windows
for(int w=0;w<windows;w++)
{
//--- The number of indicators in this window/subwindow
int total=ChartIndicatorsTotal(0,w);
//--- Take all indicators in the window
for(int i=0;i<total;i++)
{
//--- Get the short name of the indicator
string name=ChartIndicatorName(0,w,i);
//--- Get the indicator handle
int handle=ChartIndicatorGet(0,w,name);
//--- Add to log
PrintFormat("Window=%d, indicator #%d, handle=%d",w,i,handle);
//---
MqlParam parameters[];
ENUM_INDICATOR indicator_type;
int params=IndicatorParameters(handle,indicator_type,parameters);
//--- The header of the message
string par_info="Short name "+name+", type "
+EnumToString(ENUM_INDICATOR(indicator_type))+"\r\n";
//---
for(int p=0;p<params;p++)
{
par_info+=StringFormat("parameter %d: type=%s, long_value=%d, double_value=%G,string_value=%s\r\n",
p,
EnumToString((ENUM_DATATYPE)parameters[p].type),
parameters[p].integer_value,
parameters[p].double_value,
parameters[p].string_value
);
}
Print(par_info);
}
//--- Done for all indicators in the window
}
//---
}
  • Post #2
  • Quote
  • Last Post: Feb 26, 2021 7:32pm Feb 26, 2021 7:32pm
  •  Macd-rsi
  • Joined Oct 2019 | Status: Forexian Fighter = FF | 9,534 Posts
inernal MA parameters not available with mt4
get-set method does not include these
Be yourself
 
1
  • Platform Tech
  • /
  • How to get List of Moving Averages on a Chart in using MQL4?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About CC
  • Mission
  • Products
  • User Guide
  • Blog
  • Contact
CC Products
  • Forums
  • Calendar
  • News
  • Coins
  • Market
CC Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow CC
  • Facebook
  • Twitter

CC Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Forex Factory

Crypto Craft® is a brand of Fair Economy, Inc.

Terms of Service / ©2022