History trades list

Created at 10 Sep 2014, 19:50
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
IT

itaiophir

Joined 19.04.2014

History trades list
10 Sep 2014, 19:50


Hello,

I'm trying to count the amount of losing trades from the the start of the day.

As it seems, the history method is unable to fetch the total list of trades.

Doe's someone have an idea for this problem?

Thanks!

 

            string lastTradeDate = "";
            double lastTradeNetWorth = 0;
            int currentDaylostTrades = 0;
            int  DailyLossesLimitAmount = 2;

            if (History.Count > 0)
            {
                if (History.FindLast(positionName, Symbol) != null)
                {
                    lastTradeDate = History.FindLast(positionName, Symbol).EntryTime.Date.ToShortDateString();

                    lastTradeNetWorth = History.FindLast(positionName, Symbol).NetProfit;


                    if (lastTradeDate == MarketSeries.OpenTime.LastValue.ToShortDateString())
                    {
                        int historyLength = History.FindAll(positionName, Symbol).Length;
                        for (int i = 0; i < historyLength; i++)
                        {

                            if ( currentDaylosingTrades> DailyLossesLimitAmount)
                            {
                                break;
                            }

                            if (History.FindAll(positionName, Symbol)[i].EntryTime.ToShortDateString() == MarketSeries.OpenTime.LastValue.ToShortDateString())
                            {
                                if (History.FindAll(positionName, Symbol)[i].NetProfit < 0)
                                {
                                    Print(History.FindAll(positionName, Symbol)[i].PositionId);
                                     currentDaylosingTrades++;
                                }
                            }
                        }
                    }

                }
}

 

 


@itaiophir
Replies

itaiophir
10 Sep 2014, 20:04

Solved

Never mind, solved!


@itaiophir