RogozaIV: Excuse me for a very simple question, how do I close an open position? mql4 has the OrderClose() function, but how?
In mql5, you have to open an opposite position. It can be clearly seen in the tab of the terminal History. The easiest way is to use the CTrade class from the standard library.
I am preparing an indicator to be called in the EA.
I want to send a buffer from the indicator.
The result is the int value bound to the bar.
The task is to pass a two-dimensional array from the indicator to an Expert Advisor, I can't figure out how to do it.
I call it in the EA
1. Remember that in the INDICATOR the default indicator buffer with index "0" corresponds to the leftmost bar on the chart.
2. The Expert Advisor has no "SetIndexBuffer" command.
3. iCustom is creating a custom indicator, not a buffer request (therefore, everything should be written explicitly, not ",0,1"). In your case, you can use this form
//--- create handle of the indicator TopqwResetLastError();
handle_Topqw=iCustom(Symbol(),Period(),"Topqw",PRICE_CLOSE);
//--- if the handle is not created if(handle_Topqw==INVALID_HANDLE)
{
//--- tell about the failure and output the error code PrintFormat("Failed to create handle of the Topqw indicator for the symbol %s/%s, error code %d",
Symbol(),
EnumToString(Period()),
GetLastError());
//--- the indicator is stopped early return(INIT_FAILED);
}
4. CopyBuffer seems to be written correctly.
5. Two-dimensional array can't be passed - make two array-indicator buffers.
1. Remember that in the INDICATOR, by default, the indicator buffer with index "0" corresponds to the leftmost bar on the chart.
2. There is no "SetIndexBuffer" command in the EA.
3. iCustom is creating a custom indicator, not a buffer request (therefore everything should be written explicitly, not ",0,1"). In your case, you can use this form
4. CopyBuffer seems to be written correctly.
5. You can't pass a two-dimensional array - make two array-indicator buffers.
Thanks for the correction, but I do not understand, if I set explicitly to transfer arrays, how is it formalized? Where do I specify that I need to extract two arrays?
MA_handle=iCustom(Symbol(),Period(),"TopFidCounselor",per,bar); per,bar - же массивы, а данные должны быть imput,
в индикаторе записываю в массивы
SetIndexBuffer(0,per,INDICATOR_CALCULATIONS);
SetIndexBuffer(1,bar,INDICATOR_CALCULATIONS);
если я сделаю такую запись
intOnCalculate(
...
{
//--------------------------------------------------------------
for ( int i = 0; i < rates_total; i ++ ) per[i] = price[i]; -
//--------------------------------------------------------------
ТО СОВЕТНИК РАБОТАЕТ БЕЗ ОШИБКИ
а если такую
//----------------------------------------------------------------
for(int b=1; b<200; b++) //отбор по х-
{-
for(int p=1; p<200; p++) // отбор по у-
{-
if(arrayZ[6][p][b]>0||arrayZ[6][p][b]<0)-
{-
per[b]=p;-
bar[b]=b;-
}-
}-
}-
//----------------------------------------------------------------
ТО ОШИБКА код 4002
I've looked throughIndicatorCreate(), could you please tell me how, otherwise it will take me weeks to figure it out, and I've got so little left to finish the thought block. I have to go to taiga soon to spend the summer with bees foraging, so I want to check the idea before departure, so I won't have any illusions.
only it is not clear where to write the array to be extracted?
The arrayper is declared in the EA, in the procedure in which you do the copying. It must be a dynamic array (declared as [] - without dimensionality).
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Excuse me for a very simple question, how do I close an open position? mql4 has the OrderClose() function, but how?
In mql5, you have to open an opposite position. It can be clearly seen in the tab of the terminal History. The easiest way is to use the CTrade class from the standard library.
Gentlemen, please tell me where the error is.
I am preparing an indicator to be called in the EA.
I want to send a buffer from the indicator.
The result is the int value attached to the bar.
The task is to pass a two-dimensional array from the indicator to an Expert Advisor, I can't figure out how to do it.
So I call it in the EA
Gentlemen, please tell me where the error is.
I am preparing an indicator to be called in the EA.
I want to send a buffer from the indicator.
The result is the int value bound to the bar.
The task is to pass a two-dimensional array from the indicator to an Expert Advisor, I can't figure out how to do it.
I call it in the EA
1. Remember that in the INDICATOR the default indicator buffer with index "0" corresponds to the leftmost bar on the chart.
2. The Expert Advisor has no "SetIndexBuffer" command.
3. iCustom is creating a custom indicator, not a buffer request (therefore, everything should be written explicitly, not ",0,1"). In your case, you can use this form
4. CopyBuffer seems to be written correctly.
5. Two-dimensional array can't be passed - make two array-indicator buffers.
1. Remember that in the INDICATOR, by default, the indicator buffer with index "0" corresponds to the leftmost bar on the chart.
2. There is no "SetIndexBuffer" command in the EA.
3. iCustom is creating a custom indicator, not a buffer request (therefore everything should be written explicitly, not ",0,1"). In your case, you can use this form
4. CopyBuffer seems to be written correctly.
5. You can't pass a two-dimensional array - make two array-indicator buffers.
I've looked throughIndicatorCreate(), could you please tell me how, otherwise it will take me weeks to figure it out, and I've got so little left to finish the thought block. I have to go to taiga soon to spend the summer with bees foraging, so I want to check the idea before departure, so I won't have any illusions.Thanks for the correction, but I do not understand, if I set explicitly to transfer arrays, how is it formalized? Where do I specify that I need to extract two arrays?
Is what I use in theINDICATOR_CALCULATIONS indicator correct?
Error 4002 is resolved.
only it is not clear where to write the array to be extracted?
Error 4002 is resolved.
only it is not clear where to write the array to be extracted?
The arrayper is declared in the EA, in the procedure in which you do the copying. It must be a dynamic array (declared as [] - without dimensionality).