Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 391

 
John Smith:

Guys, could you please advise how to convert the date 29.01.2008 to a format like 1201564800 ? What function is used to do this?

I need to compare TimeCurrent () with a given historical date...

Is that ok?

datetime Начало = D'2015.01.01 00:00';  // Дата задана датой
string   Конец  = "2035.01.01 00:00";   // Дата задана строкой, потом переведем в дату

void start() 
{
  datetime End=StringToTime(Конец);

  if(TimeCurrent()>Начало)  Alert(" Начинаем");
  if(TimeCurrent()>End)     Alert(" Заканчиваем");
                      else  Alert(" Продолжаем");
}
 
John Smith:

Guys, could you tell me how to convert the date 29.01.2008 to a format like 1201564800 ? What function is used to do this?

I need to compare TimeCurrent () with a given historical date...


If you convert the current time to a second format via iTime: int iTime = TimeCurrent();

then how can it be compared to other dates which are written in the 29.01.2008 format?


Or somehow compare it without converting it to seconds, if you can do it straight away...

like

if TimeCurrent() > 29.01.2008 then a = 123456

but it doesn't work in this form... ((

datetime is a long

So, to represent a datetime as a long, you need to explicitly convert:

long time_current=(long)TimeCurrent();
 

Hello.

Question onstrategy tester

I can't reduce the font or column sizes to fit the entries within the 640 pixels window

how do I do this?

I have reduced the window size, but the information is crumpled.

Files:
 
Sergey Musin:

Hello.

Question onstrategy tester

I can't reduce the font or column sizes to fit the entries within the 640 pixels window

how do I do this?

I have reduced the window size, but the information is crumpled.

Try scaling down the system font in the Windows settings
 

Afternoon!

Please give me a hint, there is a piece of code:

void watch_breakout() {
  if(active != true) return;
    int ticket = get_ticket();
  if(Ask >= NormalizeDouble(channel_top, Digits)) {
    ticket   = OrderSend(Symbol(), OP_BUY, Lots, Ask, SLIPPAGE, NormalizeDouble(Ask-Stoploss*Point,Digits), 0, "LONG", MAGIC, clrNONE); 
       }
  if(Bid <= NormalizeDouble(channel_bottom, Digits)) {
    ticket   = OrderSend(Symbol(), OP_SELL, Lots, Bid, SLIPPAGE, NormalizeDouble(Bid+Stoploss*Point,Digits), 0, "SHORT", MAGIC, clrNONE);
       } 
    }

I am looking for breakdowns from the price channel, my task is to check if the breakthrough is not by any candlestick, but by a pinbar and open an order after the pinbar is formed.

Please, advise me how to do it. I am struggling with this for the third day but so far I have not seen any solution.

 
Snower: I have a piece of code:

To check if the breakthrough occurred not by any candle but by a pinbar and to open an order after the formation of the pinbar. Please tell me how to implement this, I am struggling for three days and do not see a solution yet

I am currently debugging an Expert Advisor that works well in the Strategy Tester within a month. And it is good on the demo. I got distracted and looked here. Do you have the drawing?

 
STARIJ:

Now I am debugging the Expert Advisor that I have been testering for a month. And it is good on the demo. I got distracted and looked here. Do you have the drawing?


Like this, for example. The yellow line is the price channel that the price should break through, and the order would open with a smiley, and all the ones that were there before would be ignored.

 
Snower:


Like this, for example. The yellow line is the price channel that price has to break through, and that the order would open with a smiley face candle, and ignore all the ones before that

This will not work.
 
Artyom Trishkin:
It won't work.

Reply

Artyom, you didn't read it carefully: the TS needs to open only at a pin bar breakout, respectively if you prescribe a pin bar (small body and large shadows), the condition can be met

 

How is the iCustom function handled in MT4? Please reply to those who know about it!


For example, in the strategy tester an Expert Advisor calls the indicator at every tick.

When the function is called, the indicator is loaded into the memory, recalculates all values from zero bar to Bars and then returns the value at the required offset.

If I request the value of 1 bar on the first tick and the value of the second bar on the second tick, then my Expert Advisor will calculate the indicator twice on the entire history?


If the Expert Advisor accesses the indicator1, and it has iCustom to the indicator2. How many times will the indicator2 be recalculated when requesting the value of indicator1?


Maybe the Strategy Tester and the MT4 terminal stores the indicator values on every bar, so they won't recalculate them at the repeated request?

Reason: