22.9 C
San Juan
Sunday, March 8, 2026

Working with indicator buffers “Haven Market Construction Hl Ll Hl Lh” – Buying and selling Methods – 5 Could 2025


Introduction

To make use of indicator buffers in your Knowledgeable Advisors or just to learn information from indicator buffers, you might want to carry out a number of steps:

1. Defining Enter Parameters

You could decide which enter parameters the indicator has and which of them you need to modify or use when loading the indicator into your Knowledgeable Advisor. In our case, right here is my record of enter parameters that I exploit within the indicator Haven Market Construction Hl Ll Hl Lh.

We see these values within the Inputs window when loading the indicator onto the chart.



enter group "===== Construction Evaluation =====";
enter int   SwingPeriod = 2;
enter int   HistoryBars = 500;
enter bool  ShowCHoCH    = true;

enter group "===== BOS Settings =====";
enter bool  UseBodyForBreakout = false;
enter int   LabelSize_Line     = 8;
enter colour BOSUpColor         = clrRoyalBlue;
enter colour BOSDownColor       = clrRed;
enter int   BOSLineWidth       = 2;
enter ENUM_LINE_STYLE bosStyle = STYLE_SOLID;

enter group "===== CHoCH Settings =====";
enter colour CHoCHUpColor       = clrDodgerBlue;
enter colour CHoCHDownColor     = clrFireBrick;
enter int   CHoCHLineWidth     = 2;
enter ENUM_LINE_STYLE chchStyle = STYLE_DASH;

enter group "===== Label Settings =====";
enter int   LabelSize          = 10;
enter colour HHColor            = clrGreen;
enter colour HLColor            = clrBlue;
enter colour LHColor            = clrOrange;
enter colour LLColor            = clrRed;

enter group "===== Notification Settings =====";
enter bool EnablePushNotifications = false;
enter bool EnableAlerts            = false;

2. Creating the Indicator Deal with

Subsequent, you might want to create an indicator HANDLE and specify the specified indicator parameters for it (that is how we load into our program a model of the indicator with the proper settings), after which we will use it in our code. On this instance, we load all obtainable parameters through ICustom. Nonetheless, you may omit them, and the indicator will load with its default settings outlined in its code. A very powerful parameters listed below are “SwingPeriod“, “ShowCHoCH” and “UseBodyForBreakout“; all others solely have an effect on the graphical illustration of the indicator.
Observe that in MQL5 you could go parameters to ICustom precisely as they seem within the indicator code, preserving their order. You can not specify solely UseBodyForBreakout—ICustom will go our parameter to the primary listed parameter within the indicator code (which, oddly sufficient, is “===== Construction Evaluation =====”, as a result of “enter group” counts as a parameter though it ought to solely separate the inputs).

int marketStructureHandle = iCustom(
                               _Symbol, PERIOD_CURRENT,
                               "IndicatorsMarketHaven Market Construction Hl Ll Hl Lh.ex5", 
                               "===== Construction Evaluation =====", 
                               SwingPeriod,
                               HistoryBars,
                               ShowCHoCH,
                               "===== BOS Settings =====",
                               UseBodyForBreakout,
                               LabelSize_Line,
                               BOSUpColor,
                               BOSDownColor,
                               BOSLineWidth,
                               bosStyle,
                               "===== CHoCH Settings =====",
                               CHoCHUpColor,
                               CHoCHDownColor,
                               CHoCHLineWidth,
                               chchStyle,
                               "===== Label Settings =====",
                               LabelSize,
                               HHColor,
                               HLColor,
                               LHColor,
                               LLColor,
                               "===== Notification Settings =====",
                               EnablePushNotifications,
                               EnableAlerts);

3. Utilizing the CopyBuffer Operate

Subsequent, we use CopyBuffer to repeat information from the buffers to be used in our program. Instance:

int bars_to_copy = 100;

CopyBuffer(marketStructureHandle, 0, 0, bars_to_copy, HH_Buffer);
CopyBuffer(marketStructureHandle, 1, 0, bars_to_copy, LL_Buffer);
CopyBuffer(marketStructureHandle, 2, 0, bars_to_copy, HL_Buffer);
CopyBuffer(marketStructureHandle, 3, 0, bars_to_copy, LH_Buffer);
CopyBuffer(marketStructureHandle, 4, 0, bars_to_copy, BOS_UP_Buffer);
CopyBuffer(marketStructureHandle, 5, 0, bars_to_copy, BOS_DOWN_Buffer);
CopyBuffer(marketStructureHandle, 6, 0, bars_to_copy, CHoCH_UP_Buffer);
CopyBuffer(marketStructureHandle, 7, 0, bars_to_copy, CHoCH_DOWN_Buffer);

Now, our arrays (HH_Buffer[], LL_Buffer[], HL_Buffer[], LH_Buffer[], BOS_UP_Buffer[], BOS_DOWN_Buffer[], CHoCH_UP_Buffer[], CHoCH_DOWN_Buffer[]) include the indicator buffer values for the final bars_to_copy candles on the chart (together with empty values when no buffer worth exists for a given candle). That is essential to precisely know which candle and when a selected indicator sign occurred.

5. Printing Information or Additional Use in Your Logic

Now, merely print the values of our arrays together with the corresponding date and time.


for (int i = 0; i < bars_to_copy; i++)
 CHoCH UP = ", DoubleToString(CHoCH_UP_Buffer[i], _Digits));
   if (CHoCH_DOWN_Buffer[i] != EMPTY_VALUE)
      Print(time_str, " 

Indicator buffer values output to the terminal.

Conclusion

After acquiring the indicator buffer values in your Knowledgeable Advisor, you should utilize them in your advisor’s buying and selling logic.

For a extra detailed article on learn how to use indicator buffers in your Knowledgeable Advisors: MQL5 for Newbies: Information to Utilizing Technical Indicators in Knowledgeable Advisors

🔵 My different merchandise: https://www.mql5.com/en/customers/maks19900/vendor

🔵Telegram Channel: https://t.me/maks_haven

The script file from the instance:

Related Articles

Stay Connected

0FansLike
0FollowersFollow
0SubscribersSubscribe
- Advertisement -spot_img

Latest Articles