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

 
yellownight:
What should I write instead of Symbol() to make this code work only for a certain currency pair, "EURUSD" is not suitable, because the script doesn't work if a chart is opened with another symbol...

You mean you want to send the script to e.g. "EURUSD", but want the action to take place in another currency? Why doesn't this kind of "..." work? What kind of error, what's going on?

If you write NULL or Symblo(), the action will take place for the current currency.

 
hoz:

I gave the original version above, which of course compiles. I have a question. Why did you change lines:

i_maTF toPeriod(). Am I wrong?

The documentation says that when calculating the moving average:

timeframe i.e. my variablei_maTF( Period. Can be one of the chart periods. 0 means the period of the current graph.) I had 0 specified.i_maPeriod isnot mentioned.Please explain!

Did I say it was wrong? - I regarded this variable as superfluous. Especially, since you have "0" there, which means Period() (timeframe of the current chart).

P.S. In the indicators, you have to be VERY attentive to external variables, because in most cases, the indicator is used (if it's needed at all) in Expert Advisors, and useless variables in the indicator are NOT WANTED. For example, string parameters with explanations. Although: master - master...

 
yellownight:
What should it look like if it's inside the brackets? I don't understand.

Symbol() returns a text string, like "EURUSD", and you have to translate it into Int...
 

In an indicator, if the number of elements is not specified when declaring an array, i.e:

double         varsPrice1[],                             // Массив для цены в точке А
               varsPrice2[],                             // Массив для цены в точке В

Variables that use the array are not computed.

If I set the number of elements for both arrays, e.g:

double         varsPrice1[100],                             // Массив для цены в точке А
               varsPrice2[100],                             // Массив для цены в точке В

Then everything works correctly.

But if I set the number of variables for any one array, e.g:

double         varsPrice1[],                                // Массив для цены в точке А
               varsPrice2[100],                             // Массив для цены в точке В

then the value of the dependent variables that use those arrays in the calculations is completely different. Why is it so?

Because, for example, if I don't know explicitly how many elements will be in the respective array, I don't have to specify their number according to the help. But in fact it turns out that it's not.

 
hoz:
Symbol()

In the simplest case write "Your pair". For example "USDJPY". I.e. the string constant of your pair.
 
hoz:

In an indicator, if the number of elements is not specified when declaring an array, i.e:

Variables that use the array are not computed.

If I set the number of elements for both arrays, e.g:

Then everything works correctly.

But if I set the number of variables for any one array, e.g:

then the value of the dependent variables that use those arrays in the calculations is completely different. Why is it so?

Because, for example, if I don't know explicitly how many elements will be in the respective array, I don't have to specify their number according to the help. But in fact it turns out that it's not.


Don't bother with dynamic arrays, set them beforehand, with reserve, or you don't have enough memory?
 
Sepulca:

In the simplest case write "your pair". for example "USDJPY". I.e. the string constant of your pair.


"Yourpair" is "EURUSD", yes I already had that in the code, but then the script will not work if the chart is a non-current pair, i.e. I am sitting on GPBUSD and want to execute the script, then nothing will happen and I need to switch to EURUsd pair for the script to open an order,

 
yellownight:


"Your pair" is "EURUSD", yes I already had that in the code, but then the script will not work if the chart is a non-current pair, i.e. I am sitting on GPBUSD and want to execute the script, then nothing will happen and I need to switch to EURUsd pair for the script to open an order,


If you want to open/close/modify an order on another symbol in the current chart, you have to specify Ask/Bid of the required symbol. If you try to test something in the tester, it will not work, the tester only works on one instrument.
 
Sepulca:

Well, it seems to be already written that if you want to open/close/modify orders in the current chart for another symbol, respectively specify Ask/Bid of the needed pair. If you are trying to test something in the tester, it will not work, the tester only works on one instrument.

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?

 
ilunga:

Precisely because it only EXPLAINS as a timeseries.

This is only your Personal opinion. And if you put numbers 1, 2, 1.2, 2.1 in there, you end up with a timeseries for pork from 1927 (the numbers are conditional). But this won't turn the array into a timeseries - you need to specify it explicitly with the function

In other words, if I understood correctly, then: whatever array (including timeseries array) I copied using ArrayCopy function into USER array, I should "handle" it with ArraySetAsSeries function with set value equal to true, to turn this user array into a timeseries array?

Reason: