[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 534

 
Andreyu:

Who knows how to make a standard indicator visible in the strategy tester?

when you start the EA - put it on pause in visualization mode - put the indicator on the window - save the template with the name of the EA - the next time you start everything will work
 
How to remember the current price position? The newly received price is compared to the memorised price. I tried to do this:
double g_price_now=0.0000; // объявляем глобальную переменную int start() { double price_now; // объявляем локальную переменную if (NormalizeDouble(g_price_now,4) == 0.0000) { // если переменная g_price_now изменилась, значит она уже содержит цену Bid GlobalVariableSet("g_price_now",Bid); //Устанавливает новое значение глобальной переменной price_now = GlobalVariableGet("g_price_now"); // Возвращаем значение существующей глобальной переменной и запоминаем текущее положение цены } else { price_now = g_price_now; } Comment(price_now, " | ", Bid); return(0); }
But it turns out that price_now always equals Bid
 
tara 26.01.2012 22:16 pm | banned | delete
And it won't, because g_price_now is declared as global (not GV, but just global), and you identified it with terminal, i.e. GV.
reply

avatar
1723
tara 26.01.2012 22:21 | banned | delete

In short, you need to apply static (if it works correctly) and understand why it is so.

SZS you need help - ask here, too. I see you're inclined to get into it :)


 
bukmeker 26.01.2012 21:26 | ban

something like this. it seems to work.



price_now = somefunc();

Comment(price_now, " | ", Bid);

double somefunc()
{
static double price_now1=0.0000;

if (price_now1 == 0.0000) {
price_now1 = Bid;
}

return(price_now1);
}



By the way, thanks very much for the referral.

 

Thank you so much!!! I'm new to MQL4 and a little thing like this threw me for a loop =) Thanks again!!!
 

In a switch statement, should the expression only be of type integer? Unexpectedly! Is there no way to pass a string?

string symbol;

switch(symbol){
      case "EURUSD" : колдуем; break;
      case "GBPUSD" : колдуем; break;
      case "EURGBP" : колдуем; break;
   }
 

1. How do I know what period (timeframe) it is?

2. How do I draw a line or a segment of my own length in my indicator?

 
DOCTORS:

1. How do I know what period (timeframe) it is?

2. How do I draw a line or a segment of my own length in my indicator?

1. https://docs.mql4.com/ru/windows/Period

2. https://docs. mql4.com/ru/objects

 
DOCTORS:

1. How do I know what period (timeframe) it is?

int tf = Period();

DOCTORS:


2. How do I draw a line or a segment of my own length in my indicator?

The question is not quite clear
 
Zhunko:

1. https://docs.mql4.com/ru/windows/Period

2. https://docs. mql4.com/ru/objects

Thank you very much!

On 2, can you tell me if you can use SetIndexStyle() to create a line of the desired length?

UDP Question removed, yes through objects.

Reason: