Pending Alert Email Notification free

by choudhym01 in category Other at 04/05/2022
Description

Most traders make use of Pending Orders. A trader may potientally have several pendings set. However due to market uncertainty there is potiental risk of several pendings getting triggered at the same time. This potientally leads to over leverage with mismanagement of risk. 

Therefore use of this cBot will notify through email when more than one of your pendings are a certain number of pips away. Distance can be adjusted via parameters, default value is set to 30  pips. A very useful algorithm to run in the background. 

To validate your email through ctrader please follow these simple instructions: 

 

Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
´╗┐using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class PendingListAlert : Robot
    {
        [Parameter(DefaultValue = 30)]
        public int Distance { get; set; }

        [Parameter("Email Address", DefaultValue = "insertEmailAddress@email.com")]
        public string Email { get; set; }

        int Counter = 0;
        bool EmailSent = true;

        protected override void OnStart()
        {

            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            // Put your core logic here
            foreach (PendingOrder order in Account.PendingOrders)
            {
                var orderSymbol = order.SymbolName;
                var orderName = Symbols.GetSymbol(orderSymbol);
                var distance = Math.Abs((orderName.Bid - order.TargetPrice) / orderName.PipSize);
                if (distance <= Distance)
                {
                    Counter += 1;
                }
                Print("{0}", order);
                Print(distance);

            }


            if (Counter >= 2 & EmailSent == true)
            {
                Notifications.SendEmail(Email, Email, "Pending List", "Please attain to the pending list and adjust volumes, There are more than two pendings reaching your desired distance");
                EmailSent = false;
                //you would then have to restart this bot again after. 


            }
            Counter = 0;
        }

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

kennedystewart341893 - May 05, 2022 @ 13:03

I am a newbie and am starting to learn about this part. The knowledge you share is really helpful and I am very grateful for it drift boss is the website i wanted to make because i love games and i wanted to create a simple interface

0