Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 831

 

Can you tell me where it is described to create a sub-window in the terminal?

The purpose is to create a sub-window, as for example for a technical indicator, but to output there not the graphical representation of the indicator, but the values of the variables to be watched.

The Comment() function is very handy for this, the quotes chart often covers the text to be displayed and I have to move it all the time.

 

Question, how do I hide the colours in the code in the colours tab? I don't want to see what colours are there

http://gyazo.com/6aca4bde8bc0faf8071e17f0a6e04db8 for example I need 0 and 1 colours to be hidden, I know I need an alert for that, I attached the alert, but what next?

 
Albert88:

Question, how do I hide the colours in the code in the colours tab? I don't want to see what colours are there

http://gyazo.com/6aca4bde8bc0faf8071e17f0a6e04db8 for example I need 0 and 1 colours to be hidden, I know I need an alert for that, I attached the alert, but what next?

You don't need an alert for that at all.
 
favidu:

Can you tell me where it is described to create a sub-window in the terminal?

The purpose is to create a sub-window, as for example for a technical indicator, but to output there not the graphical representation of the indicator, but the values of the variables to be watched.

The Comment() function is very inconvenient for this purpose, the quotes chart often covers the text to be displayed and I have to move it all the time.

The Expert Advisor cannot create sub-windows. This can be done by indicators.

You can create an empty indicator that creates a sub-window. The information can be displayed in it

 
Albert88:

Question, how do I hide the colours in the code in the colours tab? I don't want to see what colours are there

http://gyazo.com/6aca4bde8bc0faf8071e17f0a6e04db8 I need 0 and 1 colours to be hidden. I know, it needs an alert.

You don't need any alert, you have to declare INDICATOR_CALCULATIONS type indicator buffers, at the end of buffers list and reduce buffers number for drawing by non-drawable.

It goes like this:

#property indicator_buffers 2 //кол-во отображаемых на графике серий, за вычетом невидимых (невидимы они будут также в окне даных терминала)

#property  indicator_color1 clrDodgerBlue 
#property  indicator_color2 clrCrimson
#property  indicator_width1 1      // Свойства программ Толщина линии в графической серии 1
#property  indicator_width2 1      // Свойства программ Толщина линии в графической серии 2
#property strict

double val1[]; // массив отображаемого буфера 1
double val2[]; // массив отображаемого буфера 2
double calc1[]; // массив расчётного буфера 3 (невидимый)

int OnInit()
  {
   IndicatorBuffers(3); //всего буферов, включая невидимые
   
   SetIndexBuffer(0,val1,INDICATOR_DATA); //отображаемый буфер 1
   SetIndexBuffer(1,val2,INDICATOR_DATA); //отображаемый буфер 2
   SetIndexBuffer(2,calc1,INDICATOR_CALCULATIONS); //расчётный невидимый буфер 3
   return(INIT_SUCCEEDED);
  }
 

About the lot calculations.

So in the initial we have:

  • Eurodollar symbol;
  • margin for 1 lot margin = MarketInfo(Symbol(),MODE_MARGINREQUIRED) = 227,38 (I check the value just before the calculation);
  • lotstep= MarketInfo(Symbol(),MODE_LOTSTEP)=0.01;
  • risk for 1 trade rsk=1%.
  • Initial deposit is 1000, so available free margin at the beginning of testing is also 1000.

So I decided to calculate the lot by the formula:

lotsi=lotstep*MathFloor(AccountFreeMargin()*rsk*0.01/margin/lotstep);

As a result, initial lot is 0.05.

I always had "C-minus" on arithmetic, therefore I decided to use calculator when checking my calculations. I take the calculator, I calculate:

Trunc(1000*1*0.01/227.38/0.01)*0.01=Trunc(4,39792417978714)*0.01=4*0.01=0.04 !!!! Trunc() по сути - тот же MathFloor, так же оставляет целое и откидывает дробную часть, несмотря на её значение.

WTF??? Why does the Expert Advisor have 0.05 and the calculator has 0.04?

 
Guys, is there any way to create buttons on the chart? I want a cross to dangle near the price line to close positions
 
evillive:

About the lot calculations.

So in the initial we have:

  • Eurodollar symbol;
  • margin for 1 lot margin = MarketInfo(Symbol(),MODE_MARGINREQUIRED) = 227,38 (I check the value just before the calculation);
  • lotstep= MarketInfo(Symbol(),MODE_LOTSTEP)=0.01;
  • risk for 1 trade rsk=1%.
  • Initial deposit is 1000, so available free margin at the beginning of testing is also 1000.

So I decided to calculate the lot by the formula:

As a result, initial lot is 0.05.

I always had "C-minus" on arithmetic, therefore I decided to use calculator when checking my calculations. I take the calculator, I calculate:

WTF??? Why does the Expert Advisor have 0.05 and the calculator has 0.04?

Because the Expert Advisor does not "drop" the fractional part before the calculation, while the calculator "drops" everything that exceeds its "solvability" by the total number of digits.
 
eddy:
Guys, is there any way to create buttons on the chart? I want a closing cross to be dangling near the price line
The closing colour is programmed and marked on the chart with a triangle like <| with a dotted line from the opening arrow.
 

What did you describe and why?

I said I want to make a button locker, I don't know what you mean.

Reason: