Hello Coders!
First of all, I’m not a coder and have no ambitions of becoming one. I took this task to make small customizations on this indicator but I’m having 3 small issues and I would value your input and guidance in solving them. What I’m adding to this indicator are external values to control the font type size and color.
1. The first issue is with the text that follows after the check boxes on the panel. I was able to apply the external values to the whole panel (in blue on the screenshot) except this portion of the code. I applied the same method I did for the !LabelCreate and !EditCreate but I get errors when I apply it on !CheckBoxCreate lines (m_ChkCountPendings and m_ChkIgnoreOrders). I assume it’s because it follows after the checkboxes. Like I’ve said I’m not a coder. What is the solution?
2. Second issue.How to add the external values defined as warning_font_face and warning_font_size in this code line after m_EdtRR.Color(warning_color).
3. Third issue.How to apply the external values : panel_font_face, panel_font_size and panel_font_color for the line Caption = "PSC (ver. " + Version + ")";
When I add this piece of code
Caption.Font (panel_font_face);
Caption.FontSize (panel_font_size);
Caption.Color (panel_font_color);
I get the following error
Thanks in advance.
First of all, I’m not a coder and have no ambitions of becoming one. I took this task to make small customizations on this indicator but I’m having 3 small issues and I would value your input and guidance in solving them. What I’m adding to this indicator are external values to control the font type size and color.
1. The first issue is with the text that follows after the check boxes on the panel. I was able to apply the external values to the whole panel (in blue on the screenshot) except this portion of the code. I applied the same method I did for the !LabelCreate and !EditCreate but I get errors when I apply it on !CheckBoxCreate lines (m_ChkCountPendings and m_ChkIgnoreOrders). I assume it’s because it follows after the checkboxes. Like I’ve said I’m not a coder. What is the solution?
Inserted Code
// Portfolio Risk // Reset y = row_start + element_height + 3 * v_spacing; if (!CheckBoxCreate(m_ChkCountPendings, first_column_start, y, panel_end, y + element_height, "m_ChkCountPendings", "Count pending orders")) return(false); y += element_height + v_spacing; if (!CheckBoxCreate(m_ChkIgnoreOrders, first_column_start, y, panel_end, y + element_height, "m_ChkIgnoreOrders", "Ignore orders without stop")) return(false); y += element_height + v_spacing; if (!LabelCreate(m_LblMoney, second_risk_column_start, y, second_risk_column_start + normal_edit_width, y + element_height, "m_LblMoney", "Money")) return(false); m_LblMoney.Font (panel_font_face); m_LblMoney.FontSize (panel_font_size); m_LblMoney.Color (panel_font_color); if (!LabelCreate(m_LblPerc, third_risk_column_start, y, third_risk_column_start + narrowest_edit_width, y + element_height, "m_LblPerc", "%")) return(false); m_LblPerc.Font (panel_font_face); m_LblPerc.FontSize (panel_font_size); m_LblPerc.Color (panel_font_color); y += element_height + v_spacing; if (!LabelCreate(m_LblCrtRisk, first_column_start, y, second_risk_column_start, y + element_height, "m_LblCrtRisk", "Current risk:")) return(false); m_LblCrtRisk.Font (panel_font_face); m_LblCrtRisk.FontSize (panel_font_size); m_LblCrtRisk.Color (panel_font_color); if (!EditCreate(m_EdtCurRiskM, second_risk_column_start, y, second_risk_column_start + normal_edit_width, y + element_height, "m_EdtCurRiskM", "")) return(false); m_EdtCurRiskM.Font (panel_font_face); m_EdtCurRiskM.FontSize (panel_font_size); m_EdtCurRiskM.Color (panel_font_color); m_EdtCurRiskM.ReadOnly(true); m_EdtCurRiskM.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE); if (!EditCreate(m_EdtCurRiskP, third_risk_column_start, y, third_risk_column_start + narrowest_edit_width, y + element_height, "m_EdtCurRiskP", "")) return(false); m_EdtCurRiskP.Font (panel_font_face); m_EdtCurRiskP.FontSize (panel_font_size); m_EdtCurRiskP.Color (panel_font_color); m_EdtCurRiskP.ReadOnly(true); m_EdtCurRiskP.ColorBackground(CONTROLS_EDIT_COLOR_DISABLE);
2. Second issue.How to add the external values defined as warning_font_face and warning_font_size in this code line after m_EdtRR.Color(warning_color).
Inserted Code
/* Risk/Reward */ if (!m_EdtRR.Text(OutputRR)) return(false); if (OutputRR == "Set TP") m_EdtRR.Color(warning_color); else m_EdtRR.Color(panel_font_color);
3. Third issue.How to apply the external values : panel_font_face, panel_font_size and panel_font_color for the line Caption = "PSC (ver. " + Version + ")";
When I add this piece of code
Caption.Font (panel_font_face);
Caption.FontSize (panel_font_size);
Caption.Color (panel_font_color);
I get the following error
Inserted Code
//+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Prevent attachment of second panel if it is not a timeframe/parameters change. if (GlobalVariableGet("PSC-" + IntegerToString(ChartID()) + "-Flag") > 0) GlobalVariableDel("PSC-" + IntegerToString(ChartID()) + "-Flag"); else { int indicators_total = ChartIndicatorsTotal(0, 0); for (int i = 0; i < indicators_total; i++) { if (ChartIndicatorName(0, 0, i) == "Position Size Calculator") { Print("Position Size Calculator attached."); return(INIT_FAILED); } } } IndicatorSetString(INDICATOR_SHORTNAME, "PSC" + IntegerToString(ChartID())); Caption = "PSC (ver. " + Version + ")";
Thanks in advance.