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

 
Vitaly Muzichenko:
Didn't find any, and I don't remember it here

roughly speaking, there is a bid, there is an average price of orders on the grid

a trawl is a bid minus the average price of the grid, compared to the specified step

If something goes wrong, you immediately go through the loop and cover the whole grid

this is a crude algorithm and it needs to be improved from the side of robustness, but it shows good results over short distances

By the way, I'm looking for ideas to improve algorithm stability.

 
trader781:

roughly speaking, there is a bid, there is an average price of orders on the grid

a trawl is a bid minus the average price of the grid, compared to the specified step

If something goes wrong, you immediately go through the loop and cover the whole grid

this is a crude algorithm and it needs to be improved from the side of robustness, but it shows good results over short distances

By the way, I'm looking for ideas to improve algorithm stability

My trawl works fine both individually and over the entire grid.

Have you read my question? I am not waiting for an answer from you but from the pros.

 
Vitaly Muzichenko:

Yes, logically it could be, for example, the terminal has lost connection - there are plenty of reasons for that, I have had it lose connection 50 times a day.

What's the best way to get up-to-date prices, while being less resource-intensive, mind you - for a grid trawl.

So there aren't too many options...

Here is what I do: in order loop, after passing through all filters for symbol, magic number and type, I get the right price to a variable via SymbolInfoDouble() and make level calculations with it right before sending a trade request (if calculation gave such a result that modification is needed). You can also use SymbolInfoTick() - whatever suits your logic best. Of course, we can get not only one price but the whole set of parameters of the last tick, but sometimes it is enough to get only one price for a certain type of order - Ask or Bid and work with it, and get the other price for another order type at the next loop iteration anyway. That is why using the obtained price once before the loop may result in the risk of getting an obsolete price if the tick is missed due to prolonged calculations.

 
Artyom Trishkin:
What if it doesn't get any at all? How do you slow down the cycle?

And this I left to everyone's discretion. But at the urging of users, I'll let you in on a huge secret...

       int d = 0;
        do
         {
          d++;
         }
        while(!SymbolInfoTick(_Symbol, mqlTick) && d < 7);
 

Hi all!

Could you please tell me how to write tooltips/popups?

Roughly speaking, I need an indicator under a certain bar to draw an icon and when I click on this icon a small text with a description will be shown

Thank you!

 
LuckySith:

Hi all!

Could you please tell me how to write a tooltip/popup?

Roughly speaking, I need the indicator to draw an icon under a certain bar and show a small text with description when I press on this icon

Thank you!

SetIndexLabel

Sets the indicator line description text to display in the DataWindow and tooltip.

voidSetIndexLabel(
intindex,// line number
string text// description text
);

Parameters

index

[The index number of the line. Must be from 0 to 7.

text

[in] Text of indicator line description. NULL means this line value is not shown in DataWindow.

 
Alekseu Fedotov:

SetIndexLabel

Sets the indicator line description text for displaying information in the DataWindow and tooltip.

voidSetIndexLabel(
intindex,// line number
string text// description text
);

Parameters

index

[The index number of the line. Must be from 0 to 7.

text

[in] Text of indicator line description. NULL means this line value is not shown in DataWindow.

Hmm, so it's a line.
And for me, by clicking on the icon
 
LuckySith:
Hmm, so it's a line.
And for me, when you click on the icon.

Whatever, you can do it on the icon.

Throw the fractals on the chart and hover the mouse over the icon.

 
Hello. Can you tell me how if(MarketInfo(Symbol(),MODE_POINT)==0) could be correct?
 
Gevorg Hakobyan:
Hello. Please advise how can if(MarketInfo(Symbol(),MODE_POINT)==0) be correct?
Check if there is a symbol in the market overview. It can't be zero.
Reason: