EA Custom indicator load with icustom generate a window on each tick

To add comments, please log in or register
Daniel
63
Daniel  

Hi, i was trying to load a custom indicator with icustom, not available trough the "i*" functions.

int Stochastic=iCustom(_Symbol,_Period,"DSS",inpStoPeriod,inpSmtPeriod1,inpSmtPeriod2,inpSigPeriod,PRICE_WEIGHTED); 

The values for inpStoPeriod, inpSmtPeriod1, inpSmtPeriod2, inpSigPeriod are set over input fields. 


The indicator itself has the following inputs

input int      inpStoPeriod   = 21;         // Stochastic period

input int      inpSmtPeriod1  =  3;         // Smoothing period 1

input int      inpSmtPeriod2  =  3;         // Smoothing period 2

input int      inpSigPeriod   =  8;         // Signal/trigger period

input enPrices inpPrice       = pr_lowhigh; // Price


The indicator is load successfully on the strategy tester according to the journey, aswell there seem to be no errors.

But the indicator window stacks on ~each tick. After a short time there are 3-5 Stochastic windows with the same result, that keeps going until the chart dissappear.

Aswell when trying to run the EA withouth visual it takes 30 minutes to end the test for a single day.


Edit: The indicator i like to load: https://www.mql5.com/en/code/23277

Edit2: Aswell a picture of the problem https://imgur.com/a/2X5rXiF

Edit3: Are there any advantages loading the indicator with "IndicatorCreate" function ?


Please tell me what i did wrong.

Double smoothed stochastic of ratio
Double smoothed stochastic of ratio
  • www.mql5.com
Unlike the double smoothed stochastic itself (that was originally published here : Double Smoothed Stochastic), the "ratio" part of this version can be traced back to Walter Bressert - he uses it as an oscillator, but since that way of calculating (EMA(short)/EMA(long)) is known for long time before that, only the ratio is added to...
William Roeder
23266
William Roeder  
  1. PRICE_WEIGHTED is a ENUM_APPLIED_PRICE not whatever enPrices is.
  2. Please don't post a link to an image, just insert the image.
              Messages Editor
  3. For links, please use the link button (Control+K) See the difference? https://imgur.com/a/2X5rXiF
              Messages Editor
  4. Are you getting the handle in OnInit? In OnTick you use the handle, shift and count to get the data.
              Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
              Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
              How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
              How to call indicators in MQL5 - MQL5 Articles 12 March 2010

    Also see my example for encapsulating calls
              Detailed explanation of iCustom - MQL4 programming forum 2017.05.23

Daniel
63
Daniel  

Hi William and thanks for your answer.

1. I forgot to add the enPrices enum:

enum enPrices
{
   pr_close   =PRICE_CLOSE,    // Close
   pr_open    =PRICE_OPEN,     // Open
   pr_high    =PRICE_HIGH,     // High
   pr_low     =PRICE_LOW,      // Low
   pr_median  =PRICE_MEDIAN,   // Median
   pr_typical =PRICE_TYPICAL,  // Typical
   pr_weighted=PRICE_WEIGHTED, // Weighted
   pr_lowhigh =-99             // Low/High
};

Do i need to add as parameter "pr_weighted" instead of PRICE_WEIGHTED ?

2. Unluckily it looks like im not able to do that, may im missing some reputation.

4. I am calling the icustom function inside OnTick(). Oh now i got it, thanks a lot.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
To add comments, please log in or register