Topics
30 Aug 2024, 11:09
 0
 163
 0
15 Aug 2024, 13:12
 0
 151
 0
23 Jul 2024, 17:30
 0
 233
 0
02 Jun 2024, 00:49
 2
 362
 3
14 Apr 2024, 00:05
 359
 4
15 Jan 2024, 06:08
 482
 3
Replies

Waxy
12 Mar 2019, 19:48

Hello Panagiotis,

This may get the default color specified using LineColor = Color, however, if the user changes the color or line-style this is not possible to retrieve, it should be able to get the properties the user has changed, not the one hard coded, I think this is a bug.

The code below prints Red despite I'm changing it to various colors.

Thanks for your support,

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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ReadOutputAttribute : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main", LineColor = "Red")]
        public IndicatorDataSeries Result { get; set; }

        Color _myColor;

        protected override void Initialize()
        {

        }

        public override void Calculate(int index)
        {
            PropertyInfo[] props = typeof(ReadOutputAttribute).GetProperties();

            foreach (PropertyInfo prop in props)
            {
                object[] attrs = prop.GetCustomAttributes(true);
                foreach (object attr in attrs)
                {
                    OutputAttribute outputAttr = attr as OutputAttribute;
                    if (outputAttr != null)
                    {
                        if (outputAttr.LineColor != null)
                        {
                            Print(outputAttr.LineColor.ToString());
                            _myColor = Color.FromName(outputAttr.LineColor.ToLower());
                        }
                        else
                            Print("Line Color is null");
                    }
                }
            }

            Chart.DrawStaticText("Text", "This text changes color", VerticalAlignment.Top, HorizontalAlignment.Right,
                _myColor);
        }
    }
}



 


@Waxy

Waxy
07 Mar 2019, 07:01

Thanks for your hard work Spotware,

I have questions,

Why this feature works with custom enums being parametrizable, but not built-in enums like HorizontalAlignment, and others? I hope is available soon also.
Note: Currently I can build a custom enum and then cast to a built-in enum, that's what I can do for now.

Also, will you wait for 3.6 before launching 3.5 as the official version?

Thank you

 


@Waxy

Waxy
13 Nov 2018, 02:08

Hello Panagiotis,

Sadly, the problem just faded away without any explanation, tho I did re-install cTrader and Visual Studio, the issue persisted. It suddenly it works now, how odd, I must have done something, or the software must have received an update.

It didn't have anything to do with custom robots, because it was occurring even with a new bot with a default code.

I'll use this topic if the issue shows up again in the future.


Thanks for your support,


@Waxy

Waxy
10 Nov 2018, 04:23

Also having this message from Migration Report
 

New cBot (3)\New cBot (3).csproj: The application which this project type is based on was not found. Please try this link for further information: http://go.microsoft.com/fwlink/?LinkID=299083&projecttype=DD87C1B2-3799-4CA2-93B6-5288EE928820

@Waxy

Waxy
06 Sep 2018, 20:25

Hello Panagiotis, 

Thanks for your response, hope Spotware changes its mind in the future, I think this is a good feature to have, a good example would be what Microsoft does with Visual Studio

Best Regards,


@Waxy

Waxy
23 Jul 2018, 22:01

Hello Spotware,

This looks great and will help us develop better tools for trades.

I have two requests I haven't seen but been asking for it.

  1. Opacity for objects, this is important because chart data is sometimes blocked by these objects.
  2. Have an option to have objects drawn on backtests, but interactivity disabled.

Thanks for your continuous work.


@Waxy

Waxy
07 Jul 2018, 16:18

All you had to do is to change "Buy" for "Sell" and update the price to have both

For Buy

//If there is not a buystop order place a buy stop order
if (PendingOrders.Count(item => item.OrderType == PendingOrderType.Stop && item.TradeType == TradeType.Buy) == 0)
{
    PlaceStopOrder(TradeType.Buy, Symbol, 1000, Symbol.Ask + 100 * Symbol.PipSize);
}

 

For Sell

//If there is not a buystop order place a buy stop order
if (PendingOrders.Count(item => item.OrderType == PendingOrderType.Stop && item.TradeType == TradeType.Sell) == 0)
{
    PlaceStopOrder(TradeType.Sell, Symbol, 1000, Symbol.Bid - 100 * Symbol.PipSize);
}

 


@Waxy

Waxy
02 Jul 2018, 07:46

	double[] d = new double[] {1,2,3,4,5};
	float[] f = d.Select(x => (float)x).ToArray();

 


@Waxy

Waxy
01 Jul 2018, 07:37

Did you set the same code for sell orders?

It would be better if you share the code.


@Waxy

Waxy
29 Jun 2018, 09:54

Just replace SimpleMovingAverage for WeightedMovingAverage


@Waxy

Waxy
29 Jun 2018, 09:17

Here's a simple example:

 

using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Examples : Robot
    {
        SimpleMovingAverage SlowMA, FastMA;
        Position Pos;

        protected override void OnStart()
        {
            SlowMA = Indicators.SimpleMovingAverage(MarketSeries.Close, 100);
            FastMA = Indicators.SimpleMovingAverage(MarketSeries.Close, 50);
        }

        protected override void OnBar()
        {
            bool direction = FastMA.Result.Last(1) > SlowMA.Result.Last(1);
            TradeType tT = direction ? TradeType.Buy : TradeType.Sell;

            if (Positions.Count == 0)
            {
                Pos = ExecuteMarketOrder(tT, Symbol, 1000).Position;
            }
            else
            {
                if((Pos.TradeType == TradeType.Buy && !direction) || (Pos.TradeType == TradeType.Sell && direction))
                    ClosePosition(Pos);
            }
        }
    }
}

 


@Waxy

Waxy
29 Jun 2018, 08:59

            //If there is not a buystop order place a buy stop order
            if (PendingOrders.Count(item => item.OrderType == PendingOrderType.Stop && item.TradeType == TradeType.Buy) == 0)
            {
                PlaceStopOrder(TradeType.Buy, Symbol, 1000, Symbol.Ask + 100 * Symbol.PipSize);
            }

 


@Waxy

Waxy
20 Jun 2018, 13:35

Could you please give me a mail? or should I send it to support?


@Waxy

Waxy
01 Jun 2018, 02:05

I think the last update fixed it :)


@Waxy

Waxy
01 Jun 2018, 02:04 ( Updated at: 21 Dec 2023, 09:20 )

Hello Panagiotis,

The error is shown when I build from VS2017:

In the end, it says: Process doesn't have access to file because it's being used by another process.

I must close VS and click Build on cTrader for these errors to become warnings, I think it's a bug.

Now without VS2017 Open:


@Waxy

Waxy
31 May 2018, 22:29

Sure Panagiotis, I'll send a video about it.


Thanks for your support.


@Waxy

Waxy
31 May 2018, 01:50

Hello Patrik,

I must repeatedly do this in order to work, hopefully, there will be a fix for backward compatibility soon, right?

Best Regards


@Waxy

Waxy
14 May 2018, 05:59

Hello Panagiotis,

Thanks for letting me know about this, hope it gets implemented soon.

Best Regards,


@Waxy

Waxy
10 May 2018, 18:56

Hello Panagiotis,

I've done a lot of codes for other traders and I do think a couple features would be nice to have, I think Spotware team has their hands busy and are missing some small details.

  • For example, it would be nice to have more flexible parameter types i.e.:
    • Datetime, so the user doesn't have to input a date as a string leading to errors, of course, I can check if the date is being parsed correctly, but the issue here is that it's not practical for the end user.
    • Enum types:
      • Instead of setting parameters like these: "Long = true / Short = false" or type a string "Long/long/Buy/buy" for long and "Sell//sell/Short/short" for short, including just the TradeType as an actual parameter would solve this.
      • Some users also ask for custom types, i.e: "Low Risk/Medium Risk/High Risk" or "Trade Limit Only/Trade Market Only" these type of enum parameters are available on other platforms like MT4 and it would be really useful to have them.
  • Another important feature would be buttons included on the API, I can already do this with Windows Forms, but it would be nice to have a quick feature so the buttons would be included inside the charts.
  • Also, it would be nice to have the objects used drawn on backtesting, sometimes lines and objects are part of the systems and not having them makes it hard to backtest/debug, again this feature is implemented on MT4 already.
  • Same day tick optimization.
  • Step by Step backtesting.

I think some if not all of these features are very important, especially the objects on backtesting and parameter types, would be nice if you could help me push some of these features to be implemented anytime soon.

Xavier R.


@Waxy

Waxy
01 Apr 2017, 04:10

Hello .tmc, thanks for your response

The file is not opened by any other app, and I set the days as you told me, still play button is gray. I'm pretty clueless about this issue.

Does the file has to be on any specific location?

Best Regards,

 


@Waxy