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

 
Igor Makanu:

Expert Advisors do not have indicator buffers and do not draw in the terminal

Read in the help what is the difference between Expert Advisors and scripts and indicators

Thank you for your reply.

Can you tell me how to implement this functionality ?

 

Hello! Help pass an array into a function

have a structure

struct pattern
  {
   double            x;
   datetime          y;
 };  

I declare a couple of static arrays like this structure

pattern last_pattern_up[NUMBER_OF_SYMBOLS][NUMBER_OF_PERIODS], last_pattern_dn[NUMBER_OF_SYMBOLS][NUMBER_OF_PERIODS];

Now, I want to pass a static array into a function, but it gives me an error - '[' - array required

void MyFunction(pattern &array)
{
   Print(array[1][1].x," ",array[1][1].y);
   }

How do I correctly pass an array into a function?

 
Tango_X:

Hello! Help pass an array into a function

have a structure

I declare a couple of static arrays like this structure

Now, I want to pass a static array into a function, but it gives me an error - '[' - array required

How do I correctly pass an array into a function?

void MyFunction(pattern &array[][NUMBER_OF_PERIODS])
 
Artyom Trishkin:

Thank you! super!

 
Alexander Layzerevich:

Thank you for your reply.

Can you tell me how to implement this functionality ?

only separately an Expert Advisor that calls an indicator via iCustom() and separately an indicator for a chart

at that the Expert Advisor, when calling the indicator, will use a new copy of the indicator, i.e. if you run the Expert Advisor on a chart and change its settings (the ones you pass to iCustom() ), the indicator will not react on the chart

the indicator, that was called by the Expert Advisor, will be displayed in the Strategy Tester at the end of testing. During testing in visual mode, you can throw the indicator onto the Strategy Tester chart....

If you want to use indicator in a different way, it is possible to do it in a different way ... maybe someone has done it

 
Alexander Layzerevich:

Thank you for your reply.

Can you tell me how to implement this functionality ?

Draw lines(OBJ_TREND)

 
Alexander Layzerevich:

Thank you for your reply.

Can you tell me how to implement this functionality ?

If you draw lines of the indicator without using the indicator at all, but only with calculations transferred from the indicator to the Expert Advisor, then only with graphical objects - trend lines. It is expensive, though. But we can limit the visibility area of bars on the chart.

 

Thanks for the tips.

In fact, the Indicator does the same thing.

i.e. I have calculated values, I need to connect them with lines.(OBJ_TREND)

 
Igor Makanu:

at least one parameter needs to be changed when modifying an order, error #1 - if nothing needs to be changed after sending a request to the server

unprint what you have sent to the server, you will see it right away.

The error remains, even though I have added an additional condition to check if there is a stop or profit

if(OrderMagicNumber() == id_number && (OrderStopLoss() == 0 || OrderTakeProfit() == 0))


Also for trailing

if(OrderMagicNumber() == id_number && OrderStopLoss() != 0)
           {
            if(OrderType() == OP_BUY)
              {
               if(OrderComment() == "1" && Bid - OrderOpenPrice() >= a1 && OrderStopLoss() != OrderOpenPrice() + l1) {bol = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+l1,OrderTakeProfit(),0,clrNONE);};
               if(OrderComment() == "2" && Bid - OrderOpenPrice() >= a2 && OrderStopLoss() != OrderOpenPrice() + l2) {bol = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+l2,OrderTakeProfit(),0,clrNONE);};
              }
            else
              {
               if(OrderComment() == "1" && OrderOpenPrice() - Ask >= a1 && OrderStopLoss() != OrderOpenPrice() - l1) {bol = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-l1,OrderTakeProfit(),0,clrNONE);};
               if(OrderComment() == "2" && OrderOpenPrice() - Ask >= a2 && OrderStopLoss() != OrderOpenPrice() - l2) {bol = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-l2,OrderTakeProfit(),0,clrNONE);};
              };
           };
 
Alexandr Sokolov:

The error remains, although I have added an additional condition to check the presence of stop or profit

Also for trailing

OrderStopLoss() != NormalizeDouble(OrderOpenPrice() - l1,_Digits)