In paper trading, exit conditions aren't triggered
Author: GriffinX2018
Creation Date: 7/23/2018 5:54 PM
profile picture

GriffinX2018

#1
Hi Folks!

Thanks in advance for taking my question.

I've put together a rather trivial strategy for checking backtesting and paper trading enabling. In the backtest the strategy works as expected. However, when I try to paper trade it only the Buy Limits are executed. The ensuing condition and Market Sell do not go off at all. They have satisfied the condition for the sale as i can see by auditing the conditions.

Here's the rule based construction:
Buy at Limit
--Moving Average turns up
Sell at Market
--Current open Position is profitable
Sell at Breakeven Stop

What am I failing to see?
-Rick
profile picture

Eugene

#2
Rick, how many bars of data are loaded when the strategy paper trades?
Also, what are the parameters behind each condition?
What symbol(s) and bar scale is this?
profile picture

GriffinX2018

#3
Hi and thanks!

1. One year of data
2. current open is profitable > 0 (see code below). (question arises: is this above the predetermined costs of slippage + commission?)
3. on stop loss i have given it a "1" but my next question was how to understand this metric (a "5" was the default setting)




CODE:
Please log in to see this code.
profile picture

GriffinX2018

#4
oh, and it was the nasdaq 100 and the bar scale is daily
profile picture

Eugene

#5
Thanks, and what was the moving average and its period? Also, there seem to be two groups of entries which isn't in line with your rules in post #1. It would be easier to copy/paste the entire code.

Regarding the "Current open Position is profitable" rule, it might not be what you're looking for. This built-in condition queries the most recent open Position which may be somewhat counterintuitive. So we added "Active Position is profitable" condition to Community.Rules that acts as most users would expect it to do. (However, first we have to get your Wiki account signup procedure done.)

As a quick workaround, replace these lines in the code above:
CODE:
Please log in to see this code.

With this one:
CODE:
Please log in to see this code.


How exactly are you paper trading it i.e. Strategy Monitor or Str. window?
profile picture

GriffinX2018

#6
Hi Eugene,

Here is the code in entirety. I note that when backtesting it the commissions and paid in cash are figured so that i don't need to do anything extra dock the strategy. Is this also true on paper trading here?

CODE:
Please log in to see this code.


as to your question i think i am in a strategy window.

thanks much, rick
profile picture

GriffinX2018

#7
and i am using a SMA on the Close with a 20 period
profile picture

Eugene

#8
Rick, now the code is completely different. What should this mean with regard to the problem outlined in the topic title?

Note that you can't expect realistic results if backtesting/trading this strategy in post #6 on Daily bars because it uses same-bar stop and/or limit orders. You might want to check out this FAQ and follow the pointers:

I want to test a strategy that buys and sells with stop/limit orders on the same bar.
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).