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

 

yellownight:


Can you tell me what it looks like, how to write Ask/Bid and other things that are needed from the other pair in ordersend?

Separate question to the same topic, can I write the code to move from the current chart to the required one?


double MarketInfo( string symbol, int type)

Returns different information about financial instruments listed in Market Watch. Some information about the current financial instrument is stored in predefined variables.

I'll tell you more.............


 
7777877:

In other words, if I understand correctly: whatever array (including timeseries array) I copy using ArrayCopy function to a USER array, I have to "process" it with ArraySetAsSeries function with set value equal to true for this user array to become a timeseries array?

exactly
 

Dear programmers. please help me to write a code with the following principle - BUY Signal - open BUY 1position.SL.TP.transfer to Breakeven

SELL signal -open SELL 1 position. SL.TP.transfer to lossless . BUY-if there is an open BUY 1 and SELL 1 position, we open BUY 2. SELL signal-if there are open positions BUY 1 and BUY 1 then we open SELL 2. BUY signal-if there are open positions SELL 1. BUY 1. SELL 2. then close SELL 2. open BUY 2. SELL signal - if there are open BUY 1. SELL 1. BUY 2. then we will close BUY 2. open SELL 2. The market should not work more than 3 orders. if someone can help, thank you very much.

 
Sepulca:

Don't bother with dynamic arrays, specify in advance, with a reserve, or you don't have enough memory?

My memory is acceptable, but that's not the point here :)

What's the point of specifying an array with a potentially huge number of elements, if there will be many times fewer of them?

After all, by creating an array, it will already take up part of the operating memory.

 
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.

 

I can't figure it out, or I'm dumb ....

In theory it should be 0,3 but for some reason it is 0,00 ....

  Comment(3/10);

Also gives 0... So how do you get fractional numbers ?????

int start()
  {
double t;
t=3/10;
   Comment(t);

   return(0);
  }

also zero ....

I don't know what kind of tambourine to jump with .......

 
VOLDEMAR:

I can't figure it out, or I'm dumb ....

In theory it should be 0,3 but for some reason it is 0,00 ....

Also gives 0... So how do you get fractional numbers ?????

also zero ....

I don't know what kind of tambourine to jump with .......

Read documentation 3 times a day for 4-5 hours. And only then jump with a tambourine.

3.0/10.0

 

Do you have any idea why?

Maybe we should make adequate textbooks ???

Maybe do adequate training???

Maybe you should 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 ....

 
Roger:

Replace

to


Thank you very much, I will try it out!