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

 
ev85:

Hi all.

Can you guys help me make a condition when opening an order, so it will open only if the current time (accurate to one minute) is not equal to the closing time of the previous order.


Of course, it doesn't work because TimeCurrent() returns time accurate to one second, and I need up to one minute. Since I trade on minute indicators and at sharp market fluctuations, even in one minute the price may go hundreds of points and it may not always go in my direction. That is why I need only one order to open in one minute.

TimeHour(),TimeMinute().
 
ev85:

Hi all.

Can you guys help me to make a condition when opening an order, so it will open only if the current time (accurate to the minute) is not equal to the closing time of the last order.

Here is the construction:

int accTotal=OrdersHistoryTotal();

if(OrderSelect(accTotal-1,SELECT_BY_POS,MODE_HISTORY)==true) {

datetime ctm=OrderCloseTime();

}

...

and then condition to open an order

if(.....&&(TimeCurrent()!=ctm)){

ticket=OrderSend(.....);

}

But of course, it doesn't work because TimeCurrent() returns time accurate to one second, and I need up to one minute because I trade on minute bars and at sharp market fluctuations even during one minute the price may go hundreds of points and this is often not in my direction. That is why I need only one order to open in one minute.

   datetime t=0;
   int  ticket;

   for(int i=0; i<OrdersHistoryTotal(); i++) 
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) 
        {
         if(OrderSymbol()==Symbol()) 
           {
            if(OrderType()==OP_BUY || OrderType()==OP_SELL) 
              {
               if(t<OrderCloseTime()) t=OrderCloseTime();
              }
           }
        }
     }
   if(TimeCurrent()-t>60)   //Ecли после закрытия последней поз > 60 секунд, то открываемся
       ticket=OrderSend(.....);
Something like this
 
How to determine the trend in MQL4 intelligently?
 
Cei How to determine the trend in MQL4?

There are many ways - look up trend indicators in CodeBase. Differentiate a moving average, take a linear regression coefficient, ... but for my taste it's better to catch the reversals

I clicked at the top of this page Code Base. I entered a trend indicator into search box. As Mayakovskiy said, all these indicators are good, but there is no difference. Here is a link to one of them. I did some more research and read: A good Expert Advisor ... should give one recommendation - "Do not enter the market".

 
Cei:
How to determine the trend in MQL4?

Wait for a reversal, declare - there was a trend there ))))

There is no other way. The trend is defined in the past, like waves, like fractals, like zigzags.

 

Friends, is there any function to prohibit trading?

I need it for a small cycle:

for (provided; no trade; until all current orders are closed)

 
ev85:

Friends, is there any function to prohibit trading?

I need it for a small cycle:

for (provided; no trade; until all current orders are closed)

OrdersTotal()
 
The task is as follows.

I need to run the indicator on all 9 timeframes for 100 symbols from Market Watch and output the result as a table.
Do I need to keep 900 charts open or not, so that the history is pumped up and up to date?
 
RickD:
The task is as follows.

I need to run the indicator on all 9 timeframes for 100 symbols from Market Watch and output the result as a table.
For the history to be bumped and relevant, should I keep 900 charts open or not?

No, 100 charts is enough, but, you have to write the indicator correctly.

 
paukas:
OrdersTotal()

Maybe I don't understand, but I just thought that OrdersTotal()==0 is the opposite of the end goal of my loop.

What I want can also be imagined like this:

Condition;

while(OrdersTotal()==0)

{

Trade prohibited;

}

Reason: