Wysiwyg
Everyone wants money
- Joined
- 8 August 2006
- Posts
- 8,428
- Reactions
- 284
.
I find this methodology to be beneficial in system testing / evaluation.
Mark
Hello. I noticed you have a trade management code which has a 'move stop to break even'. I am desperately seeking a simple AFL code for back testing that would set a stop at initial buy price (break even) after the stock price has moved x% up from buy price. Note - no initial stoploss.
So using day bars ...
a) 'set' stop at break even when high price is >= x% above buy price.
OR
b) sell stock at bar 30 if price close is below buy price.
some of your code:
PHP:
MSBE = Param("#DaysB4MoveStopBE", 10, 0,50,1) -1;
// raise stop to BE after x days
if(OpenPos == 1) {
BES[i] = Max(BES[i], BES[i-1]);
BESa[i] = BES[i];
}
if(OpenPos == 1 AND j == MSBE) {
TS = Max(TS[i], BES[i]);
TSa[i] = TS[i];
BESa[i] = BES[i];
}
Hope you don't mind me asking. I raised this question at Yahoo.group a while back.