GHOST TRADER交易系统

2011-07-21 08:58:35

Building Winning Trading Systems with TradeStation书里的6个交易系统之一的WLD版。

ChartScript Description

This trading system is disclosed in the book "Building Winning Trading Systems with TradeStation," by George Pruitt and John R. Hill. Pruitt and Hill are the principals of Futures Truth, the independent trading system testing company. In that capacity they have seen and forward tested literally thousands of trading systems and have developed informed opinions about what works and what doesnt work in the markets. Their recommendations thus merit consideration.

The strategy of this system is predicated on the thesis that winning trades are more likely to follow losing trades. Therefore, to implement this strategy the system is "ghost" or paper traded in the background and a real trade is entered only after a ghost or real losing trade. The ghost trading accurately simulates the action of Wealth-Lab to the extent that entry and exit conditions are evaluated, market position is maintained, simulated entry and exit prices are calculated, and hypothetical profits determined. However, the ghost system does not enter real trades. That is left to the real system which enters a real trade only following a real or ghost losing trade, logs that trade, and uses it in the determination of back test performance. The authors suggest that this system is mostly a template demonstrating how background ghost trading may be used to develop information for the use and benefit of foreground real trading.

The core trading logic itself is simple enough. Long and short trades are entered stop when the 9-day RSI crosses under/over the 70/30 critical levels preconditioned by the 9-day EMA being outside a channel formed by the 19-day EMA of highs and lows. Positions are closed stop when the EMA penetrates the highest high/lowest low of the past 20 days.

This system was back tested over five years against the WL-100 portfolio. The real system alone gave a RAR=34.7% and 148/425=34.8% winners. Using the ghost system and entering a new real trade only after a losing ghost or real trade yielded a RAR=20.7% and 144/426=33.8% winners thus calling the losing trade hypothesis into question. Alternatively, using the ghost system and entering a new trade only after a winning ghost or real trade resulted in a RAR=76.6% and 103/316=32.6% winners. It therefore appears, at least for this core logic, watchlist, and backtest period, that when youre hot youre hot!

q

WealthScript Code

Below is the WealthScript code for this ChartScript.

( Click here for a version of the WealthScript code suitable for copying to the clipboard)

var Bar,paneRSI,myPosition :integer;

var myEntryPrice,myExitPrice,myProfit :float;

HideVolume;

myPosition:= 0;

myProfit:= -1;

for Bar:= 21 to BarCount-1 do

begin

{--------------------Ghost System--------------------}

{Simulate system, offset by one bar, in every respect to determine if last trade was loss}

if myPosition = 0 then

begin

if EMA(Bar-1,#Close,9) > EMA(Bar-1,#High,19) then

if CrossUnderValue(Bar-1,RSISeries(#Close,9),70) then

if PriceHigh(Bar) > PriceHigh(Bar-1) then

begin

myEntryPrice:= Max(PriceOpen(Bar),PriceHigh(Bar-1));

myPosition:= +1;

end;

if EMA(Bar-1,#Close,9) < EMA(Bar-1,#Low,19) then

if CrossOverValue(Bar-1,RSISeries(#Close,9),30) then

if PriceLow(Bar) < PriceLow(Bar-1) then

begin

myEntryPrice:= Min(PriceOpen(Bar),PriceLow(Bar-1));

myPosition:= -1;

end;

end;

if ((myPosition = +1) and (PriceLow(Bar) < Lowest(Bar-1,#Low,20))) then

begin

myExitPrice:= Min(Lowest(Bar-1,#Low,20),PriceOpen(Bar));

myProfit:= myExitPrice - myEntryPrice;

myPosition:= 0;

end;

if ((myPosition = -1) and (PriceHigh(Bar) > Highest(Bar-1,#High,20))) then

begin

myExitPrice:= Max(Highest(Bar-1,#High,20),PriceOpen(Bar));

myProfit:= myEntryPrice - myExitPrice;

myPosition:= 0;

end;

{-------------------Real System--------------------}

{Real trades are entered only if the last ghost or real trade resulted in a loss, i.e. myProfit < 0}

{myProfit:= -1;}

if ((MarketPosition = 0) and (myProfit < 0)) then

begin

if EMA(Bar,#Close,9) > EMA(Bar,#High,19) then

if CrossUnderValue(Bar,RSISeries(#Close,9),70) then

BuyAtStop(Bar+1,PriceHigh(Bar),);

if EMA(Bar,#Close,9) < EMA(Bar,#Low,19) then

if CrossOverValue(Bar,RSISeries(#Close,9),30) then

ShortAtStop(Bar+1,PriceLow(Bar),);

end;

if MarketPosition = +1 then

SellAtStop(Bar+1,Lowest(Bar,#Low,20),LastPosition,);

if MarketPosition = -1 then

CoverAtStop(Bar+1,Highest(Bar,#High,20),LastPosition,);

end;

{----------Plotting----------}

DrawLabel(GHOST TRADER,0);

DrawLabel(19-day EMA(hi/lo): dotted lines,0);

DrawLabel(9-day EMA(close): solid line,0);

PlotSeries(EMASeries(#High,19),0,#Blue,#Dotted);

PlotSeries(EMASeries(#low,19),0,#Blue,#Dotted);

PlotSeries(EMASeries(#Close,9),0,#Blue,#Thin);

paneRSI:=CreatePane(75,true,false);

DrawLabel(9-Day RSI(close),paneRSI);

PlotSeries(RSISeries(#Close,9),paneRSI,#Blue,#Thin);

 承诺与声明

兄弟财经是全球历史最悠久,信誉最好的外汇返佣代理。多年来兄弟财经兢兢业业,稳定发展,获得了全球各地投资者的青睐与信任。历经十余年的积淀,打造了我们在业内良好的品牌信誉。

本文所含内容及观点仅为一般信息,并无任何意图被视为买卖任何货币或差价合约的建议或请求。文中所含内容及观点均可能在不被通知的情况下更改。本文并未考 虑任何特定用户的特定投资目标、财务状况和需求。任何引用历史价格波动或价位水平的信息均基于我们的分析,并不表示或证明此类波动或价位水平有可能在未来 重新发生。本文所载信息之来源虽被认为可靠,但作者不保证它的准确性和完整性,同时作者也不对任何可能因参考本文内容及观点而产生的任何直接或间接的损失承担责任。

外汇和其他产品保证金交易存在高风险,不适合所有投资者。亏损可能超出您的账户注资。增大杠杆意味着增加风险。在决定交易外汇之前,您需仔细考虑您的财务目标、经验水平和风险承受能力。文中所含任何意见、新闻、研究、分析、报价或其他信息等都仅 作与本文所含主题相关的一般类信息.

同时, 兄弟财经不提供任何投资、法律或税务的建议。您需向合适的顾问征询所有关于投资、法律或税务方面的事宜。