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

 
Print with the DoubleToString function and you will get the 5 characters you want. If you want, you can also get 8 characters.
 
AlexeyVik:
Print using the DoubleToString function and you will get the 5 digits you want. If you want, you can also get 8.
In other words, the indicator calculations in the Expert Advisor are carried out on 5 digits, and Print cuts off the 4th digit when it is displayed in the Journal?
 
Craft:
In other words, indicator calculations in the Expert Advisor are performed to 5 decimal places and Print will cut the result to 4 decimal places when it is displayed in the Journal?

The calculation result can be up to 16 decimal places if it is not normalised:

Данные типа double выводятся с точностью до 16 десятичных цифр после точки, при этом данные могут выводиться либо в традиционном либо в научном формате – в зависимости от того, как запись будет наиболее компактна.
Данные типа float выводятся с 5 десятичными цифрами после точки. Для вывода вещественных чисел с другой точностью либо в явно указанном формате необходимо использовать функцию PrintFormat(). 

The output of the calculation directly via Print is not cut. There is something else in the code, normalization, for example.




 

That's the thing, there's nothing else (normalisations, etc.):

double g_macd=iCustom(Symbol(), PERIOD_M1, "g_MACD",12, 26, SignalSMA, 1, 0);

Print ("g_macd=",g_macd);

g_MACD has a value (of the 1st buffer) in the indicator to the 5th decimal place, while Print in the log shows a value to the 4th decimal place, which is not acceptable.

How to solve this problem?

 
Craft:

That's the thing, there's nothing else (normalisations, etc.):

double g_macd=iCustom(Symbol(), PERIOD_M1, "g_MACD",12, 26, SignalSMA, 1, 0);

Print ("g_macd=",g_macd);

g_MACD has a value (of the 1st buffer) in the indicator to the 5th decimal place, while Print in the log shows a value to the 4th decimal place, which is not acceptable.

How to solve this problem?

Look in your code, the problem is somewhere there.

To test it, I ran a simple script with WPR call and printed the result of indicator call:

 double wpr1=iWPR(NULL,0,1440,1);
 Print("WPR=",wpr1);

****2015.03.08 01:12:15	2015.03.06 22:59 **** EURUSD,H1: WPR=-99.1902834008098


The indicator itself, as you know, shows values with 4 decimal places in its window, but for Expert Advisors it shows 13 and even 14.

 
Pokrov:

Hello! Please look at the code below, creation of "Arrow" object on the signal, arrows are not drawn in the tester, although the log passes, and also in the log on startup in the tester writes an error TestGenerator: unmatched data error (volume limit 412 at 2014.10.13 17:10 exceeded),

And during testing it gives out an error "Checking USDJPYm,M5 arrow: Error in object creation: code #4200" - but I guess this is normal, because at first the program finds that the object was created, and after deleting it, creates it again. In general, I would be grateful for your comments to the questions.

Do not judge strictly as written.


Folks, help me out with the arrows, please!!!

//+------------------------------------------------------------------+
//| SignalOpenOrderBuy SendMail                                      |
//+------------------------------------------------------------------+
if (PLO0>S0 && PLO1<=S1 && PLO2<S2 && Time[0] > SignalTime)
{
SignalTime = TimeCurrent();
bool SignalBuy = ObjectCreate(0,"ArrowBay",OBJ_ARROW_BUY,0,0,Bid,SignalTime);
Print("Стрелка Buy установлена");
ObjectSetInteger(0,"ArrowBay",OBJPROP_COLOR,clrGreen);
if(!SignalBuy)
Print("Ошибка создания объекта: code #",GetLastError());
ResetLastError();
ObjectDelete(0,"ArrowBay");
RefreshRates();
SignalBuy = ObjectCreate(0,"ArrowBay",OBJ_ARROW_BUY,0,0,Bid,SignalTime);
ObjectSetInteger(0,"ArrowBay",OBJPROP_COLOR,clrGreen);
if(!SignalBuy)
Print("Ошибка создания объекта: code #",GetLastError());
else
Print("Стрелка Buy установлена");
}
 
Pokrov:

Folks, help me out with the arrows, please!!!

Figure out this line.

bool SignalBuy = ObjectCreate(0,"ArrowBay",OBJ_ARROW_BUY,0,0,Bid,SignalTime);

Look where the arrow is drawn.

 
AlexeyVik:

Figure out this line

Look at where the arrow is drawn.

I have now got the arrows and they are moving from signal to signal according to the points,

I can then analyze the triggering of the signal on the chart?

 
Pokrov:

Thank you, Alexey! It helped, now the arrows appear and move from signal to signal by points, but how should I make the arrows appear and stay in their places on each signal?

I can then analyze the triggering of the signal on the chart?

Stop moving and draw new ones.
 
Pokrov:

Thank you, Alexey! It helped, now the arrows appear and move from signal to signal by points, but how do I make the arrows appear and stay in their places on each signal?

I can then analyze the triggering of the signal on the chart?

Attach the time to the object name. Maybe SignalTime will work.
Reason: