[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1109

 
kolyango:
Tell me, what does it mean when compiling the EA: At the beginning of the EA there is: Is it a file reference in libraries? And will the EA work correctly with this reference and 2 warnings at compilation?
Just a message saying that these two functions present in the source code will be removed from the executable code because no references to them (reference attempts) have been detected.
 
Sergey_Rogozin:

Good evening everyone!

How do I calculate the Stop Loss? Calculation formula.

Number of currencies multiplied by the price and divided by the time
 
Sergey_Rogozin:

Good evening everyone!

How do I calculate the Stop Loss? Calculation formula.


Maybe http://masterforex-v-forex.narod.ru/post_1263305503.html will help

Although I myself do not use. I have everything easier.

 

abolk:

Sergey Rogozin:

Good evening everyone!

How do I calculate the Stop Loss? Calculation formula.

Number of currencies multiplied by price and divided by time

No, I had a better suggestion. Go to school for starters.
 
sergeev:

No, I had a better suggestion. Go to school for starters. I'm not smart enough.

I agree. I was just messing with the brackets.
 
Abzasc:

https://www.mql5.com/ru/forum/123941

and with the code, I got a tip like this.

and used it for different names.


VladislavVG:
Delete (objects) in reverse order (from higher number to lower number), because after deletion the numbering is changed .... It's been discussed hundreds of times.

Thanks so much for your prompt help !!!

Yes indeed it was about the sequence of deleting objects, unfortunately I didn't know about it before - it's my first indie written from scratch myself.

Here's the code that does everything I need it to do

for(int j = ObjectsTotal() - 1; j >= 0; j--)       //Анализируем объекты ОТ ПОСЛЕДНЕГО К ПЕРВОМУ
   if(!StringFind(ObjectName(j), "Skalomer_"))     //Если StringFind() вернёт 0, то...
      ObjectDelete(ObjectName(j));		   //Тогда удаляем этот объект
 
ALEX_SPB_RU:

Thank you very much for your prompt help !!!

Yes indeed it was about the sequence of deleting objects, unfortunately I didn't know about it before - it's my first indie written from scratch myself.

Here's the code that does everything I need

IMHO - this is better:

/// Удаление всех объектов с префиксом prefix
int deleteObjectsByPrefix(string prefix)
{
        int obj_total = ObjectsTotal();
        string name="";
        int err = GetLastError();
        int Delcount = 0;
        int Objcount = 0;
        for (int i = obj_total - 1; i >= 0; i--)
        {
                name = ObjectName(i);
                if (StringFind(name, prefix) != -1)
                {
                   Objcount++;
                        if(ObjectDelete(name))Delcount++;
                        else
                        {
                            err = GetLastError();
                            Print("Error(",err,") ",ErrorDescription(err)); 
                        }
                }                       
        }
        return(Delcount-Objcount);
}

Similar functions have been posted many times - you could just use search ;)......

But in any case it is much more useful to figure it out on your own.

Good luck.

 
VladislavVG:

IMHO - this is better:

Similar functions have been posted many times - you could just use the search ;)......

But in any case, it's much more useful to figure it out on your own.

Good luck.

Wow, you have thrown a universal function at once - I will take it into account but allow me to make two remarks:

1. StringFind(name, prefix) != -1

I don't really like it because if the object's name turns out to be ya ya_Prefix_78, it will also get deleted. But I logically think it should not, because nowhere in the middle of the text will that combination of characters be found which we put as a label at the beginning. IMHO!

2. Since this is a branch for dummies, it's worth mentioning, that your function won't fail at compiling, you should specify before it (yesterday, when I was searching for an error, I bumped my head on finding what I should have occluded 8-)) )

#include <stdlib.mqh>

Thanks!

 
ALEX_SPB_RU:

Wow, you just threw a universal function at once - I'll take it into account, but allow me to make two remarks:

1. StringFind(name, prefix) != -1

I don't really like it because if the object's name was ya ya_Prefix_78, it would also get deleted. Which is logical for me, because we should not have such a combination of characters in the middle of text which we'd put as a label at the beginning. IMHO

2. Since this is a branch for dummies, it's worth mentioning, that your function won't fail at compiling, you should specify before it (yesterday, when I was searching for an error, I bumped my head on finding what I should have occluded 8-)) )

Thanks!

You can correct as you see fit - it's just a demonstration of the approach...

If you want the string to be deleted to be a prefix only, you can specify that the search is from null position in the string - as you have originally.

Good luck.

 
VladislavVG:

You can correct as you see fit - this is just a demonstration of the approach...

If you want the string to be deleted to be a prefix only, you can specify that the search from null position in the string - as you have originally.

Good luck.

Still don't get it!

Even if I explicitly specify that the search must start at position zero, the object named ya ya_Prefix_78 will be deleted becausethe function returns number 4

Specifically, to delete by prefix, you must specify either ==0 or put !

No offense, I'm just learning, so I want to unpack everything for myself.

Thanks again for your help!

Good luck!

Reason: