Replies

PanagiotisCharalampous
13 May 2020, 14:13

Hi Symposium,

Here it is

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.Where(x => x.SymbolName == Symbol.Name))
                ClosePosition(p);

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


            // go sleep
            Stop();
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 14:08

Hi goharlkhilji,

Can you please tell us the strategy name and post some screenshots showing that the position is closed on the strategy provider's account but still open on the subaccounts?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 13:00

Hi lordyy,

Here it is.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 12:12

Hi morassut.s,

I cannot reproduce such a behavior. Can you share a video with us demonstrating this so that we can see the exact steps you follow and see what you are seeing as well?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 11:58

Hi morassut.s,

I deleted it because it was not a suggestion but a question. Please post it in the correct topic.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 11:48

Hi share.axp,

There in no ETA for this feature at the moment. Demo account based strategies do not allow charging fees.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 11:46

Hi Artur,

Can you please send us your password at community@spotware.com so that we can reproduce this issue?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 11:44

Hi stannekuba,

No this is not possible. There is no such layout available.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 10:05

Hi ZuniSoft,

Just use the Group attribute. See below an example

        [Parameter("Enabled", Group = "Take Profit 1", DefaultValue = false)]
        public bool TakeProfit1Enabled { get; set; }

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 10:03

Hi Valter,

If you need somebody to develop this cBot for you, you can contact a Consultant or post a Job.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 10:00

Hi Marek,

cAlgo converters are not managed by Spotware hence we cannot help you much with this.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:57

Hi there,

Pepperstone does not offer cTrader Copy at the moment.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:55

Hi ergun,

No we do not have a public timeline available.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:49

Hi there,

Can you please provide us with more information? We need

1) Your trading account number

2) The name of the strategy you are trying to follow.

3) Some screenshots demonstrating the problem and the messages you receive.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:44

Hi share.axp,

There is no such option at the moment but we plan to add this in a future update.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:39

Hi ergun,

No there is no way at the moment. We will add this feature in a future update.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:37 ( Updated at: 13 May 2020, 10:09 )

Hi morassut.s,

Please post this question in the correct topic. I will delete this thread in a while.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

PanagiotisCharalampous
13 May 2020, 09:34

Hi rgasch,

Thanks. To fix this just mark the ColorData parameter with an OutputAttribute. See below

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class TestIndicator : Indicator
    {

        private MovingAverage _ma;

        [Parameter("MA Period", DefaultValue = 34)]
        public int maPeriod { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Weighted)]
        public MovingAverageType MAType { get; set; }

        [OutputAttribute("Moving Average", LineColor = "Red", LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries MaResult { get; set; }

        [OutputAttribute("Color Data")]
        public IndicatorDataSeries ColorData { get; set; }



        protected override void Initialize()
        {
            _ma = Indicators.MovingAverage(Bars.ClosePrices, maPeriod, MAType);
        }


        public override void Calculate(int index)
        {
            var color = Color.White;
            var open = Bars.OpenPrices[index];
            var high = Bars.HighPrices[index];
            var low = Bars.LowPrices[index];
            var close = Bars.ClosePrices[index];

            var maValue = _ma.Result[index];
            MaResult[index] = maValue;

            ColorData[index] = open > close ? -1 : 1;
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
12 May 2020, 15:12

Hi rgasch,

To advise further we will need a workable version of the indicator that we can use.

Best Regards,

Panagiotis 

Join us on Telegram

 

 


@PanagiotisCharalampous

PanagiotisCharalampous
12 May 2020, 15:06

Hi testpossessed,

A workaround is to use a timeframe as a parameter and choose Renko bars from there. See below and example

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 NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public TimeFrame Parameter { get; set; }

        protected override void OnStart()
        {
            var bars = MarketData.GetBars(Parameter);
            Print(bars.Count);
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous