[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 398

 
alk:

Please advise what is wrong in the code. The robot should close a sell order and if it is not there, it should buy. Error 4105 appears, which I try to handle, but there is no result. Maybe there are other ways to process it?


Replace

for(cnt=OrdersTotal();cnt>=0;cnt--)

to

for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
 
Good day to you, dear experts, please help me... I need: on the basis of indicator i-Regr (attached) write a program block, which is able to determine the width of the channel in points with a periodicity of 1 time per minute and display this number on the chart. Thanks in advance!
Files:
i-regr_1.mq4  5 kb
 
magogy:
Good day! Dear experts, please help me... I need: on the basis of indicator i-Regr (attached) write a program block, which is able to determine the width of the channel in points with a periodicity of 1 time per minute and display this number on the chart. Thanks in advance!

I think that with this task is better to apply to the service
 
magogy:
Good day! Dear experts, please help me... I need: on the basis of indicator i-Regr (attached) write a program block, which is able to determine the width of the channel in points with a periodicity of 1 time per minute and display this number on the chart. Thanks in advance!
 datetime Time_=0; // объявить вверху, в глобальных переменных

 if(Time[0]!=Time_){Alert(NormalizeDouble(sqh[0]-sql[0],4));Time_=Time[0];} //добавить внижней части кода, перед return-ом
 
KONDOR:

Thank you very much for the tip!

There are some subtleties. The information is displayed as 0.0026, which corresponds to 26 points. I have changed the bottom line and now it looks like this:

if(Time[0]!=Time_){Alert(NormalizeDouble(sqh[0]*10000-sql[0]*10000,4));Time_=Time[0];}

The output is now shown as 25.6809

Please advise how to round off this number programmatically to display the information in whole points instead of fractional.

Regards magogy

 
magogy:

Can you please tell me how to round off this number programmatically so that the information is displayed as whole points and not as fractions.

Regards magogy

вместо 4, поставить 0, т.е. точность выводимого значения - ноль знаков после запятой
Alert(NormalizeDouble(sqh[0]*10000-sql[0]*10000,4))
 
KONDOR:


heh... how simple and obvious it all is to a professional and how scary and incomprehensible it all is to a novice...

thanks so much for your help!

 

Please tell me what's wrong. In the script I declare imported and call the function:

#import "PendingDlg.dll"
int  ShowPendingDlg(int& nbar,int& sltp);

...

int    nbar=3,sltp=10;
//--- покажем диалог
if(!ShowPendingDlg(nbar,sltp)) return(1);

I tried to get the value by reference and by pointer in DLL (in C++). If by reference it doesn't work, in case by pointer I get pointers with zero value. The code is in DLL:

__declspec(dllexport) int __stdcall ShowPendingDlg(int *nbar,int *sltp) { ... }

Thanks.

 
apm:

Please tell me what's wrong. In the script I declare imported and call the function:

I tried to get the value by reference and by pointer in DLL (in C++). If by reference it doesn't work, in case by pointer I get pointers with zero value. The code is in DLL:

Thanks.

MQL4 by reference and by pointer works only with arrays and strings (also arrays).
 
Zhunko:
MQL4 by reference and pointer only works with arrays and strings (also arrays).
Thank you! Got it all now, have a good weekend kind man)