Spread trading in Meta Trader - page 158

 
hrenfx:
  1. Two EAs are running.
  2. The table of orders/positions for these symbols does not have time to update immediately after opening. Put Sleep(PAUSE).


1. Expert Advisor - one is running.

2. Yes, - I will try to put Sleep now , - thank you.

 
forex-k:
Pass through a filter!


If it is not a secret, can you give an example of such a filter?

Here's a question. Is it possible to set the expiry time condition programmatically?

Thank you.

 

And another question.

The price line indicator for 5 instruments.

A few days ago (after switching off the light in the flat and rebooting the computer) I found that the commentary from the right side of the indicator window jumped to the price chart window (!).

Reinstalling the indicator doesn't help. Removing the chart and reinstalling it doesn't help either.

Code for the execution of the rendering comment:

#property indicator_separate_window
#property indicator_buffers 6

int deinit()  {
  // Удаляем все графические объекты
  DeleteObject(oSymb1);   DeleteObject(oSymb2); 
  DeleteObject(oSymb3);  DeleteObject(oSymb4);
  DeleteObject(oSymb5);  DeleteObject(oSymbS); 
  return(0);  }
//-------------------------------------------------------------------+

int start() {
// ... ... ... ... 

  // Построение графических объектов
  // Пишем комментарий в окне индикатора с правой стороны
  string sVolA1="",sVolA2="",sVolA3="",sVolA4="",sVolA5="",
         sVolP1="",sVolP2="",sVolP3="",sVolP4="",sVolP5="";
  
  DrawLabel(oSymb1, sVolP1+ Symbol1.Name +sVolA1,10, indicator_color1, 5);
  DrawLabel(oSymb2, sVolP2+ Symbol2.Name +sVolA2,10, indicator_color2,18);
  DrawLabel(oSymb3, sVolP3+ Symbol3.Name +sVolA3,10, indicator_color3,31);
  DrawLabel(oSymb4, sVolP4+ Symbol4.Name +sVolA4,10, indicator_color4,44);
  DrawLabel(oSymb5, sVolP5+ Symbol5.Name +sVolA5,10, indicator_color5,57);
  DrawLabel(oSymbS, "AVERAGE", 10, indicator_color6, 70);
 
    return(0);
} // Конец функции Start

//+----------------- Пользовательские функции ------------------------------------------+

// Рисуем коммент
void DrawLabel(string aName, string aText, int aFontSize, color aColor, int aValue) {
  string objName=aName+wndName;
  ObjectDelete(objName);
  ObjectCreate(objName, OBJ_LABEL, wndNum, 0, 0);
  ObjectSetText(objName, aText, aFontSize, "Verdana", aColor);
  ObjectSet(objName, OBJPROP_CORNER, 1);
  ObjectSet(objName, OBJPROP_XDISTANCE, 4);
  ObjectSet(objName, OBJPROP_YDISTANCE, aValue); 
}

// Удаляем графический объект
void DeleteObject(string name) {
  ObjectDelete(name+wndName);
}

Can you please tell me how to fix the glitch? How to return the "prodigal son" back to the indicator window?

 

And create a profile without the defective window and reinstall the terminal, by the way maybe the terminal version has been updated?

I still have the 225 version, an old friend is better than the new two. )

I meant create a profile to transfer, in case the terminal is reinstalled.

 

Thank you. I'll try to create a new profile.

It's very possible I may have updated the terminal version. Can't remember exactly - it happened before the weekend.

 
Vitya:


Can you give me an example of such a filter?

Like this one:

if (MarketInfo("EURUSD", MODE_ASK) - MarketInfo("EURUSD", MODE_BID) > MaxSpread)

return(0);

 
Vitya:

Can the expiry time condition be set programmatically?

It doesn't seem to be.
 
goldtrader:

Like this:

It would probably be better to write an indicator that monitors the spread and not enter if the max spread on the last n bars has exceeded the allowable spread. This is more efficient, especially with market execution.
 

Here's a script that tracks the bid-ask spread (specifically for brokerage brokerage).

Somewhere above in the middle of the thread there is the same version, but as an indicator.

My script consumes significant CPU resource (-schedule), so it's better to put it just before opening/closing, and then remove it at once.

6NZ0, M1

Files:
scr_tiker.mq4  3 kb
 
Vitya:


If it is not a secret, can you give an example of such a filter?

Here's a question. Is it possible to set the expiry time condition programmatically?

Thank you.

Everything can be done programmatically.

The spread is taken both when opening an order and when closing it, the spread is floating.

This tool is not annoying but very informative for brokers.

-you can set any coefficients for instruments and as a result, lot, deposit and spread are calculated automatically.

-it also shows if the market is closed or not, if 0, it is closed, if 1, it is open.

-accurate calculation of the point value

-shows the expiry date.

Files:
Reason: