Category Other  Published on 25/09/2018

SwingFish Helper [Global TP]

Description

this is a Helper Ago to use in cTrader directly.

################################################################################
There is a New Version Avaiable with A LOT more Features !
download the new version here https://swingfish.trade/swingfish-helper (It's FREE)


New Version:
does Auto Hedge (equity based) auto take profits, display vaues of positions and much more
take profit global and equity based and a few other things like time and position volatility.
takes capital as well into consideration.

################################################################################

what it does is very simple: it compares the Equity with the Profit target you have set.

once the target is reached it will close ALL trades from All pairs and delete also ALL Pending orders.

if you do as an example do hedge instead of stop loss .. and close a hedge position, you just type the cost of the hedge trade (loss in your history) and set the bot to take profit at that price to eliminate the cost of your hedge.

you may likely have other hedge orders pending so you can step away without being glued to the chart.

1 of 2 things will happen: 1 your hedge will be filled and future loss is limited, or the positions combined reach the target and the algo will delete all orders close all trades and then stop itself.

let me know if there some other things may be of use in the Take-profit realm ;) 

https://swingfish.trade/swingfish-helper

 


ToDo:
    - use percentages or absolute targets
    - switch between ALL and the current Product/Pair
 
Lizense:
    Creative Common - you are REQUIRED to mention me or swingfish.trade if you re-publish this.
 
 
get Updates:
    - https://ctdn.com/algos/cbots/show/1664
    - http://swingfish.trade/tools
 
Changes:
    - remove cents display
    - better text and display equity
    - reset equity OnTick
    - bug in calculating the total equity
    - use net instead of Gross
    - convert api names to new version

 


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

/*
GlobalTP+ 0.22.1

Mario Hennenberger http://www.swingfish.trade/tools

terminates ALL open Positions and delete ALL Pending Orders of the Net Profit is reached

ToDo:
    - use percentages or absolute targets
    - switch between ALL and the current Product/Pair

Lizense:
    Creative Common - you are REQUIRED to mention me or swingfish.trade if you re-publish this.


get Updates:
    - https://ctdn.com/algos/cbots/show/1664
    - http://swingfish.trade/tools

Changes:
    - remove cents display
    - better text and display equity
    - reset equity OnTick
    - bug in calculating the total equity
    - use net instead of Gross
    - convert api names to new version
*/

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class GlobalTPPlus : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double CashTarget { get; set; }

        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            closeWhenTarget(CashTarget);
            ChartObjects.DrawText("CashTarget0", "Target: " + CashTarget + " " + Account.Currency + " | Dist: " + Math.Round((Account.Equity - Account.Balance - CashTarget), 0) + " | Equity: " + Math.Round((Account.Equity), 0), StaticPosition.TopLeft);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
            // will put a log here .. need to figure out how that works 
        }


        private void closeWhenTarget(double target)
        {
            double profit = 0;

            foreach (Position p in Positions)
                profit += p.NetProfit;

            // when profit is negative, we're done
            if (profit < target)
                return;

            // target is reached 
            foreach (Position p in Positions)
                ClosePosition(p);

            //  close all pending orders
            foreach (PendingOrder o in PendingOrders)
                CancelPendingOrder(o);


            // go sleep
            Stop();
        }
    }
}


swingfish's avatar
swingfish

Joined on 25.06.2016

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Global TP+.algo
  • Rating: 0
  • Installs: 1379
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
VI
visapoy421 · 1 year ago

A while the remarks are approved at promptly and sometime the comment predicted as comment spam or moderate it for approval. Do comply with blogs are very really hard to uncover and won’t be able to manage to reduce that our responses turn into spam and unapproved. There are several points.tamilrockers tamil movie download

NO
noman12bhatti · 1 year ago

[...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]… ICT Resources

PE
pelakev722 · 1 year ago

Hey there! Someone in my Myspace group shared this website with us so I came to take a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers! Excellent blog and outstanding style and design.شروحات