Category Other  Published on 06/01/2022

Profit Pips Today


using System;
using System.Linq;
using cAlgo.API;
using System.Text;


namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None, TimeZone = TimeZones.NorthAsiaStandardTime)]
    public class ProfitPipsToday : Indicator
    {
        [Parameter("Profit", DefaultValue = true)]
        public bool _profit { get; set; }

        [Parameter("pips", DefaultValue = true)]
        public bool _pips { get; set; }

        [Parameter("Currency Symbol", DefaultValue = "$")]
        public string Csymbol { get; set; }

        //you can find currency Symbol here ==> https://justforex.com/education/currencies

        [Parameter("Color", DefaultValue = "Black")]
        public string tColor { get; set; }

        //you can find color name here ==> https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.colors?view=netcore-3.1

        [Parameter("VerticalAlignment", DefaultValue = VerticalAlignment.Top)]
        public VerticalAlignment VerticalAlignment { get; set; }

        [Parameter("HorizontalAlignment", DefaultValue = HorizontalAlignment.Right)]
        public HorizontalAlignment HorizontalAlignment { get; set; }

        [Parameter("Visible", DefaultValue = true)]
        public bool _visible { get; set; }

        protected override void Initialize()
        {
        }

        public override void Calculate(int index)
        {
            if (_visible)
            {
                var h = History.ToList();
                var p = Positions.ToList();

                double NPT = h.Where(t => t.ClosingTime.DayOfYear == Time.DayOfYear).Sum(t => t.NetProfit);
                double PIT = h.Where(t => t.ClosingTime.DayOfYear == Time.DayOfYear).Sum(t => t.Pips);



                StringBuilder sb = new StringBuilder();
                if (_profit)
                {
                    if (NPT != 0)
                    {
                        sb.AppendFormat(Csymbol + "{0:N}", NPT);
                        sb.AppendLine();
                    }
                }
                if (_pips)
                {
                    if (PIT != 0)
                    {
                        sb.AppendFormat("{0:N}pips", PIT);
                    }
                }
                Chart.DrawStaticText("Today", sb.ToString(), VerticalAlignment, HorizontalAlignment, tColor);
            }
        }

    }
}


yomm0401's avatar
yomm0401

Joined on 11.04.2020

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Profit Pips Today.algo
  • Rating: 0
  • Installs: 2800
  • Modified: 13/10/2021 09:55
Comments
Log in to add a comment.
KE
kendallsmith0900 · 2 years ago

I was facing a few issues for which I thankfully found this algo. It has made it pretty easy and clear in my head. I have recently started supplying custom patches in UK that were giving me a few troubles with calculations. 

LL
llumhar · 2 years ago

Within a few seconds, the arlo login page appears. Provide the email address and password that you used while creating the ‘My Arlo Account’. Click ‘Login’. If you’re facing the trouble, visit our site to know more about arlo login.  http://essaypapers.reviews/

CL
clyd001 · 2 years ago

Not sure how to open the my.arlo.com login page? If so, then worry not as we will tell you. In the address bar of the web browser enter my.arlo.com web address and hit the enter key. Within a few seconds, the arlo login page appears. Provide the email address and password that you used while creating the ‘My Arlo Account’. Click ‘Login’. If you’re facing the trouble, visit our site to know more about arlo login. 

 

yomm0401's avatar
yomm0401 · 4 years ago

If the calculation period does not match, please adjust the time zone.

 

TimeZone = TimeZones."Inset your timezone"