WLP5.4.20策略太少,怎样才能下载以前wlp4.5里边策略?

Discussion in 'Wealth-Lab Developer' started by 君子爱财, Jan 8, 2010.

  1. 谢谢大家!
     
  2. WL5 公开的策略
    http://www.wealth-lab.com/Charting/...R8CQ3TpY0lWj7QvX9syy9+5bpyCJKf8EgkYeatEhBXDRO

    WL4 公开的策略
    http://wl4.wealth-lab.com/cgi-bin/WealthLab.DLL/browsechartscripts


    方法一:Wealth-Lab 3.x/4.x的代码转换到5.x的移植工具
    下载地址:http://atp.fidelity.com/WealthLabPro/WealthScriptTranslatorSetup.exe


    方法二:在Wealth-Lab 5 里直接运行基于Wealth-Lab 4.x交易策略的方法

    Aronow Software LLC 推出了一个名叫Wealth-Lab 4 Compatibility Library 的产品,可以让我们在 Wealth-Lab 5 平台里直接运行基于 Wealth-Lab 4.x 以前版本的大部分交易策略。关注 Wealth-Lab 的朋友们可能知道在Wealth-Lab 社区 4.x 以前版本积累了上千个交易策略与技术指示,这些都是我们学习的很重要的参考资源,不过由于 Wealth-Lab 从 5.0 版本开始上了.net 平台,现在 Wealth-Lab 5 设计交易策略的语言为流行的 C#,以前的版本一直用的是 Pascal,所以 Wealth-Lab 5 不能直接使用 Wealth-Lab 4.x 所开发的交易策略与技术指示,当然高手可以人工转换或者期待 Fidelity Investments 推出转换工具(已推出,见方法一)。而现在 Wealth-Lab 4 Compatibility Library 给我们带来了一些惊喜,可惜要价75美元,演示版本最大限制使用500根bars。

    使用方法:
    1、安装 Wealth-Lab 4.x;
    2、安装 Wealth-Lab 5.x;
    3、安装Wealth-Lab 4 Compatibility Library 到 Wealth-Lab 5.x 目录;
    4、启动 Wealth-Lab 5.x,新建图表后选译 WL 4 Compatibility Library 打开 Wealth-Lab 4.0 Script Executor 然后再选择来自 Wealth-Lab 4.x 的交易策略。

    Wealth-Lab 4 Compatibility Library 下载
    http://aronowsoftware.com/WL4CompatInstall.msi
     
  3. 太谢谢您了!平时最尊敬就是有水平,还热心帮助别人的人!
    喜欢新版5.4的流畅的速度,老版的策略,,,
    准备你的第一种方法试试,,,再一次谢谢您!:)
     
  4. 我都试过啦,方法二我在5.0的时候用过,方法一简单的WL4策略转换完后一次可通过,复杂点的稍微转换完后稍微改改即可。
     
  5. 怪不得没有成功,什么地方还需要修过?我不会怎么弄啊,,:confused:
    我就两个4.5的策略,能不能帮我改一下5.4的?:)
     
  6. 贴出来看一看。
     
  7. 楼上的邮箱名称比较有志气。
     
  8. 方便,好记而已!呵呵:)
     
  9. 如果不是现代发达方便的医疗,早就在美丽多彩的,,,土壤里遍地开花结果了!呵呵:D
     
  10. 1:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Drawing;
    using System.Threading; // Sleep()
    using System.Windows.Forms;
    using WealthLab;
    using WealthLab.Indicators;
    using finantic.TL; // WealthScriptTL
    
    namespace WealthLabCompile2
    {
        class Strategy : WealthScriptTL
        {
    #region file ChartScript
    
    // start of prolog: This is a comment at the top of each file
    		public new void Init(){
    			base.Init();
    			//optional settings
    			UseUpdatedEMA(true);
    			SetStdDevCalculation(StdDevCalculation.Population);
    		}
    // end of prolog: This is a comment at the top of each file
    
    
    public int Bar = 0;
    
    /** This method contains the meat of your script,
        i.e, any statements that are not inside a user defined class or function/procedure. */
    protected override void Execute(){
        Init();
        // [declaration for class ChartScript used to be here] 
        
        InstallProfitTarget(100);
        InstallTrailingStop(30, 30);
        InstallBreakEvenStop(10);
        for (Bar = 10; Bar <= (Bars.Count - 1); Bar++) {
            ApplyAutoStops(Bar);
            if ((CumDown(Bar, WL_CLOSE, 4) == 9)) BuyAtMarket((Bar + 1), "");
            
        }
        
    }
    
    
    
    // start of epilog: This is a comment at the end of each file
    	} // class Strategy
    } // namespace
    // end of epilog
    
    #endregion file ChartScript
    
     
  11. 2:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Drawing;
    using System.Threading; // Sleep()
    using System.Windows.Forms;
    using WealthLab;
    using WealthLab.Indicators;
    using finantic.TL; // WealthScriptTL
    
    namespace WealthLabCompile2
    {
    	class Strategy : WealthScriptTL
    	{
    		// OptVars
    		private StrategyParameter OptVar1, OptVar2, OptVar3, OptVar4;
    		public Strategy()
    		{
    			OptVar1 = CreateParameter("OptVar1", 12, 4, 27, 1);
    			OptVar2 = CreateParameter("OptVar2", 6, 0, 10, 1);
    			OptVar3 = CreateParameter("OptVar3", 4, 0, 10, 1);
    			OptVar4 = CreateParameter("OptVar4", 1, 1, 5, 1);
    		}
    		#region file ChartScript
    
    		// start of prolog: This is a comment at the top of each file
    		public new void Init(){
    			base.Init();
    			//optional settings
    			UseUpdatedEMA(true);
    			SetStdDevCalculation(StdDevCalculation.Population);
    		}
    		// end of prolog: This is a comment at the top of each file
    
    
    		public int x, Bar = 0;
    		public int nPeriod = 0;
    		public int xDevPane = 0;
    		public int nPriceMid, nMidDev, nHiDev, nLoDev, nHiLoDev, nHiLoDevWMA, nLoDevPct, nBuyPivot, nSellPivot, nBuySellPct, nPosToTrade = 0;
    		public double fTmp, fBuyPct, fSellPct, fSellMult = 0.0;
    		public string sInput = null;
    
    /** This method contains the meat of your script,
        i.e, any statements that are not inside a user defined class or function/procedure. */
    		protected override void Execute(){
    			Init();
    			// [declaration for class ChartScript used to be here] 
        
    			nPeriod = (int)(int) OptVar1.Value;
    			fBuyPct = (double)((int) OptVar2.Value / 100);
    			fSellPct = (double)((int) OptVar3.Value / 100);
    			fSellMult = (double)(int) OptVar4.Value;
    			/** Create the MID Series */ 
    			nPriceMid = (int)CreateSeries();
    			for (Bar = 0; Bar <= (Bars.Count - 1); Bar++) {
    				fTmp = (double)(((PriceHigh(Bar) + PriceLow(Bar))) / 2);
    				SetSeriesValue(Bar, nPriceMid, fTmp);
            
    			}
    			/** Create the Mid Deveation */ 
    			nMidDev = (int)DivideSeries(SMASeries(nPriceMid, nPeriod), nPriceMid);
    			/** Create the Buy Sell Percents */ 
    			nBuySellPct = (int)CreateSeries();
    			for (Bar = 0; Bar <= (Bars.Count - 1); Bar++) {
    				fTmp = (double)Math.Abs((GetSeriesValue(Bar, nMidDev) - 1));
    				SetSeriesValue(Bar, nBuySellPct, fTmp);
            
    			}
    			/** Create the MIDDev Series */ 
    			nHiLoDev = (int)DivideSeries(WL_HIGH, WL_LOW);
    			nHiLoDevWMA = (int)SMASeries(nHiLoDev, nPeriod);
    			/** Create the Hi and Lo Deveations */ 
    			nHiDev = (int)MultiplySeries(SMASeries(WL_HIGH, nPeriod), nHiLoDevWMA);
    			nLoDev = (int)SubtractSeries(SMASeries(WL_LOW, nPeriod), MultiplySeries(SMASeries(WL_LOW, nPeriod), SubtractSeriesValue(nHiLoDevWMA, 1)));
    			/** Create the Buy and Sell Pivots */ 
    			nSellPivot = (int)MultiplySeriesValue(nHiDev, ((1 + fSellPct)));
    			nBuyPivot = (int)MultiplySeriesValue(nLoDev, ((1 - fBuyPct)));
    			/** Plot the MAs */ 
    			PlotSeries(nHiDev, 0, 900, WL_THIN);
    			DrawLabel((("HiDev(" + Convert.ToString(nPeriod)) + ")"), 0);
    			PlotSeries(nLoDev, 0, 090, WL_THIN);
    			DrawLabel((("LoDev(" + Convert.ToString(nPeriod)) + ")"), 0);
    			PlotSeries(nSellPivot, 0, 900, WL_THICK);
    			DrawLabel((("nSellPivot(" + Convert.ToString(nPeriod)) + ")"), 0);
    			PlotSeries(nBuyPivot, 0, 090, WL_THICK);
    			DrawLabel((("BuyPivot(" + Convert.ToString(nPeriod)) + ")"), 0);
    			for (Bar = (nPeriod * 2); Bar <= (Bars.Count - 1); Bar++) {
    				if ((PriceLow(Bar) <= GetSeriesValue(Bar, nBuyPivot))) {
    					SetBackgroundColor(Bar, WL_GREENBKG);
    					BuyAtMarket((Bar + 1), "Buy");
                
    				}
    				else {
    					if ((PriceHigh(Bar) >= GetSeriesValue(Bar, nSellPivot))) {
    						nPosToTrade = (int)0;
    						if ((ActivePositions.Count > 0)) {
    							nPosToTrade = (int)(int)Math.Floor((((ActivePositions.Count * GetSeriesValue(Bar, nBuySellPct))) * fSellMult));
    							if ((nPosToTrade == 0)) nPosToTrade = (int)1;
                        
    						}
    						if ((nPosToTrade > 0)) {
    							SetBackgroundColor(Bar, WL_REDBKG);
    							for (x = 0; x <= (PositionCount - 1); x++) {
    								if (PositionActive(x)) {
    									SellAtMarket((Bar + 1), x, "Sell");
    									nPosToTrade = (int)(nPosToTrade - 1);
    									if ((nPosToTrade == 0)) break;
                                
    								}
                            
    							}
                        
    						}
                    
    					}
                
    				}
            
    			}
        
    		}
    
    
    
    		// start of epilog: This is a comment at the end of each file
    	} // class Strategy
    } // namespace
    	// end of epilog
    
    	#endregion file ChartScript
    
     
  12. 5.4版本好用!谢谢楼上朋友辛苦了!论坛因你这样的朋友而精彩!!
    有一个策略搞错了,
    不知道4.5老版和新版5.4能同时都装上吗?
     
  13. 可以同时装的,呵呵,互相学习。
     
  14. 客气了,你是行家了!呵呵
    策略一;翻译后放在4.5.2上压力/支撑线都没有了?不知道那个策略你玩过吗?:)
    谢谢。
     
  15. 我没有哦。你选的两策略我没有发现有一点独到之处。策略一本身没有压力/支撑线代码,是平台的关系吧。
     
  16. 是的。
    策略1;在4.5版本经常能显示压力/支撑线,主要感觉比在GET画线方便很多而已!
     
  17. 其实;
    WLP只不过好玩而已,实战,,,:)
     
  18. 新的5.42现在优化策略,速度越来越慢,:confused:
    再加一根内存不知道会不会好