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

 

Good afternoon.

I have faced a peculiar problem while studying MQL.

I do not understand the methodology of calculating Fibo levels.

For example, if the instrument price equals 4581.5 and it is equal to zero Fibo, then how is the 161st level calculated?

If I do what I did, i.e. multiply 4581.5 by 161%, we get nonsense.


Please advise me, where is my error?

I am very grateful to you.

 
luka >> :

Good afternoon.

If you do as I did, multiplying 4581.5 by 161%, you get nonsense.

>> thank you.

There must be 0 and 100 levels for the subsequent calculation.

 
luka >> :

I do not understand the methodology of calculating Fibo levels.

For example, if the instrument price is equal to 4581.5 and it is the zero Fibo level, then how is the 161st level calculated?

To find 161 or any other level, you should know 0 and 100.

This calculation is not difficult:

price at level 161 = price at level 0 + (price at level 100 - price at level 0) * 161.

 
komposter >> :

To find 161 or any other level, you need to know 0 and 100.

And it's not hard to do the math:

price on level 161 = price on level 0 + (price on level 100 - price on level 0) * 161.


Exactly. Thank you!

Only you have to multiply it not by 161, but by 1.618 :)

 

Another worrying question.

I wrote an indicator which shows entry points several times a day, marking them with lines and colouring the corresponding candles. The TS works within the day, i.e. every day the calculations start with a bar whose time is 8:00.


During the day signals may not be confirmed, and the indicator re-creates everything without problems.

But when you enable it the next day, it does not "forget" all values of variables for the previous day, although it still performs calculations.

The only thing that helps is compilation.


Is it possible to fix it?

 

the way you wrote it works, and it can be fixed

 
I can't figure out if there are pending orders in the history. I have found them by searching the loop. How to determine which of them triggered and which canceled? I tried using OrderOpenPrice and OrderClosePrice, but they do not work.
 
Dimoncheg >> :
I can't figure it out, let's say there are pending orders in the history. I have found them using loop search. How to determine which of them triggered and which canceled? I have tried to fiddle with OrderOpenPrice and OrderClosePrice - I got nothing.

A pending order can become either pending, triggered or deleted. Defined by type and by list.


I.e., if a pending order has BUY_LIMIT or BUY_STOP type, its type changes to BUY after triggering. If the pending order has SELL_LIMIT or SELL_STOP type, then its type changes to SELL. In this case, you should look for the order in the list of open positions.


The type of a deleted position does not change. It is found in the list of closed positions.

 
Reshetov >> :

A pending order can become either pending, triggered or deleted. They are determined by type and list.


I.e. if the pending order has BUY_LIMIT or BUY_STOP type, its type changes to BUY after triggering. If the pending order has SELL_LIMIT or SELL_STOP type, then its type changes to SELL. In this case, you should look for the order in the list of open positions.


The type of a deleted position does not change. It is placed in the list of closed positions.


It turns out that I cannot use history to determine if I opened the order by market or by a pending order if their type is the same? So it turns out that if I find orders of the BUY_LIMIT SELL_LIMIT SELL_STOP BUY_STOP type through the history, those are the deleted ones?

 

it is possible to set specific comments or magicians for pending orders

Reason: