Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1120

 
 
Sergey Voytsekhovsky:

Good afternoon. Please advise or provide me with a link. How to organize an indicator that would show the balance changes as a candlestick chart in a separate window. I have done the simplest thing, the indicator copies the price changes, but now how to replace the price changes with the changes in the balance, in other words, to replace the arrays used by the indicator.

If you have any ideas, please share them, I would be grateful even for a general description of the algorithm, I'm not experienced enough, I don't know where to start.

https://charts.mql5.com/22/192/eurusd-m1-alpari-international-2.png

Do you need it?

LifeHack Balance Equity

This indicator displays the balance and equity of a trading account.

This indicator is particularly useful when used in the Strategy Tester, as it gives visual indication of balance and equity:

LifeHack Balance Equity

With a small difference - here, Balance and Equity are displayed in the form of lines.

 
Vladimir Karputov:

Do you need one of these?

.....

With a slight difference - here the Balance and Funds are displayed as lines.

Hello Vladimir.

Thank you for your quick replies.

No, it is not. I will try to explain it in more details.

A candlestick indicator is needed. I.e., each price (chart) candle must have its own Equity change candle (of course, not the balance). Buffers BufOutcr, BufZakr, BufHigh and BufLow have to be calculated, not taken from the structure (like the example shown above).

These buffers will be calculated by the Expert Advisor. Upon receipt of a Buy or Sell signal (with the specified lot size), the position size, theopen priceof the position, and as a result, the values of these buffers will be recalculated.

The signal advisors will be complemented with this indicator and the output will be several Equity candlestick charts, one for each signal. We will be able to compare them and apply MA and other technical analyses to them as to the price chart.

The question is how to do it? I see two ways:

  1. The indicator receives these signals
  2. The indicator receives ready arrays.
I don't know how to do either yet. Can you give me some pointers on what to read? What is the right way?
 

I think I'll form the question again.

Can you tell me please:

  1. How to make an indicator to use as input parameters for OnCalculate the user defined BufOutcr, BufZacr, BufHigh and BufLow.
  2. How to get variables that can change on each tick (Buy, Sell, Lot signals) for calculations inside the indicator.
 
Sergey Voytsekhovsky:

I think I'll form the question again.

Can you tell me please:

  1. How to make an indicator to use as input parameters for OnCalculate the user defined BufOutcr, BufZacr, BufHigh and BufLow.
  2. How to get the variables that may change on every tick (signals Buy, Sell, Lot) in the indicator, for the calculations inside the indicator.

Sorry, I don't understand anything at all. I am disconnected for the weekend. Maybe on Monday I will understand ...

 

I have a problem.
I use in my Expert Advisor built-in indicators iAO and iRSI, EA displays them on the chart and everything is ok.

But the need arose to format their appearance a bit, i.e. right-click on the indicator and change the colour, thickness of lines, etc. How to do it in the Expert Advisor? Where are the .mq5 files of these indicators? Do they have access at all?

I do not want to replace them with similar ones in Example folder and connect them as iCustom.

 
Evgeny Dyuka:

I have a problem.
I use in my Expert Advisor the built-in indicators iAO and iRSI and it outputs them to the chart and everything is ok.

But the need arose to format their appearance a bit, i.e. right-click on the indicator and change the colour, thickness of lines, etc. How to do it in the Expert Advisor? Where are the .mq5 files of these indicators? Do you have access to them at all?

I do not want to replace them with other indicators from the Example folder and connect them as iCustom.

We will have to.

For example, I need theStochastic indicator todisplay the levels that can be set from the Expert Advisor - theStochastic Customappeared there:

When a standard iStochastic is called from an EA, this standard indicator will ALWAYS have two levels displayed in visual testing mode: 80.0 and 20.0. This situation is not suitable if the Expert Advisor uses other levels (for example, 75.0 and 25.0).

Therefore, the standard indicator has been modified: the Stochastic Custom indicator has two new parameters:

Stochastic Custom

Example of call of this indicator from the Expert Advisor:

***
input int            Inp_STO_KPeriod= 5;        // STO: K period
input int            Inp_STO_DPeriod= 3;        // STO: D period
input int            Inp_STO_Slowing= 3;        // STO: Slowing
input int            Inp_STO_Level1 = 25.0;     // STO: Value Level #1
input double         Inp_STO_Level2 = 75.0;     // STO: Value Level #2
***
//--- create handle of the indicator iCustom
   handle_iStochastic=iCustom(m_symbol.Name(),Period(),"Stochastic Custom",
                              Inp_STO_KPeriod,Inp_STO_DPeriod,Inp_STO_Slowing,Inp_STO_Level1,Inp_STO_Level2);
//--- if the handle is not created 
   if(handle_iStochastic==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d",
                  m_symbol.Name(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
     }
 
Vladimir Karputov:

You will have to.

For example, I needed theStochastic indicator todisplay levels that can be set from the Expert Advisor -Stochastic Customappeared there:

When a standard iStochastic is called from an EA, this standard indicator will ALWAYS have two levels displayed in the visual test mode: 80.0 and 20.0. This situation is not suitable if the Expert Advisor uses other levels (for example, 75.0 and 25.0).

Therefore, the standard indicator has been modified: the Stochastic Custom indicator has two new parameters:


Example of calling this indicator from an Expert Advisor:

Thanks for the detailed answer,

is there any difference in speed, memory and CPU load, between built-in indicators and external ones?
I have a multisymbol and multitimescale Expert Advisor, which is extremely loaded.
i.e. does connecting via iCustom make a difference?

 
I am trying to write an Expert Advisor MA crossing, but in the test on the chart there are deals that are not in the log, I can not understand where they came from ?

 
topmett:
I am trying to write an Expert Advisor MA crossing, but when I test it on a chart there are trades that are not in the log, I can't figure out where they came from ?

You better check the history of trades and orders. Not all Print calls may get to the journal.