Topics
06 Mar 2013, 23:35
 4218
 2
04 Mar 2013, 18:48
 3752
 5
04 Mar 2013, 13:40
 3531
 4
01 Mar 2013, 01:22
 5338
 7
Replies

condor
12 Jun 2013, 18:41

It's all good, i've uploaded it to the indocator section


@condor

condor
08 Mar 2013, 18:07

The problem is there is that there is nothing in the log file and nothing in the error file i created. I'll send the entire code to the email adress you gave me.


@condor

condor
06 Mar 2013, 23:42

SOLVED !!!

I just needed to change this :

for(int i =0 ; i<= Account.PendingOrders.Count;i++)

to this :

for(int i =0 ; i< Account.PendingOrders.Count;i++)

 


@condor

condor
05 Mar 2013, 22:59

Exactly what i've done, but i made it simplier 0 for false and everything else for true, so i don't risk to have problems with users who choose 2.


@condor

condor
04 Mar 2013, 15:41

Thank you, i've seen it but i hadn't understood that PercentK was Main.


@condor

condor
03 Mar 2013, 14:58

Finally i've found an easier way to do it :

			bool tradeTime = false;
			if(Begin < Ending) tradeTime = Server.Time.Hour >= Begin && Server.Time.Hour < Ending;
			if(Ending < Begin) tradeTime = Server.Time.Hour >= Begin || Server.Time.Hour <= Ending;
			
			if (!tradeTime) return;




@condor

condor
01 Mar 2013, 18:12

Thanks, it's better but still doesn't works :(

The reason is that the "var" which is a double cannot be compared to a "DateTime".

And i've no idea how to cast a DateTime to a double.


@condor

condor
01 Mar 2013, 16:18

Thank you, but it seems that the solution in the sample doesn't works or maybe there is an error in my code, can you take a look :

    public class RSIBot : Robot
    {
        private RelativeStrengthIndex RSI;
        private StochasticOscillator Stoch;
        private HighLowBands HLBands;
        private Position _position;
        private DateTime startTime;
        private DateTime endTime;

        [Parameter("Volume", DefaultValue = 10000, MinValue = 1000)]
        public int Volume { get; set; }

        [Parameter("Begin Trading Hour", DefaultValue = 22.0)]
        public double Begin { get; set; }

        [Parameter("Ending Trading Hour", DefaultValue = 8.0)]
        public double Ending { get; set; }

        [Parameter("TP", DefaultValue = 2, MinValue = 1)]
        public int TakeProfit { get; set; }

        [Parameter("SL", DefaultValue = 5, MinValue = 3)]
        public int StopLoss { get; set; }

        [Parameter("Source")]
        public DataSeries Source { get; set; }


        protected override void OnStart()
        {
            RSI = Indicators.RelativeStrengthIndex(Source, 7);
            Stoch = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple);
            HLBands = Indicators.HighLowBands(14);

            startTime = Server.Time.Date.AddHours(Begin);
            endTime = Server.Time.Date.AddHours(Ending);

            Print("Start Time {0},", startTime);
            Print("End Time {0},", endTime);

        }

        protected override void OnTick()
        {
            if (Trade.IsExecuting) return;

            bool tradeTime = Server.Time >= startTime && Server.Time <= endTime;

            if (!tradeTime) return;




@condor