# [WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 165

mql-experts >> :

All int variables are integers. When dividing an integer by an integer, the answer is also an integer. And if the first number is smaller than the second, the answer will always be 0. Perhaps this is the problem.

If possible, change all the types to double.

I've just realized that the number of deals is zero at the very beginning and the result is division by 0.

I have added condition (>0) and everything has started to work out. I was beginning to think about some evil forces that do not want to show immense profits :)

>> Thank you!

chief2000 писал(а) >>

Something curious:(

The indicator is in the process of calculating profit and loss. I want to put the results in comments (output on the screen):

Without last line (commented out) everything works as it should.

But as soon as you leave it uncommented, all you see is a blank candle and nothing more. Rebooting MT didn't help.

What can it be?

Apparently there is no transaction and there is a division to zero.

Vinin >> :

Apparently there are no trades and there is a division of zero

>> that's right!

```chief2000 23.07.2009 00:47правка | удалить
В Индикаторе, если выполняется условие, я хочу внести строчку с пометкой в текстовый файл (не важно что, допустим дату и время).
Файл создаётся, строка дописывается, но только в реальном времени. Я же хочу вносить пометки при работе на истории. Кто-нибудь знает как это сделать?
Спасибо!```

I.e. let's say "if(ma1>ma2)" then "Time[i] and Close[i]" I would like to put in a new line

of the text file. But it is important that this can also be done with "i>0", i.e. when checking the Indicator on history.

Can you tell me how to do it? (everything works in real time)

Hello. Could you please tell me how to check if the selected order is in profit? I would like to put this condition in the order loop.

Alex5757000 писал(а) >>

Hello. Could you please tell me how to check if the selected order is in profit? I would like to put this condition into a loop of orders.

 double OrderProfit( )
Returns the net profit value (excluding swaps and commissions) for the selected order. For open positions this is the current unrealised profit. For closed orders, it is the fixed profit.
The order must be pre-selected using the OrderSelect() function.

there is a lot of interesting stuff in help!

Hello! It is good that there is such a section where newbies can ask questions.

I cannot understand the difference between pending orders: Buy Limit and Buy Stop, and between Sell Limit and Sell Stop.

In the user guide the difference is explained by the order set below or above the market, and we have to wait if the price goes to the required side immediately or to the opposite side first.

I still do not get it. If i place a buy stop below the market, will it not work?

Or a buy limit higher, will the price go through it and it will not work?

But even if it does, why bother?

Why not use two simple pending orders, one to buy and one to sell, and put them anywhere you want up or down?

If we have four orders, does it mean someone needs it? WHY?

Stam писал(а) >>

Hello! It is good that there is such a section where newbies can ask questions.

I cannot understand the difference between pending orders: Buy Limit and Buy Stop, and between Sell Limit and Sell Stop.

In the user guide the difference is explained by the order set below or above the market, and what we expect, will the price go to the required side immediately or firstly to the opposite side.

I still do not get it. If i place a buy stop below the market, will it not work?

Or a buy limit higher, will the price go through it and it won't work?

You won't even be able to place one.

Why not use two simple pending orders, one to buy and one to sell and place them anywhere you want up or down?

That's why they are placed from different sides(https://book.mql4.com/ru/trading/orders).

This is the order in the market, otherwise you could do with two orders altogether.

Depending on the position in relation to the price it would be determined which Sell, for example. But it would only make things more complicated ;-)

Imagine that you have open and not open Sell's on the chart in a mixed mode :-D and all of them are called Sell.

Get over it.

And yet, if there were only two simple orders - how would that be worse for me?

This order in the market is designed for a purpose.

What is the advantage of 4 orders over two (if there were only two)?

Stam >> :

And yet, if there were only two simple orders - how would that be worse for me?

This order in the market is designed for a purpose.

What is the advantage of 4 orders over two (if there were only two)?

There are stop orders and there are limit orders.

It's a strange question to ask.

What if there were only two items on the menu in a restaurant instead of different types of food and drink?

1.food

2.drink

(Short and simple - why more?))