Topics

Forum Topics not found

Replies

waixiong97@gmail.com
27 May 2017, 03:29

RE:

lucian said:

You can start with this code:

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter("OpenDay", DefaultValue = 5)]
        public int dOpenDayTime { get; set; }

        [Parameter("OpenHour", DefaultValue = 13)]
        public int dOpenHourTime { get; set; }

        [Parameter("OpenMinute", DefaultValue = 59)]
        public int dOpenMinuteTime { get; set; }

        [Parameter("OpenSecond", DefaultValue = 59)]
        public int dOpenSecondTime { get; set; }



        protected override void OnTick()
        {
            var _TimeDays = (int)Server.Time.DayOfWeek;
            var _TimeHours = Server.Time.Hour;
            var _TimeMinutes = Server.Time.Minute;
            var _TimeSeconds = Server.Time.Second;



            if (_TimeDays == dOpenDayTime && _TimeHours == dOpenHourTime && _TimeMinutes == dOpenMinuteTime && _TimeSeconds >= dOpenSecondTime && MarketSeries.Close[1] > MarketSeries.Open[0])
            {
                ExecuteMarketOrder(TradeType.Sell, Symbol, 1000, "label", 10, 10);
            }

        }
    }
}

 

I use this as template to do, but when I do the backtesting, still no order is executed


@waixiong97@gmail.com