Modifying Larry Connors High Probability ETF Trading RSI strategy
Author: CharlieChalk
Creation Date: 9/10/2014 11:18 AM
profile picture

CharlieChalk

#1
Hi Eugene,

i'm presently working on a Larry Connors RSI System from teh Buy Dips section of the strategies. However, when i apply the systme to SPY data the results are poor even though i know the system is sound, or atleast has been profitable in the past.

I have tried stipping down the system to get closer to what i desire as well as trouble shooting why the system isn't performing as expected. However, in the process i have run into another problem of coding!!

Could you explain what is wrong with the code below? I receive a warning stating "The predefined type 'System.Threading.Task.Task' is defined in multiple assemblies in the global alias; using definition from 'cwindoes miscroft.NET Framework64 v4......."

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

Eugene

#2
Actually, there are two Connors RSI systems there. According to the code, you're working with "Larry Connors High Probability ETF Trading RSI strategy".

I can't tell you why the system isn't performing as expected because what you're expecting is unknown. In particular, you haven't indicated the entry rules. Assuming that you don't want to open more than 2 positions, here's my stab at fixing it. However, it won't have a chance to open two positions because of the very fast exit:

CODE:
Please log in to see this code.


If you need assistance, please take time to express your trading rules. Guesswork is not a good helper in troubleshooting.

P.S. As to the warning message, you may disregard it. When the omission of opening curly braces is fixed, it won't bug you.
profile picture

CharlieChalk

#3
Hi Eugene, I appreciate you making the changes. The code looks like it is correct and certainly verifies but when i see the trades plotted on a chart of the SPY all the buys are entered at a higher price than the code specifies and all the trades are exited at a lower price too. This difference is consistently $0.18 on both the opening and closing of the trade. Could this be some setting for slippage and transaction costs etc?

Charles
profile picture

Eugene

#4
Hi Charles,

Yes, could be. It's enabled by default. You could look it up under Preferences > Commissions.
profile picture

CharlieChalk

#5
HI Eurgene, i got to the bottom of the last issue, i was using excess slippage for the system!

There is one more issue and i know that this is perhaos a tricky one as often this would be considered a coding error and impossible to trade in reality - however in realitiy without using intraday bars it is the most acurate way of achieveing what i am looking for....

Can I enter a trade on the close of the current bar? Basically, if the RSI is less than 10 i want to buy on the close of this current bar rather than the open of the following day.

I have made the changes in the code but receive error messages....

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

Eugene

#6
I see why you receive that error message (one error here) but the task is to learn you how to fish. Which line is the compiler pointing at? What do you think it may be trying to tell? Hint: In particular, how does the faulty code line differ from the other similar trading methods used in the code?
profile picture

CharlieChalk

#7
Ha! yes your right, being able to fishing is far more productive and fulfilling in they longterm. I keep forgetting that this language is case sensitive.

I've now been "playing" with code for an hr and can't get results as intended.

The code below in my mind says to BUY on close if RSI < 98 and Close > 200MA and to SHORT if RSI > 98 and Close > 200MA

This isn't what is happening and i'm sure it has something to do with [bar] or [bar + 1] ?

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

Eugene

#8
QUOTE:
The code below in my mind says to BUY on close if RSI < 98 and Close > 200MA and to SHORT if RSI > 98 and Close > 200MA

Here's what the code actually does:

If today's close is below 200-day SMA and (RSI2 as of today's close is > 98), short at today's open. Vice versa for longs.
...
If tomorrow's close will be below tomorrow's open, cover today at open. Vice versa for longs.
...

While these may be excellent ideas, both are impossible without a time machine. Please point me at where does the WealthScript Guide and/or QuickRef suggests to enter at market at bar? (Rhetoric question, no need to reply). As a rule of thumb, don't turn working code into peeking code by changing bar+1 to bar. Further reading: WealthScript Programming Guide > Programming Trading Strategies > Peeking.

With peeking errors fixed:

CODE:
Please log in to see this code.
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).