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

 
pu6ka:

iBarShift should help

I've struggled all day and still haven't succeeded. Wrong experience for me and more. :)

Can anyone write this function?

 
abeiks:

I've struggled all day and still haven't succeeded. Wrong experience for me and more. :)

Can anyone write this function?

     int n = 0;                                           // индекс дня, в данном случае 0 - текущий день
datetime DayTime = iTime(NULL, PERIOD_D1, n);             // Начало дня "n" в секундах
     int cb = iBarShift(NULL,0,DayTime);                  // Получим на текущем ТФ индекс бара
 
Stells:

Good afternoon.

I don't understand how this works

03:00:24 '9473965': order sell 0.01 GBPUSD opening at 0.00000 sl: 1.65314 tp: 0.00000 failed [Invalid S/L or T/P]

with this code

why the opening price is zero


Was it tonight? Then most likely your stoploss was below the opening price and for a Sell order the stoploss price should be higher.
 
pu6ka:


It's a little bit wrong. I need to get the start of the day "n" in seconds specifically from this TimeDay(Time[80]) function, but it doesn't work for me.

 

I wanted to evaluate the history for holes.
Did this:

int start() 
{
  if(Time[0] > prev_time ) 
  {
    if( iTime(NULL, PERIOD_M1,0)-iTime(NULL, PERIOD_M1,1) > 200000)
    {
      n=n+1;
      Print("n =",n ,"");
    }
    prev_time = Time[0];
  } 
  
  return (0);
}

I understand correctly that iTime counts in seconds and 200,000 = 2.31 days ?

Is it possible to do this? (Seems to be working, only 6 pieces detected)

 
abeiks:

It's a little bit wrong. I need to get the start of the day "n" in seconds specifically from this TimeDay(Time[80]) function, but it doesn't work for me.


Specifically from this function TimeDay(Time[80]), I have to do some more intermediate calculations. You still have the Time[80] bar time. The simpler way would be this:

     int n = iBarShift(NULL,PERIOD_D1,Time[80]);          // индекс дня, которому принадлежит время бара - Time[80]
datetime DayTime = iTime(NULL, PERIOD_D1, n);             // Начало дня "n" в секундах
     int cb = iBarShift(NULL,0,DayTime);                  // Получим на текущем ТФ индекс первого бара дня "n"
 
sv.:

I've been thinking about assessing the history for holes.

Here's a very useful script, I've been using it for years. If the quote archive is uploaded, you need to change two parameters to avoid poking around in the settings. They are highlighted in the screenshot with red frame.

To throw it on any chart and wait a couple of seconds, until the message where the file with the report is.

 
addict:

the buy order is opened once, but the number of sell orders is infinite again


Write a function like this

int start()

if( OrdersTotal()==0 && CountTrades()==0)

{

OrderSend ("EURUSD",OP_BUYLIMIT,l,1.36000,5,0,1.36000+tp*Point,"my order",1);

OrderSend ("EURUSD",OP_BUYSTOP,l,1.36000,5,0,1.36000+tp*Point,"my order",1);

else

{
OrderSend ("EURUSD",OP_SELLLIMIT,l,1.36000,5,0,1.36000-tp*Point,"my order",2);
OrderSend ("EURUSD",OP_SELLSTOP,l,1.36000,5,0,1.36000-tp*Point,"my order",2);
}

}

return(0);

}

//+------------------------------------------------------------------+

int CountTrades()

{

int count = 0;

for(int trade = OrdersTotal()-1; trade >=0; trade--)

{

OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)

count++;

}

}

return(count);

 
pu6ka:


Specifically from this TimeDay(Time[80]) function, you have to do some more intermediate calculations. You still have the time of barTime[80]. It would be easier to do it this way:


Thank you! :)

 
I'm looking for a script that closes all orders by lot size, all means all (and not with the right to choose a wizard. lowes and so on) to close all orders at all pairs and only the lot size can filter them .
Reason: