Category Other  Published on 20/06/2024

Custom Window Plugins

Description

Example used in


using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Plugins
{
    [Plugin(AccessRights = AccessRights.None)]
    public class CustomWindowPlugIn : Plugin
    {
        private Button _buttonAddTakeProfit;
        private Window _window;
        
        protected override void OnStart()
        {
            _buttonAddTakeProfit = new Button
            {
                BackgroundColor = Color.SeaGreen,
                Height = 50,
                Text = "Add Take Profit"
            };
            
            _window.Child = _buttonAddTakeProfit;
            _window.Show();
            _buttonAddTakeProfit.Click += AddTakeProfit;
        }
    
        private void AddTakeProfit(ButtonClickEventArgs args)
        {
            foreach (var position in Positions)
            {
                if (position.TakeProfit is null)
                {
                    position.ModifyTakeProfitPips(20);
                }
            }
        }

        protected override void OnStop()
        {
            // Handle Plugin stop here
        }
    }        
}

Spotware's avatar
Spotware

Joined on 23.09.2013

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Custom Window Plug In_withSourceCode.algo
  • Rating: 0
  • Installs: 31
Comments
Log in to add a comment.
No comments found.