[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 150

 
Roll:

1.MQL4 Reference (MetaEditor)-->Language Basics-->Operations and Expressions-->Arithmetic Operations
2.Tutorial -->https://book.mql4.com/ru/basics/expressions
x = (10000 * 1.4451) % 10, where "%" is the arithmetic operation "remainder of division" (in our case by "10"), "*" is the arithmetic operation "multiplication of values".

I do it like this, but I get an error:

int highx = NormalizeDouble((10000 * High[i]) % 10,0);

The '%'-remainder operator is to be applied to integer values only

help....

 
TEXX:

I do it like this, but I get an error:

int highx = NormalizeDouble((10000 * High[i]) % 10,0);

The '%'-remainder operator is to be applied to integer values only

help....

Try it:

int highx = 10000 * High[i];highx = highx % 10;
 

Gentlemen professionals, help please!


avatar
9
Xaoss1990 06.09.2011 19:01

Gentlemen professionals, help please!

The expert can open either a buy trade or a sell trade. He can also put stop losses for buys and sells. How do I make it so that it understands which trade is being made now? Is it buying or selling? I.e. so that it calculates stop loss for sales trades only when there is a sale trade, and for purchases in the same way. I.e. how to set an individual order parameter, which may contain information about the order (whether to sell or buy, and other signs of this order) ?

 
OrderType() - returns the type of order selected
 

It's not clear what OrderType() returns? A number? Or text? And which number or text? Where can I get a proper explanation of the function? What is written here - https://docs.mql4.com/ru/trading/OrderType doesn't make it clear...

And another question, why when using the "Print" function in the strategy tester's log the parameters monitored are not displayed every tick, but selectively? This makes it terribly difficult to analyse the program... How can I get out of this situation?
 
Xaoss1990:

It's not clear what OrderType() returns? A number? Or text? And which number or text? Where can I get a proper explanation of the function? What's written here - https://docs.mql4.com/ru/trading/OrderType doesn't make it clear...

It already says that it returns int

int OrderType( )

and there is an example given there as well.

int  order_type; if(OrderSelect(12, SELECT_BY_POS)) { order_type=OrderType()
;


And another question, why when using the "Print" function in the strategy tester's log the controlled parameters are not displayed every tick, but selectively? This makes analysis of the program very difficult... How can I get out of this situation?
Comment()
 
What numbers does it return? i.e. 1-buy, 2-sell, etc. Mine returns zeros, but the expert makes transactions.
 
DhP:
Another easy way to avoid this nuisance:
Now the programme simply terminates by making only one order
 
Roll:

Try it:


Thank you so much!!! Everything works.
 
Bit99:
Now the programme just terminates after making only one order
I don't get it. Explain.
Reason: