Unexpected MACDEx CrossOver signal
Author: swuzy
Creation Date: 2/24/2015 2:45 PM
profile picture

swuzy

#1
Hi, Appreciate some help understanding what might be wrong with my code for a simple MacdEx crossover buy / crossunder sell.

When I run it, it seems to work, but when I look at the charts, it seems to buy even though there does not appear to be an immediately recent crossover. Or maybe my chart panel is messed up, or whatever.

As one of many similar occurences, it shows a buy for RDC on 6/27/2014, and a sell on 1/13/2015. What is triggering the buy on 6/27 ? Thanks.

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

Eugene

#2
Hi,
The priority code borrowed from gbeltrame's "n-Liner" series of scripts applies to multi-position strategies. Here it worked incorrectly. Replace the trading logic with this one and the false trade will disappear (actually, the trades will be totally different):

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

swuzy

#3
Thank you. I wish to include a priority cutoff to reduce often excessive number of signals. How can that be done here?
profile picture

Eugene

#4
You might want to use the Position Options PosSizer from MS123 PosSizer Library. It provides the ability to reject a Position if its Priority value is less than or greater than some threshold.
profile picture

swuzy

#5
Wow. Thanks.
profile picture

Cone

#6
swuzy said, "I wish to include a priority cutoff to reduce often excessive number of signals."
Eugene said, "It provides the ability to reject a Position if ..."

Keep in mind that "signals" (Alerts) are not the same as "Positions" (backtest). PosSizers can't change the number of Alerts.
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).