How to code? - page 333

 

HI Mladen,

I've done it,

but when placed in MT4,

nothing appears on the subwindow,

Please look into this source code.

Thanks.

Files:
 
luffy:
HI Mladen,

I've done it,

but when placed in MT4,

nothing appears on the subwindow,

Please look into this source code.

Thanks.

luffy

Two things :

1. Add if (R!=0) before the S = (Q/ R);

2. You are looping through all the bars but your arrays contain just 14 elements. If you want to use array like buffers (having same number of elements as there are bars on chart), then the size of the arrays should be always checked and resized accordingly). You can check this indicator : https://www.mql5.com/en/forum/174961/page22 (the iHull() function) to see how arrays have to be used in cases like that

 

Please someone make this to draw lines in the subwindow.

I've tried and still can not make it draw the lines

Please help.

 
luffy:
Please someone make this to draw lines in the subwindow.

I've tried and still can not make it draw the lines

Please help.

luffy

Since you are trying to use those arrays as buffers, declare them in init section all as buffers (there is no 8 buffer limit in the new metatrader 4 any more) and it will work

That is by far the simplest solution

 

Is there a way how I can restrict the code to work on one computer only?

 
apprentice coder:
Is there a way how I can restrict the code to work on one computer only?

You could do that by limiting to C: paritition serial number (using GetVolumeInformation() windows API function)

The format of the function is the following :

BOOL WINAPI GetVolumeInformation(

_In_opt_ LPCTSTR lpRootPathName,

_Out_opt_ LPTSTR lpVolumeNameBuffer,

_In_ DWORD nVolumeNameSize,

_Out_opt_ LPDWORD lpVolumeSerialNumber,

_Out_opt_ LPDWORD lpMaximumComponentLength,

_Out_opt_ LPDWORD lpFileSystemFlags,

_Out_opt_ LPTSTR lpFileSystemNameBuffer,

_In_ DWORD nFileSystemNameSize

);

It is in kernel32.dll. But if the user formats his C: partition, you will have to update the code too

 
mladen:
You could do that by limiting to C: paritition serial number (using GetVolumeInformation() windows API function)

The format of the function is the following :

It is in kernel32.dll. But if the user formats his C: partition, you will have to update the code too

Thanks

Will give it a try

 
mladen:
You could do that by limiting to C: paritition serial number (using GetVolumeInformation() windows API function)

The format of the function is the following :

It is in kernel32.dll. But if the user formats his C: partition, you will have to update the code too

Unfortunately this function does not suffice alone. Besides I can see a few customers with identical drive serial, the worst situation is with Windows emulators running on Macs and linux, which always return zero for this serial. A lot of users use them.

 
Ovo:
Unfortunately this function does not suffice alone. Besides I can see a few customers with identical drive serial, the worst situation is with Windows emulators running on Macs and linux, which always return zero for this serial. A lot of users use them.

Did not know about emulators

Then the dongle seems as a solution, but I have seen to many dongles cracked, so ...

 
mladen:
Did not know about emulators Then the dongle seems as a solution, but I have seen to many dongles cracked, so ...

Actually there are multiple emulators, and only some of them return zero (e.g. wine)

I checked my statistics - 290 out of 9000 MT4 database registrations had the serial equal zero, so about 3%. In common the emulators do not implement HW-related functions correctly, and some calls even freeze the Terminal when invoked. So not sure if the dongle can reliably solve it. So far I have not found a solution that would work on all the emulators.

Reason: