Registered User Joined: 9/20/2010 Posts: 13
|
Dear Trainers,I only trade S&P related ETFs. Currently I am trading SPY. I would like to back test my strategy where I sell 50% of SPY position when it moves up, crosses, then closes below a specific envelope and repurchase it 50% (i.e 100% of portfolio) when you crosses down and closes above a specific indicator. Then I would like to draw the equity line of that strategy.Look forward to your assistance.Regards,Azam
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The current version of BackScanner does not have any portfolio or money management features. You are either all in or all out of a position.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
However one could write realcode to track the equity curve of each etf using your rules and then construct a market index of this indicator to give an indication of the stratagy's overall performance.
The rules would need to be clearly defined for:
o entry trigger buy position
o 1st 50% exit trigger
o reentry trigger of 1st 50%
o exit trigger of rest of position
o exit trugger whole position
if isfirstbar then
equity = 100000
inTrade - false
halfPosition = false
shares = 0
endif
if not inTrade then
if entryTrigger then
'
' buy position
'
shares = round(equity/price.open,0)
equity -= shares * price.open
inTrade = True
endif
else
' Sketch of logic follows, The shares, halfPosition, equity and inTrade boolean would need
' to be managed based on the triggers .
' We are in a trade so could:
' if half position
' if exit rest of position
' exit position
' else if reenter trigger
' reenter 1st half
' else if exitWholePosition trigger
' exit ret
' endif
' else
' if exitWholePosition trigger then
' exit position
' else if exitFirstHalf trigger
' exit half position
' else
' do nothing
' endif
endif
plot = equity + shares * price.close
|