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

 
potom:
What's up? I don't get it. Can you put it in simple terms if you don't mind?

you would be more specific about what you need, what you're working on?
Because you get "spherical" answers to "spherical" questions.)

ps. although there's also the subject of telepaths.

 

Question on terminals! On one terminal the Expert Advisor works as it should creating a global variable and deleting it only when I press the button on the screen, but in the second terminal this variable disappears when I change the chart period.

And one more glitch the NormalizeDouble function formats the number to 2 decimal places (in the first terminal) but in the second NormalizeDouble does not format the number to 2 decimal places and stays as it is 0.70000000000000000 (I tried another terminal, it is also a glitch) all terminals are on disk D. Who can tell me what this glitch is and how to fix it?

 

Hello. The writing of the EA is progressing smoothly. Thank you all for your help.

The following task has arisen: There is a flat, which is bounded at the top and bottom by horizontal lines. It is done by a robot. So, I need to get data from the indicator for the period, in which all bars were inside the flat.

In other words: from the current bar where the robot sets the levels, and deep into history, till the moment when the price has entered into flat, as well as the next bars until the price comes out of the flat.

The indicator data for this period should be written in the array of the Expert Advisor for further operations.

Here is the problem. Maybe we can use the moving average to identify when the price enters a flat period between the levels and when it exits the flat period?

 

Hello!

I'm trying to read a text file into an array, I want to write each price and date into my array, but I don't understand how to deal with delimiters here. You can see the text in the file in the attached file.

P.S.

Strange how the attached file looks ordered. Attached a picture of how it looks on the computer.


Files:
 

Question:


There is an indicator1 which draws a line based on the maximum and blue of the last 20 values. On a candlestick chart it looks like a price channel.

There is another self-written indicator2 that draws a line like RSI in a separate window under the price chart.


How to make an indicator1 builds on data from indicator2.

 

Can you give me a hint, the indicator is not working. If attached to a pair with JPY it shows the weather, if attached to another without JPY, also not correct.

      double MA1_EURUSD = iMA("EURUSD",TimeFrame,MA_Period,0,MODE_EMA,PRICE_CLOSE,0);
      double MA2_EURUSD = iMA("EURUSD",TimeFrame,MA_Period,Shift,MODE_EMA,PRICE_CLOSE,0);
    
      double MA1_GBPUSD = iMA("GBPUSD",TimeFrame,MA_Period,0,MODE_EMA,PRICE_CLOSE,0);
      double MA2_GBPUSD = iMA("GBPUSD",TimeFrame,MA_Period,Shift,MODE_EMA,PRICE_CLOSE,0);
    
      double MA1_USDJPY = iMA("USDJPY",TimeFrame,MA_Period,0,MODE_EMA,PRICE_CLOSE,0);
      double MA2_USDJPY = iMA("USDJPY",TimeFrame,MA_Period,Shift,MODE_EMA,PRICE_CLOSE,0);  
      
      string EURUSD, GBPUSD, USDJPY;

      if (MathAbs(MA1_EURUSD-MA2_EURUSD)>dist*Point) {EURUSD="Attention!";} else {EURUSD="flat";}
      if (MathAbs(MA1_GBPUSD-MA2_GBPUSD)>dist*Point) {GBPUSD="Attention!";} else {GBPUSD="flat";}
      if (MathAbs(MA1_USDJPY-MA2_USDJPY)>dist*Point) {USDJPY="Attention!";} else {USDJPY="flat";}
 
Сергей:

Where is the mistake?

And further on in the subject. Take the string parameter in quotes

string "EURUSD", "GBPUSD", "USDJPY";
 
Vitaly Muzichenko:

And further on the subject.


After editing as you have:

'GBPUSD_1' - name expected MyIndi 3 (MA).mq4 61 26

You got it wrong sir
 
Сергей:


After editing as you have:

'GBPUSD_1' - name expected MyIndi 3 (MA).mq4 61 26

You got it wrong sir

Forum on trading, automated trading systems & strategy testing

Any questions from beginners on MQL4, help and discussion on algorithms and codes

Vitaly Muzichenko, 2017.10.19 22:38

And further on the topic. Take the string parameter in quotes

string "EURUSD", "GBPUSD", "USDJPY";

 
Artyom Trishkin:


I understand you perfectly, but you're wrong.

Put in inverted commas and you get:

'EURUSD' - name expected MyIndi 3 (MA).mq4 61 14

Right

string EURUSD, GBPUSD, USDJPY;
EURUSD="Attention!";
Reason: