Topics
05 Dec 2014, 00:00
 2644
 1
Replies

admin
26 Nov 2012, 09:34

Yes, the only problem is in the backtesting and it only affects code with referenced indicators.

 


@admin

admin
23 Nov 2012, 14:16

You need to add a reference to the System namespace:

using System;


When you add a new Indicator/Robot in the cAlgo platform it is included by default.

 


@admin

admin
23 Nov 2012, 12:42

Can you type the syntax you are using and the desired outcome. Math.Round has a few overloads:

var a = Math.Round(7.45);
var b = Math.Round(7.45, 1);
var c = Math.Round(7.45, 2);
Print("{0},{1},{2}", a,b,c);

Output:
7, 7.4, 7.45


@admin

admin
22 Nov 2012, 14:23

It is not possible to access these dates currently but we will consider implementing this in the future.

 


@admin

admin
22 Nov 2012, 14:22

Thank you for reporting this. We have identified an issue with the backtesting and are currently working on a solution for it.

 


@admin

admin
22 Nov 2012, 14:17

Thank you for reporting this. We have identified an issue with the backtesting and are currently working on a solution for it. In order to verify that your situation is the same you may post your code or send it to us via email.

 


@admin

admin
21 Nov 2012, 16:12

Thank you for the suggestion. We will consider adding an addin for Excel.

 


@admin

admin
21 Nov 2012, 16:10

Yes it is achievable. You can use Symbol.Spread to check for the spread.

 


@admin

admin
21 Nov 2012, 15:50

We are currently testing and will get back to you as soon as we have more information.  Thank you for your patience.

 


@admin

admin
21 Nov 2012, 14:23

Thank you for the suggestion, we will take it under consideration.

 


@admin

admin
20 Nov 2012, 18:21

We will investigate the backtesting feature promptly. 

 


@admin

admin
20 Nov 2012, 17:36

It should be:

private readonly List<Position> _listPosition = new List<Position>();

 


@admin

admin
20 Nov 2012, 17:31

We are looking into it, for the time being please use a different static position.

 


@admin

admin
20 Nov 2012, 17:19

Yes, you would have to change the condition within if (MarketSeries.Close.Count > 2) so that you will not receive an error, but unfortunately it will still not produce any results due to not receiving any trendbars on Sundays.

 


@admin

admin
20 Nov 2012, 16:26

Could you please check the settings you are using for the spread? It could be the issue that if you are using live spread then it may trigger an entry at a higher price.

 


@admin

admin
20 Nov 2012, 16:24

In order to better assist you could you attach a screenshot of the error as well as the log (click on details)? Thank you.

 

 


@admin

admin
20 Nov 2012, 16:22

All platforms always host limit and stop orders. This includes cTrader, ECNs, aggregators, etc. They are almost never hosted with individual Bank LPs. This is due to the fact that (1) you never know what Bank LP will quote the required price first and (2) the Banks do not provide such functionality. Limits and Stops are then sent to the LP when the price is triggered. Price advantage is still probable for Limits. Also, what makes cTrader different is that (1) it is located right next to the LPs, (2) that there is no need for unnatural hops (i.e. bridges) because we operate over FIX and (3) cTrader treats resting orders as Limits and Stops respectively, not as Market Orders like some other platforms do.

 


@admin

admin
20 Nov 2012, 16:21

All platforms always host limit and stop orders. This includes cTrader, ECNs, aggregators, etc. They are almost never hosted with individual Bank LPs. This is due to the fact that (1) you never know what Bank LP will quote the required price first and (2) the Banks do not provide such functionality. Limits and Stops are then sent to the LP when the price is triggered. Price advantage is still probable for Limits. Also, what makes cTrader different is that (1) it is located right next to the LPs, (2) that there is no need for unnatural hops (i.e. bridges) because we operate over FIX and (3) cTrader treats resting orders as Limits and Stops respectively, not as Market Orders like some other platforms do.

 


@admin

admin
20 Nov 2012, 16:20

We apologize for that inconvenience, it will be fixed promptly. But it does not have anything to do with any errors. It is only a matter of the intellisense feature.

About the backtesting, could you be more specific. What exactly is the error?

 


@admin

admin
20 Nov 2012, 11:56

Here it is
odomike said:

How do I correct this please? I need the exact code that can make the necessary corrections so it can start working properly and place the 2 pending stop orders as required of the robot.

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

namespace cAlgo.Robots
{
    [Robot]
    public class NewsRobot : Robot        
    {
    	[Parameter("News Day (1-5)", DefaultValue=1, MinValue=1, MaxValue=5)]
    	public int NewsDay  { get; set; }
    	    	
    	[Parameter("News Hour", DefaultValue=14, MinValue=0, MaxValue=23)]
    	public int NewsHour  { get; set; }
    	
    	[Parameter("News Minute", DefaultValue=30, MinValue=0, MaxValue=59)]
    	public int NewsMinute  { get; set; }
    
    	[Parameter("Pips away", DefaultValue=10)]
    	public int PipsAway  { get; set; }
    
    	[Parameter("Take Profit", DefaultValue=50)]
    	public int TakeProfit  { get; set; }   

		[Parameter("Stop Loss", DefaultValue=10)]
    	public int StopLoss  { get; set; }
    	    	
    	[Parameter("Volume", DefaultValue=100000, MinValue=1000)]
    	public int Volume  { get; set; }    	   	
    	    	
    	[Parameter("Seconds Before", DefaultValue=5, MinValue=1)]
    	public int SecondsBefore  { get; set; }
    	
    	[Parameter("Seconds Timeout", DefaultValue=10, MinValue=1)]
    	public int SecondsTimeout  { get; set; }
    	
    	[Parameter("One Cancels Other", DefaultValue=1, MinValue=0, MaxValue=1)]
    	public int Oco  { get; set; }
    	
    	private bool _ordersCreated;
    	private PendingOrder _buyOrder;
    	private PendingOrder _sellOrder;
    	    	
        protected override void OnTick()
        {        	
			if ((int)Server.Time.DayOfWeek == NewsDay && !_ordersCreated)
			{
				var triggerTime = new DateTime(Server.Time.Year, Server.Time.Month, Server.Time.Day, NewsHour, NewsMinute, 0);
				
				if (Server.Time <= triggerTime && (triggerTime - Server.Time).TotalSeconds <= SecondsBefore)
				{
					_ordersCreated = true;					
					var expirationTime = triggerTime.AddSeconds(SecondsTimeout);
					
					var sellOrderTargetPrice = Symbol.Bid - PipsAway * Symbol.PipSize;					
					Trade.CreateSellStopOrder(Symbol, Volume, sellOrderTargetPrice,
						sellOrderTargetPrice + StopLoss * Symbol.PipSize, sellOrderTargetPrice - TakeProfit * Symbol.PipSize, expirationTime);	

					var buyOrderTargetPrice = Symbol.Ask + PipsAway * Symbol.PipSize;
					Trade.CreateBuyStopOrder(Symbol, Volume, buyOrderTargetPrice,
						buyOrderTargetPrice - StopLoss * Symbol.PipSize, buyOrderTargetPrice + TakeProfit * Symbol.PipSize, expirationTime);
				}
			}
        }
        
		protected override void OnPendingOrderCreated(PendingOrder newOrder)
		{
			if (newOrder.TradeType == TradeType.Buy)
				_buyOrder = newOrder;
			else
				_sellOrder = newOrder;
		}
        
		protected override void OnPositionOpened(Position openedPosition)
		{
			if (Oco == 1)
			{
				Trade.DeletePendingOrder(_buyOrder);
				Trade.DeletePendingOrder(_sellOrder);
			}
		}        
    }
}



@admin