AW CP Step free

by khoshroomahdi in category Other at 20/08/2021
Description

this bot close all position and cancel all order after get step profit percent.

step calculate by ((equity/balance)-1)*100

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;


namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class AWCPStep : Robot
    {


        [Parameter("Take Profit Percent", DefaultValue = 3.1)]
        public double tpPercent { get; set; }

        protected override void OnStart()
        {

        }

        protected override void OnTick()
        {



            //calc STEP Percent Profit

            double StepPercent = ((Account.Equity / Account.Balance) - 1) * 100;

            foreach (var position in Positions)
            {
                if (StepPercent > tpPercent)
                {
                    ClosePositionAsync(position);
                }

            }

            foreach (var order in PendingOrders)
            {
                if (StepPercent > tpPercent)
                {
                    CancelPendingOrder(order);
                }
            }

        }

    }


}

Comments
0