Category Other  Published on 21/11/2016

History Dashboard, TRX History Analysis

Description

My Fellow traders, both amateurs and professional ones.


I fully understand that you are TRADERS and as such, you are by no mean required to be a magician with the ability to manipulate small or huge amounts of data.

I understand that many times, you are overwhelmed by questions like, what was my profit during this and that period, how many orders did put in, how many pips did I gain or lose, and much much more.

 

As a Live FX trader myself, I have often used other websites for preparing statistics of my Demo accounts, but for my live account and strategy, I decided this was not an option anymore.

 

I am a fairly good user of Excel and let's say that Pivot Tables are one of my favourite tools for the data analysis, but many times what I just needed was a quick glance straight on cTrader or Calgo.

 

Therefore, I created my "History Dashboard" cbot, which does what I needed it to give me a glance on my trading history.

It tells me about a specific period, about my specific pairs, my specific label, how many sell/buy/total orders I had, net profit, pips gained and I can leave it running so it will refresh anytime a new order is closed. I believe you already have a high-resolution screen, as the information can be a lot.

https://www.bregu.al

 

 

https://www.bregu.al

 

 

https://www.bregu.al

 

Please drop me an email, or use the contact page from my blog, if you are interested into embedding more pairs into the cbot.

Hope you will enjoy and use this cbot

 

Oltion Bregu

https://www.bregu.al

 

 

 

 


using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class HISTORY_DashBoard : Robot
    {

        [Parameter("Komenti_1", DefaultValue = "Cakalli")]
        public string Komenti_1 { get; set; }

        [Parameter("Timer Sec", DefaultValue = 5, MinValue = 0)]
        public int TimerSec { get; set; }

        //      [Parameter("Komenti_2", DefaultValue = "Urithi")]
        //      public string Komenti_2 { get; set; }

        //      [Parameter("Komenti_3", DefaultValue = "Hiena")]
        //      public string Komenti_3 { get; set; }

        [Parameter("Start Year", DefaultValue = 2016, MinValue = 2010, MaxValue = 2025)]
        public int StartYear { get; set; }

        [Parameter("Start Month", DefaultValue = 11, MinValue = 1, MaxValue = 12)]
        public int StartMonth { get; set; }

        [Parameter("Start Day", DefaultValue = 7, MinValue = 1, MaxValue = 31)]
        public int StartDay { get; set; }

        [Parameter("End Year", DefaultValue = 2016, MinValue = 2016, MaxValue = 2025)]
        public int EndYear { get; set; }

        [Parameter("End Month", DefaultValue = 7, MinValue = 1, MaxValue = 12)]
        public int EndMonth { get; set; }

        [Parameter("End Day", DefaultValue = 7, MinValue = 1, MaxValue = 31)]
        public int EndDay { get; set; }


        private int TotalTrades;
        private int BuyTrades;
        private int SellTrades;

        private double TotalLots;
        private double BuyLots;
        private double SellLots;

        private double TotalProfit;
        private double BuyProfit;
        private double SellProfit;

        private double TotalPips;
        private double BuyPips;
        private double SellPips;

        private int TotalTXPeriod;
        private double TotalLotPeriod;
        private double TotalProfitPeriod;
        private double TotalPipsPeriod;

        private DateTime startdate;
        private DateTime stopdate;





        protected override void OnStart()
        {

            Timer.Start(TimerSec);

            startdate = new DateTime(StartYear, StartMonth, StartDay);
            stopdate = new DateTime(EndYear, EndMonth, EndDay);

            if (startdate > Server.Time)
            {
                Print("Vendosni nje date fillimi te rregullt");
                Stop();
            }
            if (stopdate < startdate)
                stopdate = Server.Time;

            Print("Hope you will enjoy this dashboard and use it everyday");
            Print("please visit us @   https://www.bregu.al   and contact me directly form the contact page");
            Print("If want to know more about this dashboard or think that something can be improved, ");



            Vizato_Info(1, 2);
            Vizato_HEADER(3);

            //    Vizato_Dashboard(2, 3, "AUDCHF", Komenti_1);
            //    Vizato_Dashboard(2, 4, "AUDJPY", Komenti_1);
            //    Vizato_Dashboard(2, 5, "AUDUSD", Komenti_1);
            //    Vizato_Dashboard(2, 6, "CADJPY", Komenti_1);
            //    Vizato_Dashboard(2, 7, "CHFJPY", Komenti_1);
            //    Vizato_Dashboard(2, 8, "EURAUD", Komenti_1);
            //    Vizato_Dashboard(2, 9, "EURCAD", Komenti_1);
            //    Vizato_Dashboard(2, 10, "EURGBP", Komenti_1);
            //    Vizato_Dashboard(2, 11, "EURJPY", Komenti_1);
            //    Vizato_Dashboard(2, 12, "EURUSD", Komenti_1);
            //    Vizato_Dashboard(2, 13, "GBPAUD", Komenti_1);
            //    Vizato_Dashboard(2, 14, "GBPCHF", Komenti_1);
            //    Vizato_Dashboard(2, 15, "GBPJPY", Komenti_1);
            //    Vizato_Dashboard(2, 16, "GBPUSD", Komenti_1);
            //    Vizato_Dashboard(2, 17, "NZDJPY", Komenti_1);
            //    Vizato_Dashboard(2, 18, "NZDUSD", Komenti_1);
            //    Vizato_Dashboard(2, 19, "USDCAD", Komenti_1);
            //    Vizato_Dashboard(2, 20, "USDCHF", Komenti_1);
            //    Vizato_Dashboard(2, 21, "USDJPY", Komenti_1);
            //    Vizato_Dashboard(2, 22, "XAUUSD", Komenti_1);



        }


        protected override void OnTimer()
        {
            // Put your core logic here

            TotalTXPeriod = 0;
            TotalLotPeriod = 0;
            TotalProfitPeriod = 0;
            TotalPipsPeriod = 0;

            Vizato_Dashboard(2, 23, "AUDCHF", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 4, "AUDJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 5, "AUDUSD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 6, "CADJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 7, "CHFJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 8, "EURAUD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 9, "EURCAD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 10, "EURGBP", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 11, "EURJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 12, "EURUSD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 13, "GBPAUD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 14, "GBPCHF", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 15, "GBPJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 16, "GBPUSD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 17, "NZDJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 18, "NZDUSD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 19, "USDCAD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 20, "USDCHF", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 21, "USDJPY", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Dashboard(2, 22, "XAUUSD", Komenti_1);

            TotalTXPeriod = TotalTXPeriod + TotalTrades;
            TotalLotPeriod = TotalLotPeriod + TotalLots;
            TotalProfitPeriod = TotalProfitPeriod + TotalProfit;
            TotalPipsPeriod = TotalPipsPeriod + TotalPips;

            Vizato_Totals(2, 26);


        }


        protected void Llogarit_Vizato_Vlerat(string Komenti, string Monedha)
        {

            var PozHistMonBuy = History.FindAll(Komenti, MarketData.GetSymbol(Monedha), TradeType.Buy);
            var PozHistMonSell = History.FindAll(Komenti, MarketData.GetSymbol(Monedha), TradeType.Sell);

            TotalTrades = 0;
            BuyTrades = 0;
            SellTrades = 0;

            TotalLots = 0;
            BuyLots = 0;
            SellLots = 0;

            TotalProfit = 0;
            BuyProfit = 0;
            SellProfit = 0;

            TotalPips = 0;
            BuyPips = 0;
            SellPips = 0;

            foreach (var histbuy in PozHistMonBuy)
            {
                if (histbuy.ClosingTime > startdate && histbuy.ClosingTime < stopdate)
                {
                    BuyTrades = BuyTrades + 1;
                    BuyLots = BuyLots + histbuy.Quantity;
                    BuyProfit = BuyProfit + histbuy.NetProfit;
                    BuyPips = BuyPips + histbuy.Pips;
                }
            }

            foreach (var histsell in PozHistMonSell)
            {
                if (histsell.ClosingTime > startdate && histsell.ClosingTime < stopdate)
                {
                    SellTrades = SellTrades + 1;
                    SellLots = SellLots + histsell.Quantity;
                    SellProfit = SellProfit + histsell.NetProfit;
                    SellPips = SellPips + histsell.Pips;
                }
            }

            TotalTrades = BuyTrades + SellTrades;
            TotalLots = BuyLots + SellLots;
            TotalProfit = BuyProfit + SellProfit;
            TotalPips = BuyPips + SellPips;

        }

        private void Vizato_HEADER(int NLs)
        {
            var ngjyra = Colors.SteelBlue;

            string String_2 = "Header";

            ChartObjects.DrawText(String_2, my_NL(NLs) + "SYMBOL" + my_Tabs(1) + "B TRX" + my_Tabs(2) + "B Qty" + my_Tabs(2) + "B Net" + my_Tabs(2) + "B Pip" + my_Tabs(2) + "S TRX" + my_Tabs(2) + "S Qty" + my_Tabs(2) + "S Net" + my_Tabs(2) + "S Pip" + my_Tabs(2) + "T TRX" + my_Tabs(2) + "T Qty" + my_Tabs(2) + "T Net" + my_Tabs(2) + "T Pip", StaticPosition.TopLeft, ngjyra);

        }

        private void Vizato_Info(int NLs, int TABS)
        {
            var ngjyra = Colors.White;

            string String_3 = "Info";

            ChartObjects.DrawText(String_3, my_NL(NLs) + "Visit us @  https://www.bregu.al  - History Status Report   - from:  " + startdate + "  to  " + stopdate, StaticPosition.TopLeft, ngjyra);

        }


        private void Vizato_Dashboard(int TABS, int NLs, string Monedha, string Komenti)
        {

            Llogarit_Vizato_Vlerat(Komenti, Monedha);

            var ngjyra = Colors.White;

            string String_4 = "Dashboard_line" + Monedha;
            string String_5 = "Parms" + Monedha;

            ChartObjects.DrawText(String_4, my_NL(NLs) + Monedha, StaticPosition.TopLeft, ngjyra);

            ChartObjects.DrawText(String_5, my_NL(NLs) + my_Tabs(TABS) + BuyTrades + my_Tabs(TABS) + BuyLots + my_Tabs(TABS) + Math.Round(BuyProfit, 2) + my_Tabs(TABS) + Math.Round(BuyPips, 2) + my_Tabs(TABS) + SellTrades + my_Tabs(TABS) + SellLots + my_Tabs(TABS) + Math.Round(SellProfit, 2) + my_Tabs(TABS) + Math.Round(SellPips, 2) + my_Tabs(TABS) + TotalTrades + my_Tabs(TABS) + TotalLots + my_Tabs(TABS) + Math.Round(TotalProfit, 2) + my_Tabs(TABS) + Math.Round(TotalPips, 2), StaticPosition.TopLeft, ngjyra);

        }

        private void Vizato_Totals(int TABS, int NLs)
        {

            var ngjyra = Colors.SteelBlue;

            string String_6 = "Totals";

            ChartObjects.DrawText(String_6, my_NL(NLs) + "Period:  Total TRX = " + TotalTXPeriod + my_Tabs(TABS) + "Total Lots = " + TotalLotPeriod + my_Tabs(TABS) + "Total Profit = " + TotalProfitPeriod + my_Tabs(TABS) + "Total Pips = " + TotalPipsPeriod, StaticPosition.TopLeft, ngjyra);



        }


        static string my_NL(int n)
        {
            return new String('\n', n);
        }

        static string my_Tabs(int n)
        {
            return new String('\t', n);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}


95
9544315

Joined on 29.12.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: HISTORY_DashBoard.algo
  • Rating: 0
  • Installs: 2328
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.