[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 75

 
Vinin:


Thank you! It's working like clockwork. ))
 
ZZZEROXXX:

in this line

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) { Print("break "+GetLastError()); break;}

The order is breaking but the error code is 0. - Why does this happen?

because you have a check for the condition that the order selected using the OrderSelect() function is not a market order, print to the log and break

the opposite should be done: if the order is market and the order has a magic number and a symbol and . then close it and do not interrupt the iterations of the orders

https://book.mql4.com/ru/trading/orderclose

 
Hi all! Is there a script or indicator for the following task? I need a horizontal line to be drawn in the terminal and follow the price at a certain distance (like trailing, but only graphically). How much will this script increase MT's load? Thank you in advance!
 
globad:
Hi all! Is there a script or indicator for the following task? I need a horizontal line to be drawn in the terminal and follow the price at a certain distance (like trailing, but only graphically). How much will this script increase MT's load? Thank you in advance!

Action in one line - ObjectSet

 
IgorM:

because you are checking if the order selected using the OrderSelect() function is not a market order, then print it to the log and break it.

the opposite should be done: if the order is market and the order has a magic number and a symbol and . then close it and do not interrupt the iterations of the orders

https://book.mql4.com/ru/trading/orderclose

i.e. this line

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) { Print("break "+GetLastError()); break;}

change it to

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true) { here we are going to close everything }

but the meaning is the same.

I don't really understand why OrderSelect can return false and yet GetLastError() = 0.

 
ZZZEROXXX:

advise on the function to close all orders

I would go through the orders in reverse order. for(int i=total-1;i>-1;i--)

 

Please help me find an error, I can't get it right and then read it out of the file

here is the code:

int handle;

double value,Price,PriceLast,asd;

handle=FileOpen("EURUSD5up.dat",FILE_BIN | FILE_READ | FILE_WRITE);

if(handle<1)
{

Print("can't open file error-",GetLastError());

return(0);

}

asd = (Price - PriceLast);

FileWriteDouble(handle, asd, DOUBLE_VALUE);

FileSeek(handle, 0, SEEK_SET;)

value=FileReadDouble(handle,DOUBLE_VALUE);

Print(value);

FileClose(handle);

here is the result: 2011.02.08 10:18:27 2010.12.31 18:47 TEST EURUSD,M5: 0

 
splxgf:

I would go through the orders in reverse order. for(int i=total-1;i>-1;i--)


thank you!, it is strange that this variant is not presented in the sample help
 

стандартный кодебазовский RSI, являющийся отношением средней положительных изменений к средней отрицательных, не то же самое

that the real, original RSI, which is the ratio of the sum of positive changes to the sum of negative changes.

Although I have known and understood it for years, unlike the codebase one, I will not say that my version is correct.

These are the basics, I think everyone who has been on the market for a long time knows that rsi is sumpos/sumneg*100

by the way, they also twisted MacDi - they made the main machinewheel EMA

>
 
sergeev:

One line action - ObjectSet

Thank you very much for your reply. Unfortunately I'm not very good at programming. Could you show me how it should look like, for example for a line lagging the price by 3p upwards with the line colour blue.