Topics
11 Jun 2013, 15:28
3296
3
08 Mar 2013, 16:56
3011
5
06 Mar 2013, 23:35
4224
2
06 Mar 2013, 22:55
3226
2
05 Mar 2013, 18:37
4498
5
04 Mar 2013, 18:48
3758
5
04 Mar 2013, 13:40
3538
4
01 Mar 2013, 01:22
5345
7
Replies
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, 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
condor
12 Jun 2013, 18:41
It's all good, i've uploaded it to the indocator section
@condor