Oncalculated to EA

 
Hi everyone, I'm just learning about mql5 programming. I had a little difficulty and created an expert advisor. I want to enter the MQ5 indicator code into the Expert Advisor but without using the onCalculate function. My code runs smoothly for indicators. But I want to use it directly into the EA function without iCustom(). My problem regarding onCalculated is for the declaration of Rates_total and Prev_Calculated ? Meanwhile, to get data rates such as open, high, low, close, I use mqlrates. Can anyone help me?
 
  1. Why did you post your coding question in the MT5 General section (a miscellaneous catch-all category) instead of the MT5 EA section (non-indicator coding)?
              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.

  2. Perhaps you should read the manual, or press F1 in the editor. OnCalculate is only for indicators; nothing to do with EAs at all! There are no rates_total, prev_calculated, or buffers in EAs.
       How To Ask Questions The Smart Way. (2004)
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.


 
Agus Triyanto:
Hi everyone, I'm just learning about mql5 programming. I had a little difficulty and created an expert advisor. I want to enter the MQ5 indicator code into the Expert Advisor but without using the onCalculate function. My code runs smoothly for indicators. But I want to use it directly into the EA function without iCustom(). My problem regarding onCalculated is for the declaration of Rates_total and Prev_Calculated ? Meanwhile, to get data rates such as open, high, low, close, I use mqlrates. Can anyone help me?

If you move calculations into EA, it's up to you how to choose analogues for rates_total and prev_calculated - it depends from specificity of your pseudo-indicator - for example, it may be suffice to calculate values only on the single latest bar.