[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 160

 
anton777:
extern double Lot = 0.01;

extern double LotFactor = 0.01;

SendOrder(0,Lot,Ask,1,stop.loss,take.profit.0);

Lot=NormalizeDouble(buy.last.lot+LotFactor,DG);
SendOrder(0,Lot,buy.last-step[buy]*Pp,1,stop.loss,0);

I wrote it wrong, corrected it
 
Roman.:

Can you use functions?

I think I know a little bit about custom functions.

 
anton777:
I wrote it a little wrong, I've fixed it.

Is that a script or something?
 
bikrus13:

is this a script or what?
This is a piece of code from my EA, which increases order lots as they are placed.
 
anton777:
This is a piece of code from my EA which increases order lots as they are placed.

Send the EA itself to me on my mailbox if you can. I'll take a look at it.
 
bikrus13:

Send the EA yourself if you can. I'll take a look at it.


You've got an advisor on a pause.

 

Can you tell me why iBarShift in the indicator keeps returning 0?

It all started when the indicator would periodically stop drawing. Decided to find out the reason why this happens and came across that iBarShift always returns 0.

A piece of code:

   int shift = getShift(PERIOD_D1, 1); 
   datetime dt = iTime( Symbol(), PERIOD_D1, shift); //----- время всегда возвращает правильно
   int a = iBarShift( Symbol(), PERIOD_H1, dt, false); //----- а тут всегда 0

//--------
int getShift(int timeframe, int shift)
{
  return(iBarShift(NULL, timeframe, Time[shift]));
} 
 
alsu:
I think so, check...
Just now saw your suggestion, but by now I've thought of it myself ))) Thanks
 
hello. do you know if there is a built-in function that allows you to determine the candle number of the candle to which the time belongs?
 
nadya:
Hello. Do you know if there is a built-in function that allows you to determine the candlestick number from the time?

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
Search for bar by time. The function returns the offset of the bar to which the specified time belongs. If there is no bar for the specified time (a "gap" in the history), the function, depending on the exact parameter, returns -1 or the shift of the nearest bar.
Reason: