Sell if Close > entry price
Author: techtrader007
Creation Date: 12/17/2010 10:01 AM
profile picture

techtrader007

#1
I need following exit strategy: Sellmarket if the positionentryprice > close
I would add this to the rotationscript buy on weakness .
But my solution is not working.
CODE:
Please log in to see this code.


profile picture

Cone

#2
There are several problems with this:
1. Close[bar] of which stock? You're not using SetContext there, so Close[bar] will refer to whichever stock you left as the Context.

2. You're looping through Positions with an index p, but you used LastPosition instead of p in the Close/EntryPrice comparison.

Correction (untested):
CODE:
Please log in to see this code.
profile picture

techtrader007

#3
Thanks Cone. Works.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).