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

 
Got it all figured out)))
 

Please advise why this is happening.

Tester.TF 5min All ticks.


int start()  
 {
int pY =  Bars;
int pY1 = Bars+239;
       
Print( "Н Н Н  =  ", pY);   
Print( "НH HН НH  =  ", pY1); 

}

In variables pY and pY1 the program should write the number of bars on EVERY tick.

That is, Print in the journal should print the sequence number of EVERY tick.

In fact, judging by the Print function in the journal, the interval between successive five-minute ticks is about one month.

2014.01.19 13:28:08     2000.03.17 12:56  БАЗА 30-150 EURUSD,M5: НH HН НH  =  15738
2014.01.19 13:28:08     2000.03.17 12:56  БАЗА 30-150 EURUSD,M5: Н Н Н  =  15499
2014.01.19 13:28:08     2000.03.17 12:56  БАЗА 30-150 EURUSD,M5: НH HН НH  =  15738
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: Н Н Н  =  11856
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: НH HН НH  =  12095
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: Н Н Н  =  11856
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: НH HН НH  =  12095
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: Н Н Н  =  11856
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: НH HН НH  =  12095
2014.01.19 13:28:07     2000.02.29 18:38  БАЗА 30-150 EURUSD,M5: Н Н Н  =  11856
2014.01.19 13:28:07     2000.02.29 18:37  БАЗА 30-150 EURUSD,M5: НH HН НH  =  12095
2014.01.19 13:28:06     2000.02.10 22:20  БАЗА 30-150 EURUSD,M5: Н Н Н  =  8258
2014.01.19 13:28:06     2000.02.10 22:20  БАЗА 30-150 EURUSD,M5: НH HН НH  =  8497
2014.01.19 13:28:06     2000.02.10 22:20  БАЗА 30-150 EURUSD,M5: Н Н Н  =  8258
2014.01.19 13:28:06     2000.02.10 22:20  БАЗА 30-150 EURUSD,M5: НH HН НH  =  8497
2014.01.19 13:28:06     2000.02.10 22:20  БАЗА 30-150 EURUSD,M5: Н Н Н  =  8258
2014.01.19 13:28:06     2000.02.10 22:19  БАЗА 30-150 EURUSD,M5: НH HН НH  =  8496
2014.01.19 13:28:06     2000.02.10 22:19  БАЗА 30-150 EURUSD,M5: Н Н Н  =  8257
2014.01.19 13:28:06     2000.02.10 22:18  БАЗА 30-150 EURUSD,M5: НH HН НH  =  8496
2014.01.19 13:28:05     2000.01.10 15:42  БАЗА 30-150 EURUSD,M5: Н Н Н  =  1600
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: НH HН НH  =  1839
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: Н Н Н  =  1600
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: НH HН НH  =  1839
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: Н Н Н  =  1600
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: НH HН НH  =  1839
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: Н Н Н  =  1600
2014.01.19 13:28:05     2000.01.10 15:41  БАЗА 30-150 EURUSD,M5: НH HН НH  =  1839

QUESTION: Why don't the pY and pY1 variables get the value of EACH five-minute interval?

Thank you.


 

I've been trying for three or four days now.

The goal is to open a trade when the opening price of the current bar is for example above the price set ... we take it as a condition for entering...... and it will not reopen until a similar condition is formed for entering....

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)==false)..если колво сделок открытых равно нулю входить можна
 {

 active=true;
 }
 //открывать сделку или не открывать сделку
 
 if(active==true)...если входить можна проверяем условие для покупки
 {
 if((high3>high2)&&(close2<close1)&&(low2<low3)&&(open1<close2)&&(close1>close2)&&(low1<low2))
{
b=high2;
}
if(iOpen(NULL,0,0)>b)....если текущая цена выше то покупаем
{
 OrderSend(Symbol(),OP_BUY,0.1,Ask,7,Ask-30*Point,Ask+90*Point,0,0,0,Green);
 active=false;
}
и так проблема вся в том что у нас текущей ордер может закрыться уже когда сформируется заново условия и перезапишется цена тоесть он откроется фиг знает где и сразу по закрытию текуще позиции....как сделать так чтобы если ордер закрылся выше перезаписаной цены то мы ждали дальше пока не выполнится заново условие
 
solnce600:

Please advise why this is happening.

Tester.TF 5min All ticks.

In variables pY and pY1 the program should write the number of bars on EVERY tick.

That is, Print in the journal should print the sequence number of EVERY tick.

In fact, judging by the Print function in the journal, the interval between successive five-minute ticks is about one month.

QUESTION why variables pY and pY1 don't get the value of the sequence number of EVERY five-minute tick?

Thank you.


Bars+239, why do you need a bar number that isn't even in the history?

And in general "number of bars on each tick" What is this??????

Try explaining the problem in more detail, it's just laughter alone.....

There is no such term as "pentameter number" .......

 
Maybe the number of ticks on each bar? Agree, these are different things....
 

Can I have a line of code, please, on how to put the order tickets into an array?

Here's a start on the typing, right?

void xxx(int otype)
{
  int Mas []; int ticket = 0; 
  for (int i = OrdersTotal()-1; i>=0; i--)
  { 
    if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES))
    {
      if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType() == otype)
        ticket = OrderTicket();
        Mas[] = {ticket};
 
Trader7777:

Can I have a line of code, please, on how to put the order tickets into an array?

Here's a start on the typing, right?


ticket = OrderTicket();
Mas[i] = OrderTicket();
But a two-dimensional array is better, where other order parameters can also be entered. You can read about it here.
 
Sepulca:

Right away, Bars+239, why do you need a bar number that isn't even in the history?

And in general "number of bars on each tick" What is this??????

Try to explain the problem in more detail, it's just laughter alone.....

There is no such term as "ordinal number of five ticks".......

And I don't need a bar numberthat isn't in the history.

I need the serial number of the last current bar, for example 100, the program would add 239 and the number 339 would be written

into the pY1 variable and the number 100 into the pY variable.

And the program really does it.

BUT FOR SOME REASON IT DOESN'T DO IT ON EVERY CANDLESTICK

What I need is for pY and pY1 to update once every 5 minutes and for EVERY five minutes candlestick.

I understand that every five-minute candlestick has several ticks and on every tick of the same candlestick the

pY and pY1 will be the same.

But I don't understand why the values of pY and pY1 are not updated at EVERY candle.

They are updated by n - the number of candles.

Why not for EVERY candle?

Maybe I've used a wrong term.

But doesn't the Bars variable predefined at the moment of a new five-minute bar occurrence take

the value of the sequence number of this new five-minute bar?



 
solnce600:

I don't need a bar numberthat isn't in the history.

I need to add 239 to the number of the last current bar, for example 100, and the number 339 will be written

into the pY1 variable and the number 100 into the pY variable.

And the program really does it.

BUT FOR SOME REASON IT DOESN'T DO IT ON EVERY CANDLESTICK

What I need is for pY and pY1 to update once every 5 minutes and for EVERY five minutes candlestick.

I understand that every five-minute candlestick has several ticks and on every tick of the same candlestick the

pY and pY1 will be the same.

But I don't understand why the values of pY and pY1 are not updated at EVERY candle.

They are updated by n - the number of candles.

Why not for EVERY candle?

Maybe I've used a wrong term.

But doesn't the Bars variable predefined at the moment of a new five-minute bar appearing?

the value of the sequence number of this new five-minute bar?





You are completely confused... The current bar always has number 0. And if the time has come, in your case five more minutes, the bar you examined a few seconds ago will already be number 1, and a new bar newly formed will get number 0.

But according to your code, with each new bar should be shifted by one......??

So maybe it's not about the reel? How do you look at the log? In Metatrader? Try <Journal><Open> and then use standard Notepad to open the last file. I have faced with this sometimes, if there are a lot of messages in the log, MetaTrader does not show everything... Try

 
how to russify the directory in the meta-editor?