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

 
Vinin:
Better time to check
In some cases - Yes, better. But if you have to slow down for half a second... ...that's not going to work. I didn't say it was a universal variant. It's just an imitation of Sleep().
 
for Sleep in the tester (I think it will also work for the indicator) loop in while inside i++ and find the size of the maximum iteration which will (approximately) correspond to the desired delay time
 
Money_Maker:
For Sleep in the tester (I think the same for the indicator) do the while loop inside i++ and find the size of the maximum iteration which will (approximately) correspond to the desired delay time

In this case the terminal will freeze completely, which is not good either.

The first indicator is the delta from the delta cluster. Which is updated in about 20 seconds. Therefore we need to delay the reading of the indicator for 20 seconds. Can you tell me how to know the number of seconds since the opening of the candle?

 
nikelodeon:

In this case the terminal will freeze completely, which is not good either.

The first indicator is the delta from the delta cluster. Which is updated in about 20 seconds. That's why we need to delay the reading of the indicator for 20 seconds. Please advise how to know the number of seconds since the opening of the candle?

Include GetTickCount() and count 20 seconds from it.
 
Simply, work on every tick. As soon as a signal comes in, do something :)
 

Can you tell me how to calculate the leverage for a particular instrument?

There is a line:

double minlotmoney= Bid*lotsize*minlot/leverage;       //Стоимость минимального лота  в $

But it is not suitable for some instruments for which the Broker's leverage is different (written in AccountLeverage() )

 

Guys, how do you calculate the correlation for the last 100 bars?

Couldn't find a sane formula anywhere, got to this point and stopped

 int TF = Period();
 int ADR = 100;
 double p1=0;
 double p2=0;
 string Pair1 = "GBPUSD";
 string Pair2 = "EURUSD";
  for (int f = 1; f <= ADR; f++)
   {
     p1 += (iHigh(Pair1, TF, f) - iLow(Pair1, TF, f)) / MarketInfo(Pair1, MODE_POINT); //sum pair1 range (i) 
     p2 += (iHigh(Pair2, TF, f) - iLow(Pair2, TF, f)) / MarketInfo(Pair2, MODE_POINT); //sum pair2 range (i)
   }
 /* Тут неправильно
  double c1 = p1 / ADR;
  double c2 = p2 / ADR;
  double rs = c2 / c1;

  Comment( DoubleToStr(rs, 2) );
 */

Thanks in advance if anyone can help!

 

Hello, here's a question:

When you run a programmatic search of charts, their subwindows, indicators in subwindows, you can find out the total number of indicators and then their names, parameters, etc.

Using ChartIndicatorsTotal, ChartIndicatorName etc.

How can I find out the name of Expert Advisor running in this window by ChartID?

 
I think experts will now swell from such problems, and here I am with mine :-) How to make at closing of the deal icons were put on the chart as in the tester????? Maybe there are some ready-to-use functions????
 
nikelodeon:
I think experts will get swollen with such problems, and I have to solve them myself :-) How to make icons on the chart at deal closing, like in the tester????? Maybe there are some ready-to-use functions????

if closing by advisor/script, then

bool  OrderClose( 
   int        ticket,      // номер ордера 
   double     lots,        // количество лотов 
   double     price,       // цена закрытия 
   int        slippage,    // максимальное проскальзывание 
   color      arrow_color  // цвет 
   );
 


arrow_color

[in] The colour of the closing arrow on the chart. If the parameter is missing or its value isCLR_NONE, no arrow is shown on the chart.

---

if manual - only write/borrow a ready script/indicator that will catch this deal on history and show it with an icon