Topics
Replies

lgwsyqnfr
24 Mar 2019, 13:43 ( Updated at: 21 Dec 2023, 09:21 )

RE:

2bnnp said:

Sorry missed the part with the custom indicator.

First you need to add a reference for the custom indicator to call it in your bot.

 

Then you can call it with Indicators.GetIndicator<CustomIndicatorHere>(Param1, Param2, Param3)

Thanks your help. but i still get it.

One of the reasons why MT4 and 5 are so popular is that MQL has detailed practical application examples, so, anyone can write its own program according to the examples. CTrader does very poorly in this respect, after all, most traders are not professional programmers. Therefore, cTrader has a long way to go before it can be popularized in the market.


@lgwsyqnfr

lgwsyqnfr
23 Mar 2019, 12:08

           double buylots =0, selllots =0;

           foreach (var position in Positions)
            {
                if (position.SymbolCode == Symbol.Code)
                {
                    double lot = position.VolumeInUnits;

                    if (position.TradeType == TradeType.Buy)
                    {
                        buylots += lot;
                    }

                    if (position.TradeType == TradeType.Sell)
                    {
                        selllots += lot;
                    }
                }
            }

 


@lgwsyqnfr

lgwsyqnfr
23 Mar 2019, 12:05

I am newer cBot from mql. Ithink you can do so:

foreach (var position in Positions)
            {
                if (position.SymbolCode == Symbol.Code)
                {
                    double lot = position.VolumeInUnits;

                    if (position.TradeType == TradeType.Buy)
                    {
                        buylots += lot;
                    }

                    if (position.TradeType == TradeType.Sell)
                    {
                        selllots += lot;
                    }
                }
            }


@lgwsyqnfr

lgwsyqnfr
23 Mar 2019, 06:49

What currency? all pairs ?


@lgwsyqnfr