Questions from Beginners MQL5 MT5 MetaTrader 5 - page 753

 
Top2n:


Thank you! If you don't mind another question, how on earth does this split a two-dimensional array into two, the logic breaks down, doesn't it?

If you want to give a two-dimensional array from an indicator, make a buffer for each dimension of the array.

Buffer 0 is the first dimension, buffer 1 is the second dimension.

And get them in the EA in the usual way.

 
Artyom Trishkin:

If you want to give a two-dimensional array from an indicator, make a buffer for each dimension of the array.

Buffer 0 is the first dimension, buffer 1 is the second dimension.

And get them into the EA in the usual way.


Thanks, but if the dimensionality is 1000*1000, then not how.

So how do you split a two-dimensional array into two?

I have a one-dimensional array of data on each bar

 
Top2n:


Thanks, but if the dimensionality is 1000*1000, then no way.

So how does it split a two-dimensional array into two?

I have a one dimensional array of data on each bar

Why do you need to calculate everything in the indicator in order to feed it to the Expert Advisor? Just calculate everything in the Expert Advisor - it will be easier.
 
Artyom Trishkin:
Why do you need to make calculations in an indicator and then pass them to the Expert Advisor? Just calculate everything in the Expert Advisor - it will be easier.


I have a class that uses parameter&price[]

OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
   sm.Solve(rates_total,prev_calculated,price);

I can't get around it in the EA

 
Top2n:


I have a class that uses&price[] as a parameter

I can't get around it in the EA

Carefully read the "Access to timeseries and indicators" section of the documentation and everything will become clear.

You can also use"SymbolInfoTick" to get prices in EAs.

Документация по MQL5: Доступ к таймсериям и индикаторам
Документация по MQL5: Доступ к таймсериям и индикаторам
  • www.mql5.com
Доступ к таймсериям и индикаторам - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

Colleagues, good day.

I've read through about 20 MQL5 topics but did not find an answer to the following question: where can I get a sample code of a simple MQL5 Expert Advisor for FORTS automated trading?

The simpler the EA, the better. The more simple the EA is, the better.

I already have a working code in MT5.


I have previously worked with Tranzac, AmiBroker and some IT terminal. Never worked with MetaTrader 4 or 5,

But now Jus2Trade (apparently it's a Finam subsidiary) has MT5 with access to forts and American futures.

I want to try it on MT5, but I can't find a proper example that works properly. All examples are for forex.

Colleagues, poke the link, please.

 
Alexey Viktorov:

Carefully read the "Access to timeseries and indicators" section of the documentation and you will see everything.

You can also use"SymbolInfoTick" to get prices in EAs.


I don't get it.
 

Good people, advise how to bypass these parameters in an EA, I can't figure out how to use a class customized for an indicator in an EA

sm.Solve(rates_total,prev_calculated,price);

Info: when starting indicator I use SMA, apply to HL/2

 
Top2n:

Good people, advise how to bypass these parameters in an EA, I can't figure out how to use a class customized for an indicator in an EA

Info: I use SMA when starting indicator, apply to HL/2

I don't need rates_total or prev_calculated in my EA. Step on these incomprehensible expressions and press F1, read what they mean, maybe then it will become clearer. After all, all actions have to be meaningful. How can you do something without thinking what you think it may or may not work? How can you use something without understanding what it is?

Well, just imagine that if you want to hammer a nail, you will try to do it with a rake or a microscope without understanding what you are dealing with...

If you need the iMA indicator values on the last 2-3 bars, you can get them through CopyBuffer by a handle of the indicator created before. Right there, when you create an indicator and get its handle

PRICE_MEDIAN

The median price, (high+low)/2


And there is an absolutely clear example in the documentation.

Документация по MQL5: Технические индикаторы / iMA
Документация по MQL5: Технические индикаторы / iMA
  • www.mql5.com
Технические индикаторы / iMA - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexey Viktorov:

Neither rates_total nor prev_calculated are needed in the EA. Step on these incomprehensible expressions and press F1, read what they mean, maybe then it will become clearer. After all, all actions have to be meaningful. How can you do something without thinking what you think it may or may not work? How can you use something without understanding what it is?

Well, just imagine that if you want to hammer a nail, you will try to do it with a rake or a microscope without understanding what you are dealing with...

If you need the iMA indicator values on the last 2-3 bars, you can get them through CopyBuffer by a handle of the indicator created before. Right there, when you create an indicator and get its handle

PRICE_MEDIAN

The median price, (high+low)/2


And there is an absolutely clear example in the documentation.


Ok, I overdid with the first two rates_total and the other one, but instead of prece ->&aData[]. you should integrate the class, not the indicators through copybuff

the class is

//+------------------------------------------------------------------+
void  CSMA_Greed::Solve(const int aRatesTotal,const int aPrevCalc,const double  &aData[])
  {
   rt=aRatesTotal; prv=aPrevCalc;
   for(int i=0;i<m_max_period;i++)ArrayResize(d[i].m,rt);
   chsma.Solve(rt,prv,aData,d[m_max_period-1].m);

   for(int i=prv>m_max_period?prv:m_max_period;i<rt;i++)
     {
      temp=d[m_max_period-1].m[i]*m_max_period;
      for(int j=m_max_period-2;j>=0;j--)
        {
         temp-=aData[i-(j+1)];
         d[j].m[i]=temp/(j+1);
        }
     }
  };
Reason: