Questions from Beginners MQL5 MT5 MetaTrader 5 - page 677

 
Movlat Baghiyev:
I will explain ... I collect the functions that I need about 5-6 that I couldn't find on the web and then I order an EA (as if I invent it) so that these functions could be present there and finally I get the functions that I need - all at once ... And now I just do not have time to fill up my wallet on Mcl .
No, well, order from whoever you're ordering this function anyway. No problem at all...
 
Artyom Trishkin:
No, well, order from someone you'll be ordering this function from anyway. There's no problem...
You just remember that the time will come and no one will give you a hand, and then don't look for reasons why it happened.
 
Oh how.... Threats are coming...
 
Renat Akhtyamov:
Oh how.... Threats are coming...
God forbid ... no threats ... just a call for humanity ....
 
Movlat Baghiyev:
God forbid. No threats. I'm just appealing for humanity. ....

And you are being urged to do this:

Use your brain, write the code. Show me what you got or didn't get. No one will laugh here.

Ask a question about your code. We will tell you what is wrong.

I'm tired of explaining it to you in private.

 
Movlat Baghiyev:

how to find the price at which the crossover occurred? That is, I need to open a deal not at the moment of MA crossing, but, say, 10 points after the crossing.

The function if you can show please

The wizard MQL5 - Trade signals by the intersection of two exponential moving averages. And modify it a bit.
 
Thank you))) I already wrote such ...
 
Movlat Baghiyev:
Thanks a lot))) This is what I have already written .
Here is more

The Expert Advisor works on signals from two iMAs: iMA(5) and iMA(4) on M5 timeframe.

 
Renat Akhtyamov:

Don't be like that if it's far from the truth. It's unnecessary.

Learning to program is about getting into it, not rejecting it.

Well, you read what I write))) I thanked the man. I didn't reject anything.
 
Vladimir Karputov:
Here's more

The Expert Advisor works using signals from two iMAs: iMA(5) and iMA(4) at timeframe M5.

At the beginning we need to set these 10 points/pips - we won't argue about perception. Let's name the variable InpDistanse=10 and immediately the internal variable ExtDistanse. Let's perform tuning in OnInit - for 3 or 5 digits


//--- tuning for 3 or 5 digits
   int digits_adjust=1;
   if(m_symbol.Digits()==3 || m_symbol.Digits()==5)
      digits_adjust=10;

   ExtDistanse   = InpDistanse*digits_adjust*m_symbol.Point();

It remains to introduce a static variable into OnTick(), in which we should record the crossing price. Then we simply calculate the difference between the current price and the crossover price and compare the difference with the ExtDistanse.

Reason: