コード例 #1
0
        private void optimizeInternally(List <string> indicatorsToTry, IndicatorSelector selector)
        {
            while (ended == false)
            {
                try
                {
                    //generator.getGeneratedIndicator(Convert.ToInt32(outcomeTimeframe / 1000 / 15), Convert.ToInt32(outcomeTimeframe * 100 / 1000));
                    int index = getNextIndex();
                    if (index >= indicatorsToTry.Count)
                    {
                        break;
                    }

                    WalkerIndicator   wi = IndicatorGenerator.getIndicatorByString(indicatorsToTry[index]);
                    LearningIndicator li = new LearningIndicator(wi, priceData, outcomeCodeData, outcomeData, outcomeTimeframe, outcomeCodePercent, minPercentThreshold, learningIndicatorSteps, true);

                    selector.pushIndicatorStatistics(li);
                }
                catch (TooLittleValidDataException e)
                {
                    //Logger.log("E:" + e.Message);
                }
                catch (TooLittleStatesException e)
                {
                    //Logger.log("E:" + e.Message);
                }
                catch (Exception e)
                {
                    Logger.log("FATAL:" + e.Message);
                }
            }

            ended = true;
        }
コード例 #2
0
        public void startRunningRandomIndicators(IndicatorGenerator generator)
        {
            if (running == true)
            {
                throw new Exception("Already running!");
            }

            submitResults(LearningIndicator.getPredictivePowerArrayHeader() + "usedValues;name;id");

            Logger.log("Start testing indicators");
            new Thread(delegate() {
                running = true;
                while (running)
                {
                    //How about a genetic algo?
                    try {
                        testAndSubmitResult(generator.getGeneratedIndicator(Convert.ToInt32(outcomeTimeframe / 1000 / 15), Convert.ToInt32(outcomeTimeframe * 100 / 1000)));
                    }
                    catch (TooLittleValidDataException e)
                    {
                        Logger.log("E:" + e.Message);
                    }
                    catch (TooLittleStatesException e)
                    {
                        Logger.log("E:" + e.Message);
                    }
                    catch (Exception e)
                    {
                        Logger.log("FATAL:" + e.Message);
                    }
                }
            }).Start();
        }
コード例 #3
0
        private void testAndSubmitResult(WalkerIndicator indicator)
        {
            Logger.log("Testing Indicator: " + indicator.getName());

            LearningIndicator li = new LearningIndicator(indicator, priceData, outcomeCodeData, outcomeData, outcomeTimeframe, outcomeCodePercent, 0.5, learningIndicatorSteps, true);

            double[] pp = li.getPredictivePowerArray();

            //Results
            string output = "";

            foreach (double d in pp)
            {
                output += d + ";";
            }

            output += li.getUsedValues() + ";";
            output += indicator.getName().Split('_')[0] + ";" + indicator.getName();

            Logger.log("Result: " + li.getName());
            state = li.getName();
            submitResults(output);
        }