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

 
Vitaly Muzichenko:

I asked you a question, rewrote the indicator, added alerts to the task, but there was no response from you and I did not post the file. If I asked you a question, it means that it is important for me to know the answer.

I deeply apologize if I was offended, I feel a little embarrassed. I really didn't understand the question and you didn't make it clear, it seemed to be a bit funny, don't take it personally. The indicator itself displayed and worked fine, I just wanted to have a difference in sounds, for each parameter a different signal for better understanding. Otherwise, the indicator worked fine.

 

Hi all. We need to limit the number of open buy and sell orders during the day. Maximum 3 buys and 3 sells. The given piece of code limits the number of orders (no more than 3 are opened), but it comes out without dividing into buy and sell. How do I enter this split?

double LongTrades, ShortTrades;
int trades_total=OrdersHistoryTotal();
int type=OrderType();
for(int T=0; T<trades_total; T++)
{
if(OrderSelect(T,SELECT_BY_POS,MODE_HISTORY))
{
if (OrderMagicNumber()==Number)
{
if(type==OP_BUY)
{
if((TimeDayOfYear(OrderOpenTime())==TimeDayOfYear(TimeCurrent())) &&(TimeYear(OrderOpenTime())==TimeYear(TimeCurrent()))) LongTrades++;
}
if(type==OP_SELL)
{
if((TimeDayOfYear(OrderOpenTime())==TimeDayOfYear(TimeCurrent())) &&(TimeYear(OrderOpenTime())==TimeYear(TimeCurrent()))) ShortTrades++;
}
}
}
}
if (LongTrades<3)
if (ShortTrades<3)
 
Torden:

Hi all. We need to limit the number of open buy and sell orders during the day. Maximum 3 buys and 3 sells. The given piece of code limits the number of orders (no more than 3 are opened), but it comes out without dividing into buy and sell. How should we implement this division?

Put the type inside the select

double LongTrades, ShortTrades;
int trades_total=OrdersHistoryTotal();
for(int T=0; T<trades_total; T++)
{
if(OrderSelect(T,SELECT_BY_POS,MODE_HISTORY))
{
int type=OrderType();
if (OrderMagicNumber()==Number)
{
if(type==OP_BUY)
{
if((TimeDayOfYear(OrderOpenTime())==TimeDayOfYear(TimeCurrent())) &&(TimeYear(OrderOpenTime())==TimeYear(TimeCurrent()))) LongTrades++;
}
if(type==OP_SELL)
{
if((TimeDayOfYear(OrderOpenTime())==TimeDayOfYear(TimeCurrent())) &&(TimeYear(OrderOpenTime())==TimeYear(TimeCurrent()))) ShortTrades++;
}
}
}
}
if (LongTrades<3)
if (ShortTrades<3)
 

has anyone done a recognition implementation of this?

https://www.mql5.com/ru/charts/8333244/audcad-h4-ifcmarkets-corp

 
Mickey Moose:

has anyone done an implementation of this recognition thing?

https://www.mql5.com/ru/charts/8333244/audcad-h4-ifcmarkets-corp

Have you seen where your link goes?

It's got "Put a screenshot in your pocket". You click and then paste it into your post from your pocket - there's a little green pocket in the post editor menu.

 

in mt4 the ticket asks to convert to INT, it cannot be more than 2,147,483,647 ?

int -  Целый тип int имеет размер 4 байта (32 бита). Минимальное значение -2 147 483 648, максимальное значение 2 147 483 647

bool  OrderSelect( 
   int     index,            // индекс или тикет ордера 
   int     select,           // флаг способа выбора 
   int     pool=MODE_TRADES  // источник данных для выбора 
   );
 
Artyom Trishkin:

Have you seen where your link goes?

There's "Put a screenshot in your pocket". You click and then paste it into your post from your pocket - there's a little green pocket in the post editor menu.

What's wrong with this link?

 
Mickey Moose:

what's wrong with this link?

Should I record a video? Or will you try to follow it yourself?

 
Artyom Trishkin:

Should I record a video? Or will you try to go through it yourself?

Yeah, record it, because I can't figure out what they want me to do here.

 
and I don't know what you're talking about
Reason: