email alert + break even

Created at 19 May 2023
EM

Emilio90

Joined 06.12.2020

Status

Closed


Budget

15.00 EUR


Payment Method

Direct Payment

Job Description

i would like to add an email alert every time a position is opened, and i would like to add a break even.

my cbot is the following:

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 ADXCrossingBot : Robot
    {
        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.01, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }


        [Parameter("ADX Periods", Group = "ADX", DefaultValue = 20, MinValue = 1, Step = 1, MaxValue = 1000)]
        public int adxPeriods { get; set; }

        
        [Parameter("Take Profit", Group = "Risk", DefaultValue = 150, MinValue = 0, Step = 1, MaxValue = 1000)]
        public int takeProfit { get; set; }

        [Parameter("Stop Loss", Group = "Risk", DefaultValue = 150, MinValue = 0, Step = 1, MaxValue = 1000)]
        public int stopLoss { get; set; }


        private DirectionalMovementSystem adx;
        private double volumeInUnits;
        


        protected override void OnStart()
        {
            volumeInUnits = Symbol.QuantityToVolumeInUnits(Quantity);
            adx = Indicators.DirectionalMovementSystem(adxPeriods);
          
        }

        protected override void OnBar()
        {
            if (Positions.Count == 0)
            {
                if (adx.DIMinus.Last(3) < adx.DIPlus.Last(3) && adx.DIMinus.Last(1) > adx.DIPlus.Last(1) && adx.DIMinus.LastValue >                     adx.DIPlus.LastValue)
                {
                            
                            ExecuteMarketOrder(TradeType.Sell, SymbolName, volumeInUnits, "ADX Sell", stopLoss, takeProfit);
                }
               
                
                else if (adx.DIPlus.Last(3) < adx.DIMinus.Last(3) && adx.DIPlus.Last(1) > adx.DIMinus.Last(1) && adx.DIPlus.LastValue > adx.DIMinus.LastValue)
                {
                            
                            ExecuteMarketOrder(TradeType.Buy, SymbolName, volumeInUnits, "ADX Buy", stopLoss, takeProfit);
                }
                
            }
        }
        
         
        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Comments
PanagiotisChar's avatar
PanagiotisChar · 1 year ago

Hi there,

We can help you with your project. Feel free to reach out to me at development@clickalgo.com

Please take some time and read the frequently asked questions as well as why you should choose us to help you with your project

JosephTradingbot's avatar
JosephTradingbot · 1 year ago

Hi, I can do that for you.

with several years of experience in programming and forex analysis and trading.

Email: joseph.tradingbot@gmail.com

Telegram: @iamjosepe