Category Other  Published on 23/11/2021

auto close all position after profit

Description
If you want to close all positions after profit, this is for you. All you need to do is rewrite how much money you need before automating your positions. Cbot closes all positions, including pending orders!

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 closeallpositionafterprofit : Robot
    {
        protected override void OnTick()
        {
            if (Account.Equity - Account.Balance > 10)
            {
                foreach (var position in Account.Positions)
                {
                    Trade.Close(position);

                }

                foreach (var order in PendingOrders)
                {
                    CancelPendingOrder(order);
                }
            }

        }
    }
}





M.
m.kepka.90

Joined on 03.11.2021

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: close all position after profit.algo
  • Rating: 0
  • Installs: 2007
  • Modified: 23/11/2021 10:15
Comments
Log in to add a comment.
XC
xcxc75802 · 2 years ago

Hello, Neat post. There is an issue along with your site in web explorer, could test this¡K IE still is the marketplace leader and a huge portion of other people will miss your magnificent writing because of this problem.  바카라사이트

OM
Omega · 2 years ago

Hi,

I'm interested in this bot, question, if I'm running a 4 currencies all with different dollar value profit targets can I set this robot to each of the charts and set it up for each different currencies separately?