예제 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public FatFollower()
            : base()
        {
            //// Base class parameters.
            //StopLoss = CreateParameter("StopLoss", 0.75, 0, 5, 0.1);
            //TakeProfit = CreateParameter("TakeProfit", 3.56, 0, 5, 0.1);
            //// Trailing stop sets when price is reached TakeProfit. If zero, close on TakeProfit
            //TrailingStop = CreateParameter("TrailingStop", 3.63, 0, 5, 0.1);

            StopLoss.Start = 0;
            StopLoss.Stop = 50;
            StopLoss.DefaultValue = 10;
            StopLoss.Step = 5;

            TakeProfit.Start = 0;
            TakeProfit.Stop = 100;
            TakeProfit.DefaultValue = 10;
            TakeProfit.Step = 10;

            TakeProfit.Start = 0;
            TakeProfit.Stop = 50;
            TakeProfit.DefaultValue = 0;
            TakeProfit.Step = 10;

            // FatOrderCriteria = FatOrder.Volume / averageVolume
            fatOrderCriteria = CreateParameter("FatOrderCriteria", 2, 1, 5, 0.5);
        }
예제 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public FatFollower() : base()
        {
            //// Base class parameters.
            //StopLoss = CreateParameter("StopLoss", 0.75, 0, 5, 0.1);
            //TakeProfit = CreateParameter("TakeProfit", 3.56, 0, 5, 0.1);
            //// Trailing stop sets when price is reached TakeProfit. If zero, close on TakeProfit
            //TrailingStop = CreateParameter("TrailingStop", 3.63, 0, 5, 0.1);

            StopLoss.Start        = 0;
            StopLoss.Stop         = 50;
            StopLoss.DefaultValue = 10;
            StopLoss.Step         = 5;

            TakeProfit.Start        = 0;
            TakeProfit.Stop         = 100;
            TakeProfit.DefaultValue = 10;
            TakeProfit.Step         = 10;

            TakeProfit.Start        = 0;
            TakeProfit.Stop         = 50;
            TakeProfit.DefaultValue = 0;
            TakeProfit.Step         = 10;

            // FatOrderCriteria = FatOrder.Volume / averageVolume
            fatOrderCriteria = CreateParameter("FatOrderCriteria", 2, 1, 5, 0.5);
        }
 public MyStrategy()
 {
     //Pushed indicator CreateParameter statements
     slider1 = CreateParameter("EMA_Period_1",10,2,200,20);
     slider2 = CreateParameter("EMA_Period_2",30,2,200,20);
     slider3 = CreateParameter("WilliamsR_Period_3",3,2,200,20);
 }
예제 #4
0
 public MyStrategy()
 {
     //Pushed indicator CreateParameter statements
     slider1 = CreateParameter("EMA_Period_1", 10, 2, 200, 20);
     slider2 = CreateParameter("EMA_Period_2", 30, 2, 200, 20);
     slider3 = CreateParameter("WilliamsR_Period_3", 3, 2, 200, 20);
 }
예제 #5
0
        public bool Test()
        {
            InputData inData = new InputData();

            inData.LoadFromDirectory(this.SourceDirectory, null);

            List <StratergyParameterRange> ranges = new BuyLimitAndWaitConfigReader().GetRanges(new List <string>());

            BuyLimitAndWaitStrategy blwStrategy = new BuyLimitAndWaitStrategy();
            StrategyParameter       sParam      = ranges[0].GetAllParameters()[0];

            sParam["InitHistoryMinutes"] = 0;
            blwStrategy.TesterInit(sParam, null);

            FuturePredictor fPredictor = new FuturePredictor(inData.Data);
            EngineFast      engineFast = new EngineFast();

            engineFast.StartTest(inData, blwStrategy, fPredictor, true, 100);

            blwStrategy = new BuyLimitAndWaitStrategy();
            sParam      = ranges[0].GetAllParameters()[0];
            sParam["InitHistoryMinutes"] = 0;
            blwStrategy.TesterInit(sParam, null);
            Engine engine = new Engine(null, null);

            engine.StartTest(inData, blwStrategy, new Account(10000000, 3));

            return(engineFast.HistoryOpenBuyPoints.Count() + engineFast.HistoryOpenSellPoints.Count()
                   == engine.ClosedOrders.Count());
        }
예제 #6
0
        public double EstimateFunction(StrategyParameter sParam, string directory)
        {
            if (previosResult.ContainsKey(sParam.ToString()))
            {
                return(previosResult[sParam.ToString()]);
            }

            using (Log4Smart.Logger logger = new Log4Smart.Logger(false))
            {
                Engine             engine   = new Engine(logger, logger);
                SuperAdaptStrategy strategy = new SuperAdaptStrategy(sParam, logger);
                int     initialMoney        = 10000000;
                Account acc = new Account(initialMoney);

                engine.StartTest(SampleData, strategy, acc);
                if (!engine.IsTestSuccessfull)
                {
                    logger.SaveLogToFile("errors", SampleData.Symbol + "_" + StartTime.ToString("yyyyMMdd"));
                    previosResult[sParam.ToString()] = 0;
                    return(0);
                }
                if (directory != string.Empty)
                {
                    logger.SaveLogToFile(directory + "/" + this.StartTime.ToString("yyyyMMdd") + "_" + (acc.Balance.ToString()) + "$", "allData");
                }

                previosResult[sParam.ToString()] = acc.Balance;
                return(acc.Balance);
            }
        }
 public TestStrategyScript()
 {
     strategyParameter1 = CreateParameter("Fractals", 15, 3, 100, 3);
     //	strategyParameter2 = CreateParameter("SMA", 4, 1, 10, 2);
     //	strategyParameter3 = CreateParameter("Sdvig", 3, 1, 4, 1);
     strategyParameter4 = CreateParameter("Stop", 0.002, 0.001, 0.01, 0.001);
     strategyParameter5 = CreateParameter("Profit", 0.006, 0.002, 0.01, 0.001);
 }
예제 #8
0
        public bool TesterInit(StrategyParameter param, IStrategyLogger logger)
        {
            TestingMode = true;
            this.param  = param;
            this.logger = logger;

            return(true);
        }
        public override bool IsValid(StrategyParameter param)
        {
            //if (param["TP"] > param["OpenOrderShift"])
            //    return false;

            param.NewsFilePath = System.Configuration.ConfigurationManager.AppSettings["NewsFilePath"];
            return(true);
        }
예제 #10
0
 public Doroob()
 {
     rocPeriod  = CreateParameter("ROC_Period", 20, 20, 20, -1);
     rsiPeriod  = CreateParameter("RSI Period", 29, 29, 29, -1);
     oversold   = CreateParameter("Oversold", 35, 30, 44, 1);
     overbought = CreateParameter("Overbought", 66, 70, 90, 2);
     stopLose   = CreateParameter("StopLose", 2, 1, 10, 1);
     priceRise  = CreateParameter("PriceRise", 3, 1, 6, 1);
 }
예제 #11
0
        private Pixel2 PixelFromParameter(StrategyParameter parameter)
        {
            int tp    = parameter[cFirstName];
            int shift = parameter[cSecondName];
            int y     = (tp - m_minFirst) / cStepFirst;
            int x     = (shift - m_minSecond) / cStepFirst;

            return(new Pixel2(x, y));
        }
        int trendRating = 0; //  0 nutral, 1 bulish, 2 strong bulish.    if trend bearish then 1 bearish, 2 strong brerish

        #endregion Fields

        #region Constructors

        public Doroob()
        {
            rocPeriod = CreateParameter("ROC_Period", 20, 20, 20, -1);
            rsiPeriod = CreateParameter("RSI Period", 29, 29, 29, -1);
            oversold = CreateParameter("Oversold", 35, 30, 44, 1);
            overbought = CreateParameter("Overbought",66, 70, 90, 2);
            stopLose = CreateParameter("StopLose", 2, 1, 10, 1);
            priceRise = CreateParameter("PriceRise", 3, 1, 6, 1);
        }
예제 #13
0
        public override void EstimateAll(string directory)
        {
            StrategyParameter param = new StrategyParameter();

            foreach (KeyValuePair <string, AForge.IntStepRange> range in Range.ranges)
            {
                param.Add(range.Key, range.Value.Max);
            }
            OptimizationFunction(param, directory);
        }
예제 #14
0
        public override bool IsValid(StrategyParameter param)
        {
            if (param["NumberStartFluctuation"] > param["NumberEndFluctuation"])
            {
                return(false);
            }

            param.NewsFilePath = System.Configuration.ConfigurationManager.AppSettings["NewsFilePath"];
            return(true);
        }
예제 #15
0
 static public string BuildMQLStrategy(string strategyName, StrategyParameter sParam, List <string> arrExportParameters)
 {
     using (StreamReader streamReader = new StreamReader("strategy.template"))
     {
         string strategyTemplate = streamReader.ReadToEnd();
         return(strategyTemplate.Replace(ADVISOR_NAME, strategyName)
                .Replace(MAGIC_NUMBER, sParam["MagicNumber"].ToString())
                .Replace(DECLARATION_VARIABLE, GetVariableDeclaration(sParam, arrExportParameters))
                .Replace(INITIALIZATION_PARAM, GetVariableInitialization(sParam, arrExportParameters)));
     }
 }
예제 #16
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GapCatcher()
     : base()
 {
     MinGapSize = CreateParameter("MinGapSize", 0, 0, 3, 0.1);
     // Base class parameters.
     /*            StopLoss = CreateParameter("StopLoss", 0.75, 0, 5, 0.1);
                 TakeProfit = CreateParameter("TakeProfit", 3.56, 0, 5, 0.1);
                 // Trailing stop sets when price is reached TakeProfit. If zero, close on TakeProfit
                 TrailingStop = CreateParameter("TrailingStop", 3.63, 0, 5, 0.1);
                 */
 }
예제 #17
0
        /// <summary>
        /// Constructor
        /// </summary>
        public GapCatcher()
            : base()
        {
            MinGapSize = CreateParameter("MinGapSize", 0, 0, 3, 0.1);
            // Base class parameters.

            /*            StopLoss = CreateParameter("StopLoss", 0.75, 0, 5, 0.1);
             *          TakeProfit = CreateParameter("TakeProfit", 3.56, 0, 5, 0.1);
             *          // Trailing stop sets when price is reached TakeProfit. If zero, close on TakeProfit
             *          TrailingStop = CreateParameter("TrailingStop", 3.63, 0, 5, 0.1);
             */
        }
예제 #18
0
        internal override void OnRemmoteAdvisorInit(RemoteAdvisor rmAdviser)
        {
            try
            {
                Meta = rmAdviser;
                ForexAPI fAPI = new ForexAPI(Meta, rmAdviser.MagicNumber);

                OrderOperation = fAPI;
                Account        = fAPI;
                History        = fAPI;
                this.Symbol    = rmAdviser.Symbol();

                if (this.param != null)
                {
                    throw new ApplicationException("Param was initalized");
                }
                this.param = new StrategyParameter();

                foreach (string paramKey in rmAdviser.Parameters.Keys)
                {
                    if (paramKey == "NewsFilePath")
                    {
                        this.param.NewsFilePath = rmAdviser.Parameters[paramKey];
                        continue;
                    }
                    if (paramKey.EndsWith("String"))
                    {
                        this.param.Add(paramKey, rmAdviser.Parameters[paramKey]);
                        continue;
                    }
                    if (paramKey == "InvertedMetaStrategy")
                    {
                        rmAdviser.IsInverted = rmAdviser.Parameters[paramKey] == "1" || rmAdviser.Parameters[paramKey] == "true";
                        continue;
                    }

                    this.param[paramKey] = Int32.Parse(rmAdviser.Parameters[paramKey]);
                }


                this.logger = new MetaStrategyLogger(Meta);

                onStart(0);
                this.Meta.Print("onStart finidshed successfully");
            }
            catch (Exception exc)
            {
                string excString = "Start up exception: " + exc.ToString();
                Meta.Comment(excString);
                Meta.Print(excString);
            }
        }
예제 #19
0
        static private string GetVariableDeclaration(StrategyParameter sParam, List <string> arrExportParameters)
        {
            StringBuilder strBuilder = new StringBuilder();

            foreach (string currKey in sParam.Keys)
            {
                if (arrExportParameters.Contains(currKey))
                {
                    strBuilder.AppendFormat("extern int {0} = {1};\n", currKey, sParam[currKey]);
                }
            }
            return(strBuilder.ToString());
        }
예제 #20
0
 public HistorySimulator(BasicParam customParam, bool IsTestingMode, FxAdvisorCore.SimpleAdvisor advisor, StrategyParameter currentStrategyParam, string symbol, IMeta meta)
 {
     this.CustomParam  = customParam;
     this.IsSuccessful = false;
     if (IsTestingMode)
     {
         rootPath = System.Configuration.ConfigurationManager.AppSettings["QuotesFullPath"];
     }
     this.Advisor = advisor;
     this.CurrentStrategyParam = currentStrategyParam;
     this.Symbol = InputData.ConvertToStandardName(symbol);
     this.Meta   = meta;
 }
예제 #21
0
 /// <summary>
 /// Constructor
 /// </summary>
 public VertexExplorer()
     : base()
 {
     // Base class parameters.
     /*            StopLoss = CreateParameter("StopLoss", 0.75, 0, 5, 0.1);
                 TakeProfit = CreateParameter("TakeProfit", 3.56, 0, 5, 0.1);
                 // Trailing stop sets when price is reached TakeProfit. If zero, close on TakeProfit
                 TrailingStop = CreateParameter("TrailingStop", 3.63, 0, 5, 0.1);
                 */
     deltaDown = CreateParameter("DeltaDown", 0.53, 0.1, 1, 0.05);
     deltaUp = CreateParameter("DeltaUp", 0.98, 0.1, 1, 0.05);
     priceMaPeriod = CreateParameter("PriceMAPeriod", 4, 1, 10, 1);
     trendMaPeriod = CreateParameter("TrendMAPeriod", 174, 30, 500, 10);
 }
예제 #22
0
        private void ProcessAndFill(string name, Pixel2 pixel)
        {
            int tp    = CalcTp(pixel.Y);
            int shift = CalcShift(pixel.X);
            StrategyParameter parameter = new StrategyParameter();

            parameter[cFirstName]  = tp;
            parameter[cSecondName] = shift;

            Tuple <StrategyParameter, double[], double[]> entry =
                new Tuple <StrategyParameter, double[], double[]>(parameter, m_param2equity[pixel].ToArray(), m_param2margin[pixel].ToArray());

            dictEquityAndMargin[name] = entry;
        }
예제 #23
0
        /// <summary>
        /// Constructor
        /// </summary>
        public VertexExplorer()
            : base()
        {
            // Base class parameters.

            /*            StopLoss = CreateParameter("StopLoss", 0.75, 0, 5, 0.1);
             *          TakeProfit = CreateParameter("TakeProfit", 3.56, 0, 5, 0.1);
             *          // Trailing stop sets when price is reached TakeProfit. If zero, close on TakeProfit
             *          TrailingStop = CreateParameter("TrailingStop", 3.63, 0, 5, 0.1);
             */
            deltaDown     = CreateParameter("DeltaDown", 0.53, 0.1, 1, 0.05);
            deltaUp       = CreateParameter("DeltaUp", 0.98, 0.1, 1, 0.05);
            priceMaPeriod = CreateParameter("PriceMAPeriod", 4, 1, 10, 1);
            trendMaPeriod = CreateParameter("TrendMAPeriod", 174, 30, 500, 10);
        }
        public StrategyParameter Translate(IChromosome chromosome)
        {
            // get chromosome's value
            ushort[]          val    = ((ShortArrayChromosome)chromosome).Value;
            StrategyParameter sParam = new StrategyParameter();

            int i = 0;

            foreach (KeyValuePair <string, AForge.IntStepRange> kvp in sparamRange.ranges)
            {
                int result = val[i++] * (kvp.Value.Max - kvp.Value.Min + 1) / ((ShortArrayChromosome)chromosome).MaxValue;
                result = result - result % kvp.Value.Step + kvp.Value.Min;
                sParam.Add(kvp.Key, result);
            }

            return(sParam);
        }
예제 #25
0
        static private string GetVariableInitialization(StrategyParameter sParam, List <string> arrExportParameters)
        {
            StringBuilder strBuilder = new StringBuilder();

            foreach (string currKey in sParam.Keys)
            {
                if (arrExportParameters.Contains(currKey))
                {
                    strBuilder.AppendFormat("bridge_setParameter( \"{0}\", DoubleToStr({0}, 0));\n", currKey);
                }
            }
            if (!string.IsNullOrEmpty(sParam.NewsFilePath))
            {
                strBuilder.AppendFormat("bridge_setParameter( \"{0}\", \"{1}\");\n", "NewsFilePath", sParam.NewsFilePath.Replace("\\", "\\\\"));
            }

            return(strBuilder.ToString());
        }
예제 #26
0
        static public void CalculatePoints(StrategyParameter currParam, InputData inData, FuturePredictor fPredictor, int countDiff,
                                           out IEnumerable <int> buyArray, out IEnumerable <int> sellArray)
        {
            buyArray  = null;
            sellArray = null;

            BuyLimitAndWaitStrategy blwStrategy = new BuyLimitAndWaitStrategy();

            currParam["InitHistoryMinutes"] = 0;
            blwStrategy.TesterInit(currParam, null);

            EngineFast engineFast = new EngineFast();

            engineFast.StartTest(inData, blwStrategy, fPredictor, false, 100);

            buyArray  = Enumerable.Select(engineFast.HistoryOpenBuyPoints, p => p + countDiff);
            sellArray = Enumerable.Select(engineFast.HistoryOpenSellPoints, p => p + countDiff);
        }
예제 #27
0
        static public double CalculateTimeOfOnePips(string sourceDirectory, string symbolName, ResetTimeAnalysis.SideAnalyser side)
        {
            InputData inData = new InputData();

            inData.LoadFromDirectory(sourceDirectory, null);

            double swap = 0;

            if (ResetTimeAnalysis.SideAnalyser.Buy == side)
            {
                swap = inData.SwapBuy;
            }
            if (ResetTimeAnalysis.SideAnalyser.Sell == side)
            {
                swap = inData.SwapSell;
            }

            FuturePredictor fPredictor            = new FuturePredictor(inData.Data);
            List <StratergyParameterRange> ranges = new BuyLimitAndWaitConfigReader().GetRanges(new List <string>());

            StrategyParameter currParam = ranges[0].GetAllParameters().Last();
            IEnumerable <int> buyArray, sellArray;

            ResetTimeAnalysis.CalculatePoints(currParam, inData, out buyArray, out sellArray);

            string            profitSymbol = ForexSuite.SymbolsManager.GetProfitSymbol(symbolName);
            double            coefToUSD    = ForexSuite.QuotesManager.ConvertCurrency(profitSymbol, "USD", DateTime.Now.AddMonths(-7), ForexSuite.SymbolsManager.ValueFromPips(profitSymbol, 1));
            ResetTimeAnalyzer rta          = new ResetTimeAnalyzer(currParam["TP"], 1 / 60d, fPredictor.Bids, fPredictor.Asks, coefToUSD, swap);

            if (side == SideAnalyser.Buy)
            {
                rta.Process(buyArray, null);
            }
            else
            {
                rta.Process(null, sellArray);
            }
            if (rta.RealProfit == 0)
            {
                throw new ApplicationException("RealProfit=0");
            }
            return(rta.AverageTime / rta.RealProfit);
        }
예제 #28
0
        public override double OptimizationFunction(StrategyParameter sParam, string directory)
        {
            if (!IsValid(sParam))
            {
                return(0);
            }

            if (previosResult.ContainsKey(sParam.ToString()))
            {
                return(previosResult[sParam.ToString()]);
            }

            using (Log4Smart.Logger logger = new Log4Smart.Logger(false))
            {
                Engine             engine   = new Engine(logger, logger);
                MartinGaleStrategy strategy = new MartinGaleStrategy(sParam, logger);
                int     initialMoney        = 10000000;
                Account acc = new Account(initialMoney);
                engine.StartTest(SampleData, strategy, acc);
                if (!engine.IsTestSuccessfull)
                {
                    logger.SaveLogToFile(directory + "/errors", SampleData.Symbol + "_" + StartTime.ToString("yyyyMMdd"));
                    previosResult[sParam.ToString()] = 0;
                    return(0);
                }

                if (directory != string.Empty)
                {
                    logger.SaveLogToFile(directory + "/" + this.StartTime.ToString("yyyyMMdd") + "_" + (acc.Balance.ToString()) + "$", "allData");
                }

                if (acc.Balance > initialMoney && this.EstimationFunctionType == EstimationFunctionType.MostMoney8Deviation)
                {
                    previosResult[sParam.ToString()] = initialMoney + (acc.Balance - initialMoney) * (1 - acc.Statistics.GetDeviation);
                }
                else
                {
                    previosResult[sParam.ToString()] = acc.Balance;
                }
                return(previosResult[sParam.ToString()]);
            }
        }
예제 #29
0
        /// <summary>
        /// Parameters initialization
        /// </summary>
        protected void InitParameters()
        {
            StopLoss.Start        = 0;
            StopLoss.Stop         = 50;
            StopLoss.DefaultValue = 10;
            StopLoss.Step         = 5;

            TakeProfit.Start        = 0;
            TakeProfit.Stop         = 100;
            TakeProfit.DefaultValue = 10;
            TakeProfit.Step         = 10;

            TakeProfit.Start        = 0;
            TakeProfit.Stop         = 50;
            TakeProfit.DefaultValue = 0;
            TakeProfit.Step         = 10;


            momentumPeriod = CreateParameter("MomentumPeriod", 12, 5, 100, 5);
            stochKPeriod   = CreateParameter("StockKPeriod", 11, 11, 100, 5);
            stochDSmooth   = CreateParameter("StockKSmoothPeriod", 5, 5, 50, 5);
            stochDPeriod   = CreateParameter("StockDPeriod", 5, 5, 100, 5);
        }
예제 #30
0
        //public StrategyParameter GetMainParameters
        //{
        //    get
        //    {
        //        StrategyParameter param = new StrategyParameter();

        //        foreach (KeyValuePair<string, AForge.IntStepRange> range in GetRanges(null)[0].ranges)
        //        {
        //            param.Add(range.Key, range.Value.Current);
        //        }
        //        return param;
        //    }
        //}
        public void SaveCurrentParameters(string strategyName, StrategyParameter sParam, string directory)
        {
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            else
            {
                Array.ForEach(Directory.GetFiles(directory), delegate(string path) { File.Delete(path); });
            }

            List <string> arrExportParameters = new List <string>();

            using (FileStream fs = new FileStream(GetConfigName(), FileMode.Open, FileAccess.Read, FileShare.Read))
                using (XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(fs, new XmlDictionaryReaderQuotas()))
                {
                    DataContractSerializer  ser2 = new DataContractSerializer(typeof(StratergyParameterRange));
                    StratergyParameterRange deserializedStratergyParameterRange = (StratergyParameterRange)ser2.ReadObject(reader, true);
                    foreach (KeyValuePair <string, AForge.IntStepRange> currKeyValuePair in deserializedStratergyParameterRange.ranges)
                    {
                        if (currKeyValuePair.Value.IsNonExport == 0)
                        {
                            arrExportParameters.Add(currKeyValuePair.Key);
                        }
                    }
                }

            arrExportParameters.Add("GMT");
            sParam["GMT"]         = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["GMT"]);
            sParam["MagicNumber"] = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["MagicNumber"]);
            sParam.NewsFilePath   = System.Configuration.ConfigurationManager.AppSettings["NewsFilePath"];

            using (StreamWriter streamWriter = new StreamWriter(Path.Combine(directory, "external" + strategyName + sParam["MagicNumber"].ToString() + ".mq4")))
            {
                streamWriter.Write(StrategyMqlTemplate.BuildMQLStrategy(strategyName, sParam, arrExportParameters));
            }
        }
예제 #31
0
 public ATMDec2009()
 {
     paramBrk = CreateParameter("Low/high period", 20, 10, 40, 5);
     paramExit = CreateParameter("Exit after", 5, 5, 30, 5);
     paramTimeout = CreateParameter("Timeout", 30, 10, 40, 10);
 }
예제 #32
0
        int trendRating = 0; //  0 nutral, 1 bulish, 2 strong bulish.    if trend bearish then 1 bearish, 2 strong brerish

        #endregion Fields

        #region Constructors

        public Doroob()
        {
            overbought = CreateParameter("Overbought",84, 70, 90, 2);
        }
 public override double OptimizationFunction(StrategyParameter sParam, out StrategyResultStatistics srResult, string directory)
 {
     return(StandardOptimizationFunction(sParam, directory, new BuyLimitAndWaitStrategy(), new BuyLimitAndWaitConfigReader(), out srResult));
 }
예제 #34
0
 public ATMNov2009()
 {
     paramRectLength = CreateParameter("Rectangle Length", 4, 3, 12, 1);
     L2 = CreateParameter("Range Length", 12, 10, 20, 1);
     L8 = CreateParameter("Range Factor", 1, 1, 3, 0.5);
     L3 = CreateParameter("ATR Length", 30, 10, 40, 10);
     paramRectRatio = CreateParameter("Rectangle Ratio", 0.3, 0.2, 0.5, 0.1);
     paramProfit = CreateParameter("ATR Profit", 2, 1, 4, 1);
     paramStop = CreateParameter("ATR Stop", 1, 1, 4, 1);
     paramATRBreakout = CreateParameter("ATR Breakout", 0.25, 0.25, 1, 0.25);
 }
예제 #35
0
 public SuperAdaptStrategy(StrategyParameter param, IStrategyLogger logger)
 {
     this.logger = logger;
     this.param  = param;
     this.logger.AddMessage("Start strategy with parameter {0}", param.ToString());
 }
예제 #36
0
 public override bool IsValid(StrategyParameter param)
 {
     param.NewsFilePath = System.Configuration.ConfigurationManager.AppSettings["NewsFilePath"];
     return(true);
 }
예제 #37
0
 public ATMSep2009()
 {
     paramMode = CreateParameter("Filter off/on (0/1)", 0, 0, 1, 1);
     down = CreateParameter("Down Days", 3, 2, 10, 1);
     up = CreateParameter("Up Days", 2, 2, 10, 1);
 }
예제 #38
0
 public FOTFeb2008()
 {
     lookbackPeriod = CreateParameter("Lookback Period", 100, 50, 200, 25);
 }
예제 #39
0
 public FOTJan2008()
 {
     bbPeriod = CreateParameter("Bands Period", 20, 5, 50, 5);
     bbStdDev = CreateParameter("Std Dev", 2, 1, 5, 0.25);
     bbSqueezeLookback = CreateParameter("Squeeze lookback", 100, 5, 150, 5);
 }
예제 #40
0
 public ATMAug2008_2()
 {
     paramPeriod = CreateParameter("Period", 20, 5, 100, 5);
     paramMult = CreateParameter("Multiple", 1, 0.50, 1.50, 0.1);
 }
예제 #41
0
        public ATMFeb2008()
        {
            ma1Period = CreateParameter("SMA1 period", 10, 10, 30, 2);
            ma2Period = CreateParameter("EMA2 period", 30, 20, 60, 2);
            ma3Period = CreateParameter("EMA3 period", 50, 30, 100, 2);

            paramConv = CreateParameter("Convergence %", 2.5, 0.5, 3, 0.25);
            paramChannel = CreateParameter("Channel length", 30, 2, 30, 2);
        }
예제 #42
0
 public ATMJul2008()
 {
     paramSwing = CreateParameter("Swing %", 3, 2, 10, 0.5);
     paramDays = CreateParameter("Time-based", 30, 15, 50, 5);
     paramDistance = CreateParameter("Distance", 30, 10, 50, 10);
     paramSupport = CreateParameter("Support, days", 30, 10, 100, 10);
 }
예제 #43
0
 public ATMMar2008()
 {
     bbPeriod = CreateParameter("Bollinger Period", 20, 5, 50, 5);
     bbStdDev = CreateParameter("Std Dev", 2, 1, 5, 0.25);
     bbSqueezeLookback = CreateParameter("Squeeze lookback", 100, 5, 150, 1);
 }
예제 #44
0
 public ATMNov2008()
 {
     paramPeriod = CreateParameter("Time span, days", 50, 5, 300, 5);
     paramThreshold = CreateParameter("Threshold $", 300000, 100000, 3000000, 100000);
     paramDecline = CreateParameter("Decline %", 50, 10, 95, 5); //40
     paramExitAfter = CreateParameter("Exit after, days", 50, 5, 300, 5); //150|200
 }
예제 #45
0
 public ATMAug2009()
 {
     paramExit = CreateParameter("Exit after", 20, 5, 50, 5);
 }
예제 #46
0
 public ATMApr2009_2()
 {
     paramWeekly = CreateParameter("Weekly EMA", 26, 12, 36, 2);
     paramSwitch = CreateParameter("Impulse Off/On", 1, 0, 1, 1);
 }
예제 #47
0
        public ATMAug2008_1()
        {
            paramMult = CreateParameter("Multiple", 1.5, 1, 4, 0.25);
            paramMode = CreateParameter("White/Johnson", 1, 1, 2, 1);

            /*
            paramMult:	A close X% of price higher than yesterday's close that
                        fails to become a new 20-day highest close.
            paramMode: 	Selects between original "percentage change" (Adam White)
                        and "ATR change" (Mark Johnson) approach.
            */

            paramChEx = CreateParameter("Chandelier mult.", 4, 2, 5, 0.25);
        }
예제 #48
0
 public ATMApr2009_1()
 {
     paramEMA = CreateParameter("EMA", 13, 6, 18, 1);
     paramSwitch = CreateParameter("Filter Off/On", 1, 0, 1, 1);
 }
예제 #49
0
 public Doroob()
 {
     line = CreateParameter("Line", 27, 20, 50, 1);
     minDays = CreateParameter("Min Days", 2, 2, 40, 1);
 }
예제 #50
0
        public override double OptimizationFunction(StrategyParameter sParam, string directory)
        {
            StrategyResultStatistics srResult;

            return(StandardOptimizationFunction(sParam, directory, new SuperStrategy(), new SuperStrategyConfigReader(), out srResult));
        }
예제 #51
0
 public ATMSep2008_2()
 {
     paramX = CreateParameter("X ATRs", 2.5, 0.5, 5, 0.5);
     paramPeriod = CreateParameter("n-Period High", 10, 5, 50, 5);
     paramLookback = CreateParameter("ATR Period", 10, 5, 30, 1);
 }
예제 #52
0
 public override double OptimizationFunction(StrategyParameter sParam)
 {
     return(EstimateFunction(sParam, string.Empty));
 }
예제 #53
0
 public ATMOct2008_2()
 {
     paramThreshold = CreateParameter("Threshold $", 20000000, 1000000, 50000000, 1000000);
     paramExitAfter = CreateParameter("Exit after, days", 30, 5, 50, 5);
 }
예제 #54
0
 public ATMMay2009()
 {
     paramSwings = CreateParameter("Nr. of swings", 6, 1, 20, 1);
     paramMode = CreateParameter("Use all", 0, 0, 1, 1);
 }
예제 #55
0
        /// <summary>
        /// Parameters initialization
        /// </summary>
        protected void InitParameters()
        {
            StopLoss.Start = 0;
            StopLoss.Stop = 50;
            StopLoss.DefaultValue = 10;
            StopLoss.Step = 5;

            TakeProfit.Start = 0;
            TakeProfit.Stop = 100;
            TakeProfit.DefaultValue = 10;
            TakeProfit.Step = 10;

            TakeProfit.Start = 0;
            TakeProfit.Stop = 50;
            TakeProfit.DefaultValue = 0;
            TakeProfit.Step = 10;

            momentumPeriod = CreateParameter("MomentumPeriod", 12, 5, 100, 5);
            stochKPeriod = CreateParameter("StockKPeriod", 11, 11, 100, 5);
            stochDSmooth = CreateParameter("StockKSmoothPeriod", 5, 5, 50, 5);
            stochDPeriod = CreateParameter("StockDPeriod", 5, 5, 100, 5);
        }
예제 #56
0
 public ATMJuly2009()
 {
     paramMode = CreateParameter("Adaptive", 1, 0, 1, 1);
     paramSwings = CreateParameter("Nr. of swings", 5, 1, 20, 1);
     paramDays = CreateParameter("Exit after", 15, 3, 50, 1);
 }
예제 #57
0
 public ATMJune2009()
 {
     paramRatio = CreateParameter("Ratio", 150, 100, 300, 25);
 }