Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Scale in during oversold and scale out during overbought Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Azam
Posted : Thursday, January 27, 2011 5:07:25 AM
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
Bruce_L
Posted : Thursday, January 27, 2011 9:05:52 AM


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
jas0501
Posted : Thursday, January 27, 2011 9:56:20 AM
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

 

Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.