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

 
Maxim Kuznetsov:

find the previous trade in the history and see :-) if it closed at stoploss

- Added [sl] or (sl) in the comment - as far as I understand it depends on server settings. As a rule the first one.

- closing price near stoploss

they need to be filtered by time

 
Roman Sharanov:

? it's them that need to be filtered by time ?

??

does your advisor have a profound memory and does not remember the order that was opened ?

 
Maxim Kuznetsov:

??

does your advisor have a profound memory and does not remember the order he opened ?

It's not about "remembering", it's about restarting correctly without losing data. For this you don't need to remember but to find. For a tester, of course, remembering will also work.
 

Hello, I'm getting really dumb.

How to create an associative array in mql4? I need to store a key - timecurrent and a value - tick price. And then work with these pairs.

 
Roman Sharanov:

Another question, why MT5 refuses to import ticks?

I have a CSV file with quotes, what does it need?

It needs the field separator to be correct and the date, time in separate fields and in the right format...

and maybe the lines should be separated by \r\n (I don't remember if it just takes \n or it depends on the encoding)

 
Artyom Trishkin:
It's not about 'remembering', it's about restarting properly without losing data. For that, it's not about remembering, it's about finding. For a tester of course remembering will do.

It's once on the first tick - go through the available history and choose the most recent one of your own :-)

(TS does not have more than 1 open order in the market, and they do not fly into the history in batches)

Next just remember...

 

Hello professionals!
I need help in writing part of the EA code.
I want to implement in my EA dynamic StopLoss and TakeProfit depending on the input data.
I take HIGH and LOW data for a period (e.g. previous 24 bars).

I used the following lines for that:

Ind_HIGH=HIGH[iHighest(Symbol(),0,MODE_HIGH,24,1)]; // obtain indices of extrema for the period
Ind_LOW =Low[iLowest(Symbol(),0,MODE_LOW,24,1)];// obtain indices of extrema for the period

then determine the price value at these extrema

Ind_H =iHigh(Symbol(),0,Ind_HIGH); // obtain the HIGH price value
Ind_L_Low(Symbol(),0,Ind_LOW);// get LOW price value

...and get the value of the price on 1 bar:

Ind_C =iClose(Symbol(),0,1); // get the CLOSE price value

Comparing Ind_C and Ind_H : Ind_L I wanted to get the price difference and translate it into points, because we seem to need integer values for SL and TP.
But for some reason it does not work. I need 290 and 193 (like on the picture)
Please help me to write this part of the code...
Thanks in advance!


 
concilere:

Hello professionals!
I need help in writing part of the EA code.
I want to implement in my EA dynamic StopLoss and TakeProfit depending on the input data.
I take HIGH and LOW data for a period (e.g. previous 24 bars).

I used the following lines for that:

Ind_HIGH=HIGH[iHighest(Symbol(),0,MODE_HIGH,24,1)]; // obtain indices of extrema for the period
Ind_LOW =Low[iLowest(Symbol(),0,MODE_LOW,24,1)];// obtain indices of extrema for the period

then determine the price value at these extrema

Ind_H =iHigh(Symbol(),0,Ind_HIGH); // obtain the HIGH price value
Ind_L_Low(Symbol(),0,Ind_LOW);// get LOW price value

...and get the value of the price on 1 bar:

Ind_C =iClose(Symbol(),0,1); // get the CLOSE price value

Comparing Ind_C and Ind_H : Ind_L I wanted to get the price difference and translate it into points, because we seem to need integer numbers for SL and TP.
But for some reason it does not work. I need 290 and 193 (like on the picture)
Please help me to write this part of the code...
Thanks in advance!


Here is where max/min bar index

Ind_HIGH=iHighest(Symbol(),0,MODE_HIGH,24,1); // obtain indices of extrema for the period
Ind_LOW =iLowest(Symbol(),0,MODE_LOW,24,1);// obtain indices of extrema for the period

 
Vitaly Muzichenko:

Here is where the max/min bar index

Ind_HIGH=iHighest(Symbol(),0,MODE_HIGH,24,1); // obtain indices of extrema for the period
Ind_LOW =iLowest(Symbol(),0,MODE_LOW,24,1); // obtain indices of extrema for the period

Yes, hooray! It worked!
Vitaly, thank you!

At first, the terminal started to swear. I had to change the calculation method,
it was like this:

StopLoss=(Ind_C1-Ind_L24); //Calculate SL open Buy
TakeProfit=(Ind_C1-Ind_L24); //calculate TP open Buy

and now it's like this:

StopLoss=(Ind_C1-Ind_L24)/Point; //Calculate SL open Buy
TakeProfit=(Ind_C1-Ind_L24)/Point; //Calculate TP open Buy

and everything worked...))



 

I have rsx-nrp-coronforex.mq4 indicator, can you tell me which parameters to use to get the data from the curve?

double RSX_M = iCustom(Symbol(),PERIOD_CURRENT,"\\rsx-nrp-coronforex",??? What should I write here???);

Files:
Reason: