Coding help - page 301

 
sunshineh:
Hi,

I am using the file functions and they work fine!

I am using rather big files and I am working with a for-loop.

In every cycle I am reading one line of the file. So sometimes I want to change a word in one of this lines.

Is there an easy way to do it? If I close the file for reading and open it for writing, than my file pointer goes to the end of the file.

But is there a posibility to get the actual file pointer position? So I can also write directly f.e. in the middle of the file.

No easy way if the lines are not fixed size (then you have to rewrite the whole file)

If the lines are fixed size use FileSeek(fileHandle,lineSize*(numberOfLine-1),SEEK_SET); and then write the changes to that specific line

 

Sorry if I repeat my message...but it is important for me....I need example of code:

Hi Mladen,

I would like little indicator which ,on 5 min time frame, shows me when stoc 5-3-3 is below 20 on 15 min time frame.

I don't want stoc multitimeframe....but signal of higher time frame on lower tf.

Thank's in advance

 

Hi Mladen ,

I want to export the non lag ma nrp values to CSV file.Red(tomato) colours should be negative and blue colours should be positive values?Thanks.

 
nevar:
Hi Mladen , I want to export the non lag ma nrp values to CSV file.Red(tomato) colours should be negative and blue colours should be positive values?Thanks.

nevar

Here is a script that does that : export_nonlag_ma_data.mq4

You need the "NonLag ma nrp nmc" from this post in the indicators folder too : https://www.mql5.com/en/forum/general

 
mladen:
AZRUL

You are not supplying the value that you want to look for in line 180 (this line :

int ranking = rank();

so the rank function can not compare to any value. Your call must be in a following form :

int ranking = rank(someValueToRank);

Dear SIR MLADEN,

I have tried to get the ranking for the Total output from my Indicator to make a RANK in Ascending Order but fail to do so... I only got 2 output and only one of them are correct.. ( I think so..) and the rest (5 more) is (0) zero......

I have tried all that I could think of and running out of ideas on how to produce a code to rank them in order either Ascending or Descending would be fine.... could you PLEASE HELP.........

Your time and expertise is always appreciated and needed.......

yours truly

AZRUL...

Files:
 
12BPRO:
Dear SIR MLADEN,

I have tried to get the ranking for the Total output from my Indicator to make a RANK in Ascending Order but fail to do so... I only got 2 output and only one of them are correct.. ( I think so..) and the rest (5 more) is (0) zero......

I have tried all that I could think of and running out of ideas on how to produce a code to rank them in order either Ascending or Descending would be fine.... could you PLEASE HELP.........

Your time and expertise is always appreciated and needed.......

yours truly

AZRUL...

12BPRO

I think I have told you already : you have to do a 2 dimensional ranking/sorting (since you have a a value+symbol name in each par that you want to display) It is not enough to sort only values since that way you are losing symbol names you have to make a sorting procedure of your own that will move the symbol name too to the corresponding place when the value is moved to it's place

 
mladen:
12BPRO I think I have told you already : you have to do a 2 dimensional ranking/sorting (since you have a a value+symbol name in each par that you want to display) It is not enough to sort only values since that way you are losing symbol names you have to make a sorting procedure of your own that will move the symbol name too to the corresponding place when the value is moved to it's place

Dear SIR MLADEN,

I have tried this code by adding sorting procedure and it is indicating some value... unfortunately it seem to have missed out the last array value (TOTCAD)... could you PLEASE have a look...

I am very2 sorry, I am not a PROGRAMER .... don't understand much... my Dear GURU..... I am doing my very best to learn this......

Your time and expertise is always appreciated and needed.......

yours truly

AZRUL...

Files:
 
12BPRO:
Dear SIR MLADEN,

I have tried this code by adding sorting procedure and it is indicating some value... unfortunately it seem to have missed out the last array value (TOTCAD)... could you PLEASE have a look...

I am very2 sorry, I am not a PROGRAMER .... don't understand much... my Dear GURU..... I am doing my very best to learn this......

Your time and expertise is always appreciated and needed.......

yours truly

AZRUL...

AZRUL

Here is a sorting routine that sorts 2 dimensional arrays :

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

// 2 dimenzional array shell sort

//

//

//

double PR[][2];

void SortIt()

{

int size ArrayRange(PR,0);

int i,j,increment = size / 2;

double temp,temi;

//

//

//

//

//

while (increment > 0)

{

for (i = increment; i < size; i++)

{

j = i;

temp = PR;

temi = PR;

while ((j >= increment) && (PR[j-increment,0] < temp))

{

PR[j,0] = PR[j-increment,0];

PR[j,1] = PR[j-increment,1];

j = j-increment;

}

PR[j,0] = temp;

PR[j,1] = temi;

}

if (increment == 2) increment = 1;

else increment = (increment / 2.2);

}

}

Fill the PR array with vlues and some kind of a mark for a symbol (for example PR[0,0] = value for eur, PR[0,1] = 1 (which would mean that 1 is a mark for EUR). The call the SortIt() procedure and read the values and their corresponding marks for symbols (for example you would get PR[5,1] == 1 (1 meaning EUR) which would mean that the value PR[4,0] is the value of EUR)

 
mladen:
AZRUL

Here is a sorting routine that sorts 2 dimensional arrays :

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

// 2 dimenzional array shell sort

//

//

//

double PR[][2];

void SortIt()

{

int size ArrayRange(PR,0);

int i,j,increment = size / 2;

double temp,temi;

//

//

//

//

//

while (increment > 0)

{

for (i = increment; i < size; i++)

{

j = i;

temp = PR;

temi = PR;

while ((j >= increment) && (PR[j-increment,0] < temp))

{

PR[j,0] = PR[j-increment,0];

PR[j,1] = PR[j-increment,1];

j = j-increment;

}

PR[j,0] = temp;

PR[j,1] = temi;

}

if (increment == 2) increment = 1;

else increment = (increment / 2.2);

}

}
Fill the PR array with vlues and some kind of a mark for a symbol (for example PR[0,0] = value for eur, PR[0,1] = 1 (which would mean that 1 is a mark for EUR). The call the SortIt() procedure and read the values and their corresponding marks for symbols (for example you would get PR[5,1] == 1 (1 meaning EUR) which would mean that the value PR[4,0] is the value of EUR)

Dear SIR MLADEN,

THANK YOU SO MUCH DEAR SIR(GURU).... you are my HERO AND .... 6th Credit...

I LOVE this FORUM so much.... thank to the GURU'S here....

This would be beneficial to others as well....

THANK YOU SIR....

yours truly

AZRUL...

 
mladen, mrtool...

need help to modify/add color changing rule by 2 moving averange (MA period 8 n MA period 24).

if MA8 > MA24, histo color=green.

if MA8 < MA24, histo color=red.

here is indicator link : https://www.mql5.com/en/code/download/7992/BW_MFI.mq4

still waiting...already tried by my self (before post this request) but no good result, need more buffers? or because i'm not coder/lacks of coding skill. just want to know if it possible to combine BW MFI with another indic's.

Reason: