Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 166

 
Hello, I am writing an EA using arrow indicator (attached), I can't figure out how to get signals from it, in short, it draws arrows on 0 bar, can re-draw, uses global variables, but does not rewrite them. Thanks in advance.
Files:
arrow.mq4  6 kb
 
zfs:
Is it possible to determine the triggering time of a pending order without crossing the order price?
The triggering time == position opening time, i.e: OrderOpenTime(); In this case, the pending from which the position appeared in MODE_HISTORY will not be
 
alexey1979621:

Dear forum members, I cannot figure out the Ishimoku indicator. I made a small Expert Advisor based on it but it only opens buy position, but does not open sell position. I think this is most probably due to the fact that the cloud is reversing, besides I have defined incorrectly the conditions for entering the trade.

The figure shows a red down arrow where a sell trade should open and a red up arrow where a buy trade should open. A buy trade was opened with a wrong entry (in theory it should not be there)


Upper bound of the cloud = MathMax(UpO, DownO);

Lower limit of the cloud = MathMin(UpO, DownO);

 
zfs:

Does the history record the triggered order?

No, only the deleted one
 

If there are several libraries, each library uses many of the same variables... All of these libraries need to be compiled separately, optionally. Should the same variables be added to each library as an inline (header file) ?

I want to make libraries exactly separate, my head is cracking. Not everything works out the way it should...

Each library must have its own header file in fact? And these header files, in turn, can be placed in the Expert Advisor itself, or in a basic, main header file, which will unite all of them. Do I understand correctly?

 
hoz:

If there are several libraries, each library uses many of the same variables... All of these libraries need to be compiled separately, optionally. Should the same variables be added to each library as an inline (header file) ?

I want to make libraries exactly separate, my head is cracking. Not everything works out the way it should...

Each library must have its own header file in fact? And these header files, in turn, can be placed in the Expert Advisor itself, or in a basic, main header file, which will unite all of them. Do I understand it correctly?

The library header file is a separate topic. This is how it should be done.

You can put the same variables in a separate file and plug it into every library that declares variables.

Victor, I already answered this same question of yours above. Don't you read the answers? :-)

 

Good people! There is a Breakeven function. It works fine. It closes the deal at 0. How to make a deal close not at 0, but +2 pips. I would be very grateful for the help.

void BU()
{
   for(int a=0; a<OrdersTotal(); a++) 
      {
       if(OrderSelect(a, SELECT_BY_POS))
        {      
         if(OrderType()==OP_BUY) 
          {
           if(OrderOpenPrice()<=(Bid-BULevel*Point)&&OrderOpenPrice()>OrderStopLoss())
            {      
             OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Green);
            }
           }       
 
         if(OrderType() == OP_SELL) 
           {
            if(OrderOpenPrice()>=(Ask+BULevel*Point)&&OrderOpenPrice()<OrderStopLoss())
             {
              OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Red);
             }
           } 
         }
       }
}
  return(0);
 
Zhunko:

The library header file is a separate topic. This is the way it should be done.

You can put the same variables in a separate file and plug it into every library that declares variables.

Victor, I already answered this same question of yours above. Don't you read the answers? :-)


Vadim, the last time I asked, I had a vague idea about it, and that's why I probably misunderstood. Now I have come across it directly and I see that I have finally figured out what it is all about.
 
alexey1979621:

Good people! There is a Breakeven function. It works fine. It closes the deal at 0. How to make a deal close not at 0, but +2 pips. I would be very grateful for the help.


void BU()
{
   for(int a=0; a<OrdersTotal(); a++) 
      {
       if(OrderSelect(a, SELECT_BY_POS))
        {      
         if(OrderType()==OP_BUY) 
          {
           if(OrderOpenPrice()<=(Bid-BULevel*Point)&&OrderOpenPrice()>OrderStopLoss())
            {      
             OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+2*Point,OrderTakeProfit(),0,Green);
            }
           }       
 
         if(OrderType() == OP_SELL) 
           {
            if(OrderOpenPrice()>=(Ask+BULevel*Point)&&OrderOpenPrice()<OrderStopLoss())
             {
              OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-2*Point,OrderTakeProfit(),0,Red);
             }
           } 
         }
       }
}
  return(0);
 
How to get Open[] of the current chart but not of the current timeframe?
Reason: