コード例 #1
0
ファイル: PredictorEMA.cs プロジェクト: psryland/rylogic_code
 public PredictorEMA(Rylobot bot)
     : base(bot, "PredictorEMA")
 {
     m_ema_lar = Bot.Indicators.ExponentialMovingAverage(Bot.MarketSeries.Close, 144);
     m_ema_med = Bot.Indicators.ExponentialMovingAverage(Bot.MarketSeries.Close, 55);
     m_ema_sma = Bot.Indicators.ExponentialMovingAverage(Bot.MarketSeries.Close, 21);
 }
コード例 #2
0
        // Notes:
        //

        public StrategyTrend(Rylobot bot)
            : base(bot, "StrategyTrend")
        {
            m_slope = new ExpMovingAvr(10);
            m_ema0  = Bot.Indicators.ExponentialMovingAverage(Bot.MarketSeries.Median, 100);
            m_ema1  = Bot.Indicators.ExponentialMovingAverage(Bot.MarketSeries.Median, 55);
        }
コード例 #3
0
 public StrategyEmaCross(Rylobot bot, double risk)
     : base(bot, "StrategyEmaCross", risk)
 {
     EMA0      = Indicator.EMA(Instrument, EmaPeriods0);
     EMA1      = Indicator.EMA(Instrument, EmaPeriods1);
     EMAGlobal = Indicator.EMA(Instrument, EmaPeriodsGlobal);
 }
コード例 #4
0
 protected PositionManager(Rylobot bot, Position pos)
 {
     Bot                = bot;
     Position           = pos;
     MinRtR             = 1.0;
     MinRtRCrossedIndex = null;
     Done               = false;
 }
コード例 #5
0
 public StrategyPriceDistribution(Rylobot bot, double risk)
     : base(bot, "StrategyPriceDistribution", risk)
 {
     PriceDistribution = new Distribution(Instrument.PipSize);
     m_prob_price      = new double[3];
     MA0 = Indicator.EMA(Instrument, MAPeriods0, 10);
     MA1 = Indicator.EMA(Instrument, MAPeriods1, 10);
 }
コード例 #6
0
ファイル: Predictor.cs プロジェクト: psryland/rylogic_code
        // Notes:
        // This is a base class for an entry signal trigger.
        // Derived types use various methods to guess where price is going.
        // Derived types add 'Feature' objects to the 'Features' collection, these are basically
        // values in the range [-1.0,+1.0] where -1.0 = strong sell, +1.0 = strong buy.

        public Predictor(Rylobot bot, string name)
        {
            Bot          = bot;
            Name         = name;
            CurrentIndex = 0;
            Instrument   = new Instrument(bot);
            Features     = new List <Feature>();
            LogFilepath  = Path_.CombinePath(@"P:\projects\Tradee\Rylobot\Rylobot\net\Data", "{0}.predictions.csv".Fmt(name));
        }
コード例 #7
0
        // Notes:
        // - Wait for marubozu candles
        // - Run on 1min data

        public StrategySpike(Rylobot bot, double risk)
            : base(bot, "StrategySpike", risk)
        {
            Periods            = 5;
            XShift             = 1.5;
            HighResCandleWidth = 0.5;
            EMA0 = new ExpMovingAvr(Periods);
            Debugging.DumpInstrument += Dump;
        }
コード例 #8
0
        // Notes:
        // - Strategies should be resume-able, i.e on start they should look for
        //   existing positions associated with the strategy and continue using them.
        //   This is so startup/shutdown have very little effect on the running of the bot.

        public Strategy(Rylobot bot, string label, double risk)
        {
            Bot         = bot;
            Label       = label;
            Suitability = new List <Vec2d>();
            Correlator  = new Correlator(label);
            Risk        = risk;

            Debugging.DumpInstrument += Dump;
        }
コード例 #9
0
        public StrategyDataCollector(Rylobot bot)
            : base(bot, "StrategyDataCollector")
        {
            NNet = new PredictorNeuralNet(bot);

            WindowSize   = 20;
            RtRThreshold = 2.0;

            // Generate the training and test data
            var outdir = @"P:\projects\Tradee\Rylobot\Rylobot\net\Data";

            m_training = new StreamWriter(Path_.CombinePath(outdir, "training.txt"));
            m_testing  = new StreamWriter(Path_.CombinePath(outdir, "testing.txt"));
        }
コード例 #10
0
        public StrategyRevenge(Rylobot bot, double risk)
            : base(bot, "StrategyRevenge", risk)
        {
            ReversesCount = 3;
            TakeProfitPC  = 0.001;
            Trades        = new List <Trade>();
            //PriceStats = new ExpMovingAvrMinMax();

            //// Initialise the stats
            //foreach (var candle in Instrument.CandleRange())
            //{
            //	PriceStats.Add(candle.Open);
            //	PriceStats.Add(candle.High);
            //	PriceStats.Add(candle.Low);
            //	PriceStats.Add(candle.Close);
            //}
        }
コード例 #11
0
 /// <summary>Manage an active position</summary>
 public PositionManagerNervious(Rylobot bot, Position pos)
     : base(bot, pos)
 {
     ColdFeetCount = 10;
     State         = EState.TradeLooksGood;
 }
コード例 #12
0
 public PredictorNeuralNet(Rylobot bot)
     : base(bot, "PredictorNeuralNet")
 {
 }
コード例 #13
0
 public PositionManagerCloseAtMA(Rylobot bot, Position position, int ma_periods, double offset)
     : base(bot, position)
 {
     m_ma     = Indicator.EMA("ma", Instrument, ma_periods);
     m_offset = offset;
 }
コード例 #14
0
 public PositionManagerTopDrop(Rylobot bot, Position position, int max_peak_separation, bool only_if_in_profit)
     : base(bot, position)
 {
     m_max_peak_separation = max_peak_separation;
     m_only_if_in_profit   = only_if_in_profit;
 }
コード例 #15
0
 public PositionManagerAdverseCandles(Rylobot bot, Position position, int count)
     : base(bot, position)
 {
     m_count = count;
 }
コード例 #16
0
        // Notes:
        //  - Open hedged positions 1*MCS apart
        //  - Set SL to 1*MCS
        //  - Set TP to 2*MCS

        public StrategyHedge2(Rylobot bot, double risk)
            : base(bot, "StrategyHedge2", risk)
        {
        }
コード例 #17
0
 public PredictorCandle(Rylobot bot)
     : base(bot, "PredictorCandle")
 {
 }
コード例 #18
0
ファイル: StrategyTail.cs プロジェクト: psryland/rylogic_code
 public StrategyTail(Rylobot bot)
     : base(bot, "StrategyTail")
 {
 }
コード例 #19
0
 public PositionManagerFixedTime(Rylobot bot, Position pos, int num_candles)
     : base(bot, pos)
 {
     NumCandles = num_candles;
 }
コード例 #20
0
 public StrategyBreakOut(Rylobot bot, double risk)
     : base(bot, "StrategyBreakOut", risk)
 {
     MA = Indicator.EMA(Instrument, 15);
     Debugging.DumpInstrument += Dump;
 }
コード例 #21
0
 public PositionManagerPeakPC(Rylobot bot, Position pos, double peak_frac = 0.7)
     : base(bot, pos)
 {
     PeakFrac = peak_frac;
 }
コード例 #22
0
 /// <summary>
 /// 'rel_price' is the price in the profit direction that trips the break even. e.g. MCS would trip break even when the price is in profit by MCS.
 /// 'bias' is the offset from break even</summary>
 public PositionManagerMoveToBreakEven(Rylobot bot, Position position, QuoteCurrency rel_price, QuoteCurrency?bias = null)
     : base(bot, position)
 {
     m_rel_price = rel_price;
     m_bias      = bias;
 }
コード例 #23
0
 public PredictorPotLuck(Rylobot bot)
     : base(bot, "PredictorPotLuck")
 {
     m_rng = new Random(1);
 }
コード例 #24
0
 public PositionManagerCandleFollow(Rylobot bot, Position pos, int num_candles)
     : base(bot, pos)
 {
     NumCandles = num_candles;
 }
コード例 #25
0
ファイル: StrategyTail.cs プロジェクト: psryland/rylogic_code
 /// <summary>Return a score for how well suited this strategy is to the current conditions</summary>
 public static double FitnessScore(Rylobot bot)
 {
     return(0.0);            // not implemented
 }
コード例 #26
0
 public PositionManagerLetHerRun(Rylobot bot, Position pos)
     : base(bot, pos)
 {
     m_peak_ratio = 0.0;
 }
コード例 #27
0
        // Notes:
        //  - The Broker can see all trades for the account,
        //    but should only modify positions created by 'Bot'
        //  - The Broker should not provide methods that operate
        //    on just the Bot's orders, they should be in the Rylobot
        //    base class.

        public Broker(Rylobot bot, IAccount acct)
        {
            Bot = bot;
            Update(acct);
        }
コード例 #28
0
 public PositionManagerCandlePattern(Rylobot bot, Position position)
     : base(bot, position)
 {
 }
コード例 #29
0
 // Notes:
 //  - Simple traditional strategy.
 //  - Use technical analysis to find good entry points
 //  - Require a reward to risk > 1.0
 //  - Aim for > 50% success
 //  - No hedging etc...
 //
 public StrategyMain(Rylobot bot, double risk)
     : base(bot, "StrategyMain", risk)
 {
 }
コード例 #30
0
 public PositionManagerBreakOut(Rylobot bot, Position position, int periods, bool only_if_in_profit)
     : base(bot, position)
 {
     m_periods           = periods;
     m_only_if_in_profit = only_if_in_profit;
 }