[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 454

 
VOLDEMAR:

Any idea why ???
Maybe we should make adequate tutorials.
Maybe do adequate teaching?


These questions are not for me. I'm a user. Just like you.

Maybe you should write these things down somewhere.

Well, I showed you where it says.

Maybe then the questions will disappear ???

No, they won't disappear. I assure you.

And you won't have to answer another 100500 stupid questions!
If there are such questions, it's not the student's fault, it's your fault! You didn't describe it anywhere !!!

These questions are not for me. I'm a user. Just like you.

It's not written in the help, it's not written how to translate from int to double.
but it says that if you assign the double type to int , then the fractional part will be erased,

a normal person would logically get the logical idea that when you assign an int number to a double number, then just a point with a given number of zeros will be added...


yeah. assignment works both ways.

Except you haven't incorporated your logic further.

If you wanted to be logical, you couldn't do two things at once. You should have first assigned a number to the double and only then divided it by another number. But it's the other way round. Sooner or later you would have come to it.

 
VOLDEMAR:

Do you have any idea why?

Maybe we should make adequate textbooks ???

Maybe do adequate teaching ???

Maybe write these things somewhere?

Maybe then the questions will disappear?

And you won't have to answer another 100500 stupid questions!

If there are such questions, it's not the student's fault, it's your fault! You didn't describe it anywhere!!!

It's not written in the help, it's not written how to translate from int to double.

but it says that if you assign the double type to int, the fractional part will be erased,

A normal person would logically conclude that if int is assigned to double, just a point with a given number of zeros will be added...

So it's like this ....

Vladimir, you have the right to express all this hysteria to technical support of the terminal you buy. And while you are using a free terminal, you can thank those enthusiasts who have figured it out themselves and the idlers like you who don't even want to spend time to search for materials on the website and still are answering something for the hundredth time. No one owes you anything. They are trying to do it on their own. If you want them to bother you, hire an instructor and mess with his head. He will give you a dummy and a bib.

 
VOLDEMAR:

Do you have any idea why?

Maybe we should make adequate textbooks ???

Maybe do adequate teaching ???

Maybe write these things somewhere?

Maybe then the questions will disappear?

And you won't have to answer another 100500 stupid questions!

If there are such questions, it's not the student's fault, it's your fault! You didn't describe it anywhere!!!

It's not written in the help, it's not written how to translate from int to double.

But it says that if you assign the double type to int, the fractional part will be erased,

A normal person would logically conclude that if int is assigned to double, just a point with a given number of zeros will be added...

So it's like this ....

Actually it is in the STUDY book! It's even highlighted!
 

Hi all. I'm quite new to programming. I have a very simple question.

I need an EA to open a deal when prices cross MA, not on the next candle, but at the same moment without waiting for the close of the candle, the output is not important

Thank you in advance

 
VOLDEMAR:

Do you have any idea why?

Maybe we should make adequate textbooks ???

Maybe do adequate teaching ???

Maybe write these things somewhere?

Maybe then the questions will disappear?

And you won't have to answer another 100500 stupid questions!

If there are such questions, it's not the student's fault, it's your fault! You didn't describe it anywhere!!!

It's not written in the help, it's not written how to translate from int to double.

But it says that if you assign the double type to int, the fractional part will be erased,

A normal person would logically conclude that if int is assigned to double, just a point with a given number of zeros will be added...

So it's like this ....

Who are you talking to now? With public moderator Sergeev, who, together with other enthusiasts, created and populated the "Forum Navigator and Answers to FAQs" thread specifically for those who didn't read the documentation well?
Your pathos seems misplaced in this context.
 
Activict:

Hi all. I'm quite new to programming. I have a very simple question.

I need an EA to open a deal when prices cross MA, not on the next candle, but at the same moment without waiting for the close of the candle, the output is not important

Thank you in advance

It's not a question, it's a statement. What is the question? In advance, please.
 

Thanks for the promptness, I am at work and my head is boiling at the end of work)) I have poorly learned how to write simple Expert Advisors, but now I have an idea and I need a code fragment to open a position when prices cross MA and open at the moment of crossing, but I got it only on the next candle. I would like them to show me a piece of code, I believe it may take only one line for those who know well

 
Activict:

...I think it's a 1 line case for those who are good at it.

...Or one click for those who know there is a search.
HOW do you get a signal for the intersection of two MAs?
 
Activict:

Thanks for the promptness, I am at work and my head is boiling at the end of work)) I have poorly learned how to write simple Expert Advisors, but now I have an idea and I need a code fragment to open a position when prices cross MA and open at the moment of crossing, but I got it only on the next candle. I want them to show me a piece of code, I believe it should take only 1 line for those who know well

Use prices of bar 0 - Close[0], ma[0], Ask, Bid - numbering of bars from 0. The 0-th is the last unfinished bar.

Better read the forum: this idea has been tested many times - you will get a lot of false signals, no fish there. But it is possible to practice.

 
ilunga:
exactly

I modified the script a little bit:

//+------------------------------------------------------------------------------------------+
//|                                                                     ArraySetAsSeries.mq4 |
//+------------------------------------------------------------------------------------------+
//|                         script program start function                                    |
//+------------------------------------------------------------------------------------------+
//------------------------------------ НАЧАЛО START -------------------------------------- 1 -
int start()                                                              //функция start
  {                                                                      //начало start
   double Timestart=GetTickCount();                                      //переменная, с помощью которой вычисляется время (в милисекундах) начала выполнения скрипта
   double array1[][6];                                                   //объявляем массив-источник (массив, из к-о будут скопированы данные)
   double array2[][6];                                                   //объявляем массив-приемник (массив, куда будут скопированы данные), к-й на
                                                                         //момент объявления заполнен некоторыми данными
   int element_1=ArrayCopyRates(array1);                                 //копируем данные баров текущего графика в массив array1 
   int element_2=ArrayCopy(array2,array1,0,0,WHOLE_ARRAY);               //копируем данные всех баров в пользовательский массив
   bool element_3=ArrayGetAsSeries(array2);                              //проверка: является ли массив array1 массивом-таймсерией
   bool try_1=ArraySetAsSeries(array2,false);                            //устанавливаем НАПРАВЛЕНИЕ индексирования массива  
   bool element_4=ArrayGetAsSeries(array2);                              //проверка: является ли массив array2 массивом-таймсерией
   double element=array2[0][1];                                          //получаем значение цены открытия нулевого бара
//----------------------------------------------------------------------------------------- 2 -
   Comment("\nФункция ArrayCopyRates(array1) вернула: ",element_1,
           "\nФункция ArrayCopy(array2,array1,0,WHOLE_ARRAY) вернула: ",element_2,
           "\nФункция ArrayGetAsSeries(array2) вернула: ",element_3,
           "\nФункция ArraySetAsSeries(array2;false) вернула: ",try_1,
           "\nФункция ArrayGetAsSeries(array2) вернула: ",element_4,
           "\nЦена открытия нулевого бара (т.е. бара с ИНДЕКСОМ 0) равна: ",element,
           "\nСкрипт выполнялся всего ",GetTickCount()-Timestart," миллисекунд, из них: ",
           MathFloor((GetTickCount()-Timestart)/1000)," секунд ",((GetTickCount()-Timestart)/1000-MathFloor((GetTickCount()-Timestart)/1000))*1000,
           " миллисекунд");//печать сообщения на экран
//----------------------------------------------------------------------------------------- 3 -
   return(0);                                                             //выход из start
  }                                                                       //конец start
//-------------------------------------- КОНЕЦ START -------------------------------------- 4 -

The result is as follows:


A question naturally arose: In this case I copied data of the bars of the current chart into a two-dimensional array array1 using the ArrayCopyRates(array1) function. Then in the next line with function ArrayCopy(array2,array1,0,0,WHOLE_ARRAY) I copied data of array1 into array2. Then, using the ArrayGetAsSeries function, I checked whether array2 is an array-timeseries. And it turned out (as you can see from the screenshot), that the array is a timeseries array, although I hadn't "processed" it with ArraySetAsSeries function before.

Question: why in the first case (previous question) I needed to use ArraySetAsSeries function (to make my array be organized as a timeseries array), while in this case I don't need such processing.

P.S. Sorry for the insistence, I just want to understand it completely, so that no "gaps in history" were left. Thanks for all the previous replies.