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

 
MakarFX:

This might help. I'm going to try and add it to the advisor.

 
Порт-моне тв:

Look, the problem is that the percentage I want to set, for example (1%) changes numerically and if

then the result will be that with each new trade the BALANCE will also increase and so will the 1% of it. Thus, my function will not work, because there is no FIXED SET POINT.

you have a balance at the beginning of the day 1000, 1%=10

if the profit during the day is 5, then balance - profit = 1000 and 1% = 10

 
MakarFX:

THANK YOU!!! IT WORKED FOR ME!!!!!

 
Порт-моне тв:

THANK YOU!!! IT WORKED FOR ME!!!!!

You're welcome)
 
Порт-моне тв:

I miscalculated here, in addition to the profit/loss for the day I need the account balance at the beginning of the day. :((( Help))

Account balance() - it changes constantly, how to fix it for example on Hour==1 ?

I understand that there's a lot you may not know in the language you're using...

But, man, there's no way to query this damn balance in ==1 and store it in a separate variable at all?

 

Please help to find or write a function to search for objects on open charts.

Five open charts, EA is on the first one. MT4

 
MakarFX:

Please help to find or write a function to search for objects on open charts.

Five open charts, EA is on the first one. MT4

Makar is not ashamed?

Search for objects on the chart is not a familiar function? You also don't know how to look through all the charts?

The first parameter in the object search function is Chart_ID() - it has to be changed in the chart loop...

 
Alexey Viktorov:

Isn't it a shame, Makar?

Searching for objects on a graph is not a familiar function? Don't you know how to search all graphs?

The first parameter in object search function is Chart_ID() - it must be changed in chart loop...

That's my problem with Chart_ID()

I did it this way

   long currChart=ChartFirst();
   double pr;
   int vdigits;
   int i=0,limit=5; while(i<=limit)
     {
      if(ObjectFind(currChart,ChartSymbol(currChart)+" BUY")==0) 
        { 
         pr=ObjectGetDouble(currChart,ChartSymbol(currChart)+" BUY",OBJPROP_PRICE1);
         vdigits = (int)MarketInfo(ChartSymbol(currChart),MODE_DIGITS); 
         Print(ChartSymbol(currChart)," ",DoubleToStr(pr,vdigits));
        }else{Print(ChartSymbol(currChart),"0");}
      currChart=ChartNext(currChart);  i++;
     }

but I won't be able to check it in the tester(

...I have to wait so long for Monday(

During initialization, everything seems to work

2021.06.19 21:05:13.544 SymbolOfChart GBPUSD,M15: 4 GBPUSD 0
2021.06.19 21:05:13.544 SymbolOfChart GBPUSD,M15: 3 GBPJPY 154.124
2021.06.19 21:05:13.544 SymbolOfChart GBPUSD,M15: 2 USDCHF 0.92040
2021.06.19 21:05:13.544 SymbolOfChart GBPUSD,M15: 1 EURUSD 1.18887
2021.06.19 21:05:13.544 SymbolOfChart GBPUSD,M15: 0 GBPUSD 1.38646
2021.06.19 21:05:13.543 SymbolOfChart GBPUSD,M15: initialized

But how will it work in real life?

 
MakarFX:

Here's my problem with Chart_ID()

Did it like this

But you can't check it in the tester(.

...I have to wait so long for Monday(

During initialization, everything seems to work

But how will it work in real life?

Limit should be set to 100.

There may be 2 charts and there may be 100, so it may not reach the next one.

You have to do an overshoot on all the open ones

 
Vitaly Muzichenko:

The limit needs to be removed.

There may be 2 charts and there may be 100, so it may not reach the next one.

You need to go through all the open charts.

Is there any way to determine the number of open charts?

Reason: