- ago
I an using the S&P100 stocks.

This code does not seem to executed.

Backtester.CancelationCode = 173;

value = foundPosition0.EntryPrice * .90;
ClosePosition(foundPosition0, OrderType.Stop, value, "Sell at 10% profit target");

Please help.
0
289
4 Replies

Reply

Bookmark

Sort
- ago
#1
If it's a "Sell" as the signal name implies, this is a stop loss (not a profit target). But if it's a profit target it should be named "Cover". Your topic title said "Trailing stop" [renamed] despite not being it which further added to confusion.

So let's review the "what" (complete C# code), "where" (St.Mon., St.window, backtest?) and "when" (data provider, data loading range etc.)
0
Cone8
 ( 23.82% )
- ago
#2
I don't know how you determined the code wasn't executed, but it will help you to add this statement in Initialize() so that you can see if and at what price stop and limit orders are processed.

CODE:
PlotStopsAndLimits(4);
0
- ago
#3
As you noted the "Sell at 10% profit target" should read "Sell at 10% stop loss".
That being said the stop loss is not executed which is proven by several open positions with losses on excess of 20% showing up in the BackTest Results / Position.

I will try the PlotStopsAndLimits(4) and see what that yields.
0
Cone8
 ( 23.82% )
- ago
#4
But it doesn't prove that.
.. because a -10% stop loss doesn't guarantee you only lose -10%.

If you double-click on those -20% trades, you'll undoubtedly see that they were sold at the open following a large gap down (assuming long position). That's overnight risk.
0

Reply

Bookmark

Sort