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

 
Sorry, I have to go out for an hour, I can't ignore it. If I don't hear from you when I get there, I'll wait patiently. I'm sorry.
 
Artyom Trishkin:

At what time is this new arrow and what time does the cycle start?

You must yourself deal with your code. Either you print all values and understand where they are coming from, or you put a breakpoint and go to debugger and see all values at each step. But I don't think you need the debugger yet...

Of course by myself, and only in this way, but you are a great help to me, thank you. I print everything, I take it apart. It's not as if the arrow doesn't exist, it doesn't notice it. I've got the same settings on indicator parallel running on this chart and Expert Advisor accesses in code.

I will mess around later, in any case, thank you very much. If I don't find anything, I will also do it and will ask for help again.

 
Sergey Voytsekhovsky:

Of course I do it myself and that's the only way, but you're really helping me, thank you. I print everything in a row, I take it apart. It's writing everything correctly, as if the arrow is just not there, it doesn't notice it. I've got the same settings of indicator parallel running on this chart and Expert Advisor accesses it in the code.

I will mess around later, in any case, thank you very much. If I don't find anything, I will also write and will ask for help again.

At what time is this new arrow and at what time does the cycle start?
 
Guys please see my comments here is the linkhttps://www.mql5.com/ru/forum/160683/page848#comment_11760845
 
Artyom Trishkin:
At what time is this new arrow and at what time does the cycle start?

Down arrow on the hourly chart today 20.00 (4 candles ago)

Expert Advisor considers that the latest down arrow was 59 candles ago

The last cycle started at 00:00

 
Seric29:

Another question is how to create a loop that can work in either direction, if you need to run incremental, if you need to run decremental? Here is an example scheme of how it would work.

If (something happened) {assigning values to variables} then the loop will be called and it will have a body, the calculations of which will depend on the values of the loop

for( depending on the variables above increment or decrement)

{ body }

There is no way to duplicate the condition, it has to be specified once in the loop. Is it possible to do this.

you can do it with for(), you can do it with if() - break in an infinite loop, you can also pick conditions for loop interruption in while(), here I made a test script with for():

#property strict
//+------------------------------------------------------------------+
void OnStart()
  {
   Print("loop(10,1) :");
   loop(10,1);
   Print("loop(5,-1) :");
   loop(5,-1);
  }
//+------------------------------------------------------------------+
void loop(int limit,int offset)
  {
   for(int i=0;fabs(i)<=fabs(limit);i+=offset)
     {
      Print("i = ",i);
     }
  }
//+----------------------------------------------------------------

result:

2019.05.21 08:13:43.126 Script t1 EURUSD,M15: removed

2019.05.21 08:13:43.126 t1 EURUSD,M15: uninit reason 0

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = -5

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = -4

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = -3

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = -2

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = -1

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 0

2019.05.21 08:13:43.126 t1 EURUSD,M15: loop(5,-1) :

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 10

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 9

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 8

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 7

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 6

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 5

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 4

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 3

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 2

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 1

2019.05.21 08:13:43.126 t1 EURUSD,M15: i = 0

2019.05.21 08:13:43.126 t1 EURUSD,M15: loop(10,1) :

2019.05.21 08:13:43.126 t1 EURUSD,M15: initialized

2019.05.21 08:13:43.095 Script t1 EURUSD,M15: loaded successfully


 
Igor Makanu:

I see.

Is there no way to export template functions from c++?

 
Artyom Trishkin:
At what time is this new arrow and at what time does the cycle start?

Good afternoon. I think I have found the problem, I am looking into how to fix it. Everything was fixed (EA saw the extreme signals, run in the tester also confirmed everything) after I entered the indicator parameters the same not only in the EA and indicator settings window, but also in the indicator code itself.

 
Sova-kmv :

Good day to all! People, well, tell me if anyone knows.

Here you can get current prices using this code.

Question:

How to properly fasten it?

Well, it would be possible to get it from several currency pairs.

Well, I'm trying to figure it out!

You may try it:

 SymbolInfoDouble ( _Symbol , SYMBOL_BID );

You can replace _Symbol with the selected currency pair. Say: AUDCAD or EURUSD or something else.

 
website
Reason: