Murray Ruggiero
Sponsor
In this thread let's discuss the concept of trading a filtered version of a system which is filtered using the raw performance of the system. The turtles did some of this type of work in their system with there past trade filters.
I orginally wrote about equity curve feedback in Cybernetic Trading. The problem with this type of research is that it is not easy to create code to simulate many trading strategies , in effect create a second channel for backtest in code. Bill Brower has done this for channel breakout in a old Inside Edge system newsletter for Tradestation, I don't remember each one it his monthly coding contest. The problem is if we test another system, we need to alway write this code custom for each strategy.
Since I like this area of research I added these features to TradersStudio. Here is the code for a channel breakout which requires the last trade to be a losing one.
'********************************
' Channel Breakout Filtered by Equity of Channel Breakout
' This system trades a virtual channel breakout which takes all trades and filters the
' performance of the actual live system. It only takes a trade if the previous trade
' for the virtual system lost money
' TradersStudio(r) 2004 , All rights reserved
Sub ChannelWithFilters(SLen as integer)
Dim MinMove
Dim TrProfit
Dim LowPrice as double
Dim HighPrice as double
LowPrice=Lowest(low,SLen,0)
HighPrice=Highest(high,SLen,0)
MinMove=GetActiveMinMove()
' Take a trade for the virtual system
VirtualBuy("ChanBuy",1,HighPrice+MinMove ,STOP,DAY)
VirtualSell("ChanSell",1,LowPrice-MinMove,STOP,DAY)
' If the virtual system has at least two trades
if VirLiveTradeCount()>2 then
' Trade 0 is the last completed trade, Trade 1 would be two closed trades ago
TrProfit=VirTradeProfit(0)
' If last trade in virtual system lost money then trade a real trade
if TrProfit<0 then
Buy("ChanBuy",1,HighPrice+MinMove ,STOP,DAY)
Sell("ChanSell",1,LowPrice-MinMove,STOP,DAY)
else
' Just exit the old trade and don't start a new one
ExitLong("XBuyBrk","ChanBuy",1,LowPrice-MinMove,STOP,DAY)
ExitShort("XSellBrk","ChanSell",1,HighPrice+MinMove,STOP,DAY)
end if
end if
end Sub
We have a second set of Buy, Sell, Exitlong, Exitshort, which have the word Virtual in front of them. We also have a set of functions to retrieve their performance.
We are using this system for part of a Free E-Mail course for registered members of our site. I will put some results about this system performance here in this forum, but the E-Mail course with the results, the portfolioâs, optimization and money management is 10-12 pages, over 4 E-Mail currently. We are working on additional Free E-Mail courses also. The courses are geared toward Beginning and intermediate traders, but I think even advance traders will find value.
If you want to share some ideas we can test them out in TradersStudio. If you have EasyLanguage code in Text format, just paste it into the post for example. I can translate it using TradersStudio migration tool and share the results with the forum, since TradersStudio can translate 90+ percent of TradeStation systems and functions.
You can register on TradersStudio by clicking here
http://tradersstudio.com/Default.aspx?tabid=56
I orginally wrote about equity curve feedback in Cybernetic Trading. The problem with this type of research is that it is not easy to create code to simulate many trading strategies , in effect create a second channel for backtest in code. Bill Brower has done this for channel breakout in a old Inside Edge system newsletter for Tradestation, I don't remember each one it his monthly coding contest. The problem is if we test another system, we need to alway write this code custom for each strategy.
Since I like this area of research I added these features to TradersStudio. Here is the code for a channel breakout which requires the last trade to be a losing one.
'********************************
' Channel Breakout Filtered by Equity of Channel Breakout
' This system trades a virtual channel breakout which takes all trades and filters the
' performance of the actual live system. It only takes a trade if the previous trade
' for the virtual system lost money
' TradersStudio(r) 2004 , All rights reserved
Sub ChannelWithFilters(SLen as integer)
Dim MinMove
Dim TrProfit
Dim LowPrice as double
Dim HighPrice as double
LowPrice=Lowest(low,SLen,0)
HighPrice=Highest(high,SLen,0)
MinMove=GetActiveMinMove()
' Take a trade for the virtual system
VirtualBuy("ChanBuy",1,HighPrice+MinMove ,STOP,DAY)
VirtualSell("ChanSell",1,LowPrice-MinMove,STOP,DAY)
' If the virtual system has at least two trades
if VirLiveTradeCount()>2 then
' Trade 0 is the last completed trade, Trade 1 would be two closed trades ago
TrProfit=VirTradeProfit(0)
' If last trade in virtual system lost money then trade a real trade
if TrProfit<0 then
Buy("ChanBuy",1,HighPrice+MinMove ,STOP,DAY)
Sell("ChanSell",1,LowPrice-MinMove,STOP,DAY)
else
' Just exit the old trade and don't start a new one
ExitLong("XBuyBrk","ChanBuy",1,LowPrice-MinMove,STOP,DAY)
ExitShort("XSellBrk","ChanSell",1,HighPrice+MinMove,STOP,DAY)
end if
end if
end Sub
We have a second set of Buy, Sell, Exitlong, Exitshort, which have the word Virtual in front of them. We also have a set of functions to retrieve their performance.
We are using this system for part of a Free E-Mail course for registered members of our site. I will put some results about this system performance here in this forum, but the E-Mail course with the results, the portfolioâs, optimization and money management is 10-12 pages, over 4 E-Mail currently. We are working on additional Free E-Mail courses also. The courses are geared toward Beginning and intermediate traders, but I think even advance traders will find value.
If you want to share some ideas we can test them out in TradersStudio. If you have EasyLanguage code in Text format, just paste it into the post for example. I can translate it using TradersStudio migration tool and share the results with the forum, since TradersStudio can translate 90+ percent of TradeStation systems and functions.
You can register on TradersStudio by clicking here
http://tradersstudio.com/Default.aspx?tabid=56