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:
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
}
}
}
choudhym01
Joined on 14.01.2021
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Pending List Alert.algo
- Rating: 0
- Installs: 1193
- Modified: 04/05/2022 13:44
Comments
Using this cBot will alert you via email if a certain number of your pending orders are a certain number of pips away. drift hunters
Thanks a lot for sharing a piece of wonderful information. This is an amazing article. Keep posting... Did you see these Happy Diwali Wishes in Hindi & Love Quotes in Hindi?