Buffer values

 
Hello,

I'm working with a developer to create a mt4 indicator that reads buffer values on the chart saved by 2 other indicators and uses those values to determine when a trade alert should be given.

I want to use the iCustom() function to reference values stored from the other two indicators on the chart. Then define the logic to determine when a trade alert should be given based on the values retrieved from the other indicators.

The 3 indicators used are "7 Combo", "ZZSRT" and "MA Angle".

ZZSRT and MA Angle store values and 7 Combo references the values stored. 

I do not want to call the ZZSRT and MA Angle internally from within the 7 combo indicator, so if a change is made to the parameters of the ZZSRT or MA Angle, I will need to reload the 7 Combo indicator. 

The developer is saying "I have tried it, but it did not work on our side, it is not a realistic approach."

I'm having a hard time believing him but want to check with ya'll first. 

Please let me know your thoughts and thank you for your help, I appreciate it.

Here is the sample code I sent over. 

7 Combo reads buffer values from ZZSRT and MA Angle and adapts to changes in buffer numbers for ZZSRT and MA Angle:


// Variables to store initial buffer values
double initialMAAngleBuffer[];
double initialZZSRTBuffer[];

// Flag to indicate changes
bool bufferValuesChanged = false;

// OnChartEvent handler
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
    if (id == CHARTEVENT_OBJECT_CREATE && sparam == "7 Combo") {
        // Opening event of 7 Combo properties window
        CaptureInitialBufferValues();
    } else if (id == CHARTEVENT_OBJECT_DELETE && sparam == "7 Combo" && dparam == OBJPROP_XDISTANCE) {
        // Closing event of 7 Combo properties window by clicking "OK"
        CheckForBufferChanges();
    }
}

// Function to capture initial buffer values
void CaptureInitialBufferValues()
{
    // Capture initial buffer values of MA Angle and ZZSRT
    initialMAAngleBuffer[0] = iCustom(Symbol(), PERIOD_CURRENT, "MA Angle", 0, 0);
    initialZZSRTBuffer[0] = iCustom(Symbol(), PERIOD_CURRENT, "ZZSRT", 0, 0);
}

// Function to check for buffer changes
void CheckForBufferChanges()
{
    // Check current buffer values of MA Angle and ZZSRT
    double currentMAAngleBuffer = iCustom(Symbol(), PERIOD_CURRENT, "MA Angle", 0, 0);
    double currentZZSRTBuffer = iCustom(Symbol(), PERIOD_CURRENT, "ZZSRT", 0, 0);
    
    // Compare with initial values
    if (currentMAAngleBuffer != initialMAAngleBuffer[0] || currentZZSRTBuffer != initialZZSRTBuffer[0]) {
        // Buffer values have changed
        bufferValuesChanged = true;
        
        // Trigger necessary actions to adapt 7 Combo indicator
        AdaptIndicator7Combo();
    }
}

// Function to adapt 7 Combo indicator
void AdaptIndicator7Combo()
{
    // Implement logic to adapt 7 Combo indicator to buffer value changes
}
 
Jakey:
    initialMAAngleBuffer[0] = iCustom(Symbol(), PERIOD_CURRENT, "MA Angle", 0, 0);

Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
          General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. I have moved this thread.

 
William Roeder #:

Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
          General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. I have moved this thread.

Hi William,

My mistake and my apologies, thank you for moving it to the correct section. 

Thanks,

Jake

This website uses cookies. Learn more about our Cookies Policy.