Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
bool OnClickShowOpenTrades(const long, const string, const int, const int, const int);That is a function/method declaration.
ON_EVENT(ON_CLICK, m_BtnShowOpenTrades, OnClickShowOpenTrades(const long, const string, const int, const int, const int)) <=== line 131
That is a function call with an embedded declaration — garbage. Delete the declaration and pass a value.
That is a function/method declaration.
That is a function call with an embedded declaration — garbage. Delete the declaration and pass a value.
Thanks for the prompt feedback. I don't understand why values should be passed to function/method declaration. As far as I understand it, only the type of variables or object types is specified for the function/method declaration. Are you saying I should write the code as something like this:
ON_EVENT(ON_CLICK, m_BtnShowOpenTrades, OnClickShowOpenTrades( 0 , "Panel Caption Title" , 0 , 100 , 100 ))
The sky is blue. | Is the sky blue? |
Delete the declaration and pass a value. | Are you saying I should write the code as something like this… |
MT4: Learn to code it.
MT5: Begin learning to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
or pay (Freelance) someone to code it. Top of every page is the link Code Base.
Hiring to write script - General - MQL5 programming forum 2019.08.21
The sky is blue. | Is the sky blue? |
Delete the declaration and pass a value. | Are you saying I should write the code as something like this… |
MT4: Learn to code it.
MT5: Begin learning to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
or pay (Freelance) someone to code it. Top of every page is the link Code Base.
Hiring to write script - General - MQL5 programming forum 2019.08.21
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good day fellow traders and programmers
I am new to MQL programming and am currently adapting a forex position calculator developed by a broker for my own usage. Below is my adapted section of code:
========================================================= start of code =========================================================================
........ (some code here)
........ (some code here)
virtual bool Create(const long chart, const string name, const int subwin, const int x1, const int y1);
virtual bool OnEvent(const int id, const long& lparam, const double& dparam, const string& sparam);
// Gets values from lines, recalculates position size, and updates values in the panel.
virtual void RefreshValues();
virtual bool SaveSettingsOnDisk();
virtual bool LoadSettingsFromDisk();
virtual bool DeleteSettingsFile();
virtual bool Run() {SeekAndDestroyDuplicatePanels(); return(CAppDialog::Run());}
virtual void IniFileLoad() {CAppDialog::IniFileLoad();InitObjects();} // Sets panel elements that changed based on changes in input parameters, overwriting the INI settings.
virtual void HideShowMaximize(bool max);
string IniFileName(void) const;
virtual void UpdateFixedSL();
virtual void UpdateFixedTP();
virtual void FixatePanelPosition() {if (!m_minimized) m_norm_rect.SetBound(m_rect); else m_min_rect.SetBound(m_rect);} // Used to fixate panel's position after calling Move(). Otherwise, unless the panel gets dragged by mouse, its position isn't remembered properly in the INI file.
virtual void UpdateScriptTPEdit(int i);
virtual void UpdateScriptTPShareEdit(int i);
virtual void SetPanelTitleBarLayout();
// Remember the panel's location to have the same location for minimized and maximized states.
int remember_top, remember_left;
private:
virtual void ShowMain();
virtual void ShowRisk();
virtual void ShowMargin();
virtual void ShowSwaps();
virtual void ShowScript();
virtual void HideMain();
virtual void HideRisk();
virtual void HideMargin();
virtual void HideSwaps();
virtual void HideScript();
virtual bool CreateObjects();
virtual bool InitObjects();
// Arranges panel objects on the panel.
virtual void MoveAndResize();
virtual bool DisplayValues();
virtual void SeekAndDestroyDuplicatePanels();
virtual void ProcessTPChange(const bool tp_button_click);
virtual bool ButtonCreate (CButton& Btn, int X1, int Y1, int X2, int Y2, string Name, string Text);
virtual bool CheckBoxCreate (CCheckBox& Chk, int X1, int Y1, int X2, int Y2, string Name, string Text);
virtual bool EditCreate (CEdit& Edt, int X1, int Y1, int X2, int Y2, string Name, string Text);
virtual bool LabelCreate (CLabel& Lbl, int X1, int Y1, int X2, int Y2, string Name, string Text);
virtual void Maximize();
virtual void Minimize();
virtual void ChangePanelBackgroundColor(color);
// Event handlers
void OnEndEditEdtEntryLevel();
void OnEndEditEdtSL();
void OnEndEditEdtTP();
void OnClickBtnOrderType();
void OnClickBtnLines();
void OnClickBtnAccount();
bool OnClickShowOpenTrades(const long, const string, const int, const int, const int);
void OnEndEditEdtCommissionSize();
void OnEndEditEdtRiskPIn();
.......... (some code here)
.......... (some code here)
EVENT_MAP_BEGIN(QCPositionSizeCalculator)
ON_EVENT(ON_END_EDIT, m_EdtEntryLevel, OnEndEditEdtEntryLevel)
ON_EVENT(ON_END_EDIT, m_EdtSL, OnEndEditEdtSL)
ON_EVENT(ON_END_EDIT, m_EdtTP, OnEndEditEdtTP)
ON_EVENT(ON_CLICK, m_BtnOrderType, OnClickBtnOrderType)
ON_EVENT(ON_CLICK, m_BtnLines, OnClickBtnLines)
ON_EVENT(ON_CLICK, m_BtnAccount, OnClickBtnAccount)
ON_EVENT(ON_CLICK, m_BtnShowOpenTrades, OnClickShowOpenTrades(const long, const string, const int, const int, const int)) <=== line 131
ON_EVENT(ON_END_EDIT, m_EdtCommissionSize, OnEndEditEdtCommissionSize)
ON_EVENT(ON_END_EDIT, m_EdtRiskPIn, OnEndEditEdtRiskPIn)
========================================================= end of code =========================================================================
Upon compilation, compiler gives the following errors:
I would really appreciate if someone could help me on this. I have googled extensive a lot but found nothing that can help.