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

 
People. Please help. My question is this. I am making an EA based on MACD indicator. There are actually two conditions for opening and two conditions for closing. The first condition to close Buy: Signal is more than 0, MACD is more than 0, first bar is less than the second one and the second one is more than the third one. The second condition: Signal is less than 0, MACD is less than 0, first bar is less than the second and the second is less than the first. But there is one but.... These conditions completely copy the conditions of the deal to close the sale. How to separate them? Please advise. I have one idea that the peak is repeated on the histogram, but then how do I describe that the peak has already been there? How to create such a memory in the EA?
 

Hi all, I am writing an EA. The essence is this - opens two differently directed stop orders when one of them triggers the second is deleted, but in the tester is deleted only buy order when trying to delete sellstop comes out 4108 error incorrect ticket. Please help me to understand this. Inserted a function that deletes the order.

Thanks in advance!!!

void DellSell()
  {
   int dell;
   for(int i=OrdersTotal() -1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_SELLSTOP && CountBuyDell()>0)
               dell=OrderDelete(OrderTicket());
            if(!dell)
              {
               Print("Ордер SellStop не удален");
              }
           }
        }
     }
   return;
  }
 

Greetings. Please advise how to take data from the indicator.

Need data from the red and blue icons. There are some astronomical values in the respective buffers when there is no drawing. I have limited them to a number of 10000. Seems to work, but there are skipping signals. How to fix it? Here is how I messed up:

PriceHigh1=iCustom(NULL, 0, "TMAlCG_mladen", TimeFrame, HalfLength, Price, BandsDeviations, Interpolate, alertsOn, alertsOnCurrent, alertsOnHighLow, alertsMessage, alertsSound, alertsEmail, 4, 0);
PriceLow1=iCustom(NULL, 0, "TMAlCG_mladen", TimeFrame, HalfLength, Price, BandsDeviations, Interpolate, alertsOn, alertsOnCurrent, alertsOnHighLow, alertsMessage, alertsSound, alertsEmail, 3, 0);
if (PriceHigh1<10000) PriceHigh=PriceHigh1; else PriceHigh=0;
if (PriceLow1<10000) PriceLow=PriceLow1; else PriceLow=0;
Files:
 
Andrey Sokolov:

Greetings. Can you tell me how to get the correct data from the indicator.

I need data from the red and blue icons. There are some astronomical values in the respective buffers when there is no drawing. I have limited them to a number of 10000. It seems to work, but there are skipping signals. How to fix it? Here is how I messed up:

PriceHigh1=iCustom(NULL, 0, "TMAlCG_mladen", TimeFrame, HalfLength, Price, BandsDeviations, Interpolate, alertsOn, alertsOnCurrent, alertsOnHighLow, alertsMessage, alertsSound, alertsEmail, 4, 0);
PriceLow1=iCustom(NULL, 0, "TMAlCG_mladen", TimeFrame, HalfLength, Price, BandsDeviations, Interpolate, alertsOn, alertsOnCurrent, alertsOnHighLow, alertsMessage, alertsSound, alertsEmail, 3, 0);
if (PriceHigh1<10000) PriceHigh=PriceHigh1; else PriceHigh=0;
if (PriceLow1<10000) PriceLow=PriceLow1; else PriceLow=0;

I haven't looked into the code, but I can assume this will help. I may be wrong:

if (PriceHigh1!=INT_MAX) PriceHigh=PriceHigh1;  else PriceHigh=0;
if (PriceLow1!=INT_MAX) PriceLow=PriceLow1;  else PriceLow=0;
 
Vitaly Muzichenko:

Didn't look into the code, but I can assume it will help. I could be wrong:

if (PriceHigh1!=INT_MAX) PriceHigh=PriceHigh1;  else PriceHigh=0;
if (PriceLow1!=INT_MAX) PriceLow=PriceLow1;  else PriceLow=0;
Thank you for not going through, but it didn't help.
 
Andrey Sokolov:
Thank you for not going through, but it didn't help.
Try also comparing with EMPTY_VALUE, since there are "astronomical" values.
 
ArraySearchDouble() and EquationDirect()in old version of mql 4. Does the new version have any analogues.
 
27311065:
ArraySearchDouble() and EquationDirect()in old version of mql 4. And the new version has any analogues.
Where have you seen them in the old version? These are self-written functions. No?
 
thanks for the tip
 

Please advise how best to work with data - given a number series, which will be divided into subgroups depending on the results of the calculation, these groups should be stored in an array, in addition, each group will have two or more indicators per group (a group of numbers separately will belong to the calculated figure). The data shall look as follows

1/1,2,3,4/23/33

2/1,4,5/26/11

3/3,4,5,33,56,38/21/44

and so on

Reason: