Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1176

 
Alexey Belyakov:

https://www.mql5.com/en/code/23479 This one doesn't work.

I tried, but I have a snag in the code, I don't think anyone would want to go into my scribbles, I'd rather do it again.


So here it is:

datetime some_time=TimeCurrent();
extern string Symbol3 = ""; //Инструмент (""текущий по умолчанию)
extern double P=5;       //Таймфрейм


int start()
{
int  raznV;
int percV;
int SD=5; // переменная для поиска разницы объёма
int sig;

double VAL2=MathAbs(iVolume(NULL,P,2));  //Т.Объём
double VAL1=MathAbs(iVolume(NULL,P,1));


raznV =MathAbs(iVolume(NULL,P,2)-iVolume(NULL,P,1));  //Разница объёма
percV =MathRound(raznV/(VAL1*0.01)); // Разница в (%)

//Цикл сканирования последних свечей SD,на которых есть разница равная 50%.
for (int i=SD; i>=0; i--)
{
int  sig=(raznV[i])>50;


//Если  есть нужная разница, значение будет больше нуля.
if (sig>0)
{
Alert ("Сигнал");
}

if (SD>5)
{
ObjectDelete("signal4");
} 


return(0);

int sig=(raznV[i])>50; Here is the hitch. I do not know how to present it in a different way. And you need to detect a deviation of at least 50% in previous candles.

Your code is as beautiful as an essay written by a not very studious first-grader - no offence, at least you can write comments :)

Especially I likedraznV[i], did you come from PineScript? Come on, this is a normal programming language))

in red - important mistakes, in yellow - flaws

 
Good afternoon. I have a question about a negative move on a muving. As a result, either opening a trade at this value or closing it does not work. How can this issue be resolved?
 

Hello. Please help with import from dll. Tried to import functions from trans2quik.dll

#import "trans2quik.dll"
   int _TRANS2QUIK_CONNECT@16(string lpcstrConnectionParamsString, int& pnExtendedErrorCode[], string lpstrErrorMessage, int dwErrorMessageSize);
#import

It worked, the dll returned code 0(TRANS2QUIK_SUCCESS). When I tried to import other functions the compiler gives me an error about long name (I know from forum that more than 31 characters in function name is not allowed). How else can I import functions? I tried to do it by function number, as described here (https://docs.microsoft.com/ru-ru/cpp/build/exporting-functions-from-a-dll-by-ordinal-rather-than-by-name?view=vs-2019), but whether I did it wrong, or the compiler can not swear by the number (writes name expected) I understand to join a dll need a wrapper? Or is it possible to edit function names in the dll itself? If it is important there are .h and .lib files in the dll archive.

 
Darirunu:
Good afternoon. I have a question about a negative muving shift. As a result, either opening a deal at this value or closing it does not work. How can I solve this problem?

Can you attach a piece of code?

 
Is it possible to change the test speed programmatically?
 
Yevhenii Levchenko:
Is it possible to change the test speed programmatically?

you can

 
f1nik:

Hello. Please help with import from dll. Tried to import functions from trans2quik.dll

It worked, the dll returned code 0(TRANS2QUIK_SUCCESS). When I tried to import other functions the compiler gives me an error about long name (I know from forum that more than 31 characters in function name is not allowed). How else can I import functions? I tried to do it by function number, as described here (https://docs.microsoft.com/ru-ru/cpp/build/exporting-functions-from-a-dll-by-ordinal-rather-than-by-name?view=vs-2019), but whether I did it wrong, or the compiler can not swear by the number (writes name expected) I understand to join a dll need a wrapper? Or may I edit the function names in the dll itself? If it's important the archive with dll has .h and .lib files.

In MQL by number is not possible.

 
Koldun Zloy:

You can't do it in MQL by number.

Thank you. So there is only dll adapter between terminal andtrans2quik.dll
 
f1nik:
Thank you. So there is only dll adapter between terminal andtrans2quik.dll

Have you tried slipping a string as #define str "long long string" or even as two strings via + or string function.

After all, Comment is also limited in the length of the string, but variables can be shoved so much that it does not fit on the monitor in a few lines.

 
Hello. Can you suggest a script or function to calculate the lot size depending on the specified margin for Forex, because all the scripts calculate margin on the lot size. It would be convenient to open for a certain fixed amount of free funds on the deposit, like in BOO.
Reason: