Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 231

 

Good afternoon, please advise on the function of determining the bar index from which to recalculate the indicator. I need to recalculate the zero bar and the first bar.

int GetRecalcIndex(int& total, const int ratesTotal, const int prevCalculated)

{

      total = ratesTotal - 1;                                                                         

       if (i_indBarsCount > 0 && i_indBarsCount < total)

      total = MathMin(i_indBarsCount, total);                      

        if (prevCalculated < ratesTotal - 1)                     

   {       

      BuffersInitializeAll();

      return (total);

   }

   return (MathMin(ratesTotal - prevCalculated, total));

 

STARIJ:

...

... Can you tell me how to output a symbol name?

ChartSymbol

Returns the name of the specified chart symbol.

stringChartSymbol(
longchart_id=0// chart ID
);

Parameters

chart_id=0

[in]Chart ID. 0 indicates the current chart.

Returned value

If no chart exists, it returns an empty string.

See also

ChartSetSymbolPeriod()

 
Artyom Trishkin:

ChartSymbol

Returns the name of the specified chart symbol.
stringChartSymbol( longchart_id=0);

Thank you!

 
STARIJ:

Thank you!


On mql from one sucript, where is the source?

I'm a photoshop god too.

 
Evgeny Belyaev:     I am an mql script, where is the source code? I am a ... am a photoshop god.

There is a browser plugin that checks spelling. Attached is a superscript to your photoshop. There are comments in places. If you have any questions, please contact me in person. If you want to change any name in MetaEditor, highlight it and press Ctrl-H. Start with the longer ones. If you replace short Per with Param, the Period will be replaced with Paramyod. To save comments, replace them one by one. Instead of photoshop, I advise you to study MQL. Or you have other plans? Please advise how the script has helped you to approach the profit. Or you have other plans?

Files:
 

Can you tell me howto change the signal line in the standardiMACD calculationto ExponentialMA?

 
Rustam Bikbulatov:

Can you tell me howto change the signal line in the standardiMACD calculationto ExponentialMA?


No, only by editing the indicator source.

 
Vitalie Postolache:

You can't, only by editing the indicator's source code.


Well, initially the data is taken from the formula located in a file somewhere in the folders, or it is not true?

 
Rustam Bikbulatov:

Well, initially the data is taken from the formula located in a file somewhere in the folders, or it's not true?


And your MACD is calculated in the Expert Advisor by a formula from some file? Or the indicator is called by iMACD command? If it is the first one, which I doubt, then rewrite the formula. If the second, then replacing the call of the standard indicator with the call of the redesign with calculation of the signal line by EMA will help.

 
Vitalie Postolache:

Is the iMACD calculated in your EA using a formula from some file? Or is the indicator called by iMACD command? If it is the first one, which I doubt, then rewrite the formula. If the second, then replacing the call of the standard indicator with the call of the modification that calculates the signal line by EMA will help.

Second. Command to open an order. For example

      if(LastTime!=iTime(NULL,1,0)){  
      
double   EURUSD =
                  +(iMACD("EURUSD",1,1,60,60,0,1,0));  
    
         bool BuySignal=false;
         bool SellSignal=false;  
                
         if(  EURUSD > 2 ){
  
            BuySignal=true;}  
                  
         if(  EURUSD < -2 ){
                    
            SellSignal=true;}