Overbought strategy
Author: topcat77
Creation Date: 10/13/2008 7:50 PM
profile picture

topcat77

#1
I've been using a modified form of RSI Agita (on an intraday basis) and would now like to work the short (overbought) side as well. To that end I "edited" the script to reverse directions. The script "compiles" properly but I've obviously missed something / done something in error b/c I can get no performance data;( I don't understand the function of the line:

CODE:
Please log in to see this code.


which I took to mean the lowest Rsi level that the program would buy )

Here is my "amended script" - please could somebody shoot down my bugs

CODE:
Please log in to see this code.


Thanks
profile picture

Eugene

#2
QUOTE:
CODE:
Please log in to see this code.

which I took to mean the lowest Rsi level that the program would buy )

No, this is an alternate way of saying "level = level - 5" in C#. You may want to take a look at the C# resources enumerated under "How do I start with C# ?" in WL5Wiki FAQs.

Therefore the following line will be adding 95 to level on every iteration of the loop instead of setting the upper boundary:
CODE:
Please log in to see this code.
profile picture

topcat77

#3
I'll carve some time out to invest in a C++ tutorial

Does that line instruct the program to add to positions for each 5 level change down?
(where "level" means rsi?)
So, if the script above were to be changed to :
level+=5;
would that be correct for a program which was looking to short overbought "levels"
Is there anything else that is incorrect in my script?
profile picture

Cone

#4
Here are the corrections (there are several)

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

topcat77

#5
Brilliant

except the compiler would not let the script say:

int level = overbought.ValueInt;

so, I changed it to:

level = overbought.ValueInt;

and it seems to work well

Thanks




profile picture

Cone

#6
It's because you didn't copy the entire script that I posted. You should.
profile picture

Jojo142

#7
I've wroten this short strategy and apply it in a stock, intraday 15...the last entrance of the strategy was in 19/5/2008 and my data base is until 29/1/2009...Do anyone know why? many times the RSI was over 70 during a long tme... TKX
profile picture

Eugene

#8
Please be specific. This is what we need:

How to report a Problem?
profile picture

Jojo142

#9
The stock is the Brazilian future indice . When i put this stategy on him, intraday 15 minutes, there are some trades at de biginning and it stops at 19/5/2008...I.ven t understand why...
profile picture

Jojo142

#10
another question for this strategy...how to modify the buying and selling instructions to be done at the close of the candle? sometimes the conditions to get out of the trading are ok in the last candle of the day and the strategy only says to operate at bar +1...TKX
profile picture

Jojo142

#11
FOr the last question I ' ve just find the solution..it was simple but i 'm starting in this strategy programs..sorry...
profile picture

Eugene

#12
Since there's only one exit rule and you don't feel like sharing your position sizing settings with us:
CODE:
Please log in to see this code.

Let me then suppose that RSI never crosses below 30.

QUOTE:
how to modify the buying and selling instructions to be done at the close of the candle?

Change the exit line to use CoverAtClose and bar.
profile picture

Jojo142

#13
For the RSI AGITA transformed in short : at the begining of 2008..many short position were taken and closed when the RSI was closing under the limit 30 specified. the last entrance was on 19/5/2008, closed on 23/5/08. After this date, many times the RSI was up to my limit 70 and no selling position was iniciated until today...If you want the data base i can send it to you.... :-)
profile picture

Eugene

#14
1) Look for open positions still not closed.
2) We don't need your database, but indicating your position sizing settings could help (see link in my post @
2/1/2009 2:09 PM).
profile picture

Jojo142

#15
Eugene, all the position are closed since 23/5/2008...that s the problem...
profile picture

Eugene

#16
Thank you for sending us your data file.

The CrossOver condition is not unique - apart from it, there are more rules that affect will the trade triggered or not. The Volume comparison rule is not applicable in your case, since your data series has no volume.

The key condition is that closing prices should be higher than last position entry price.
Add this line right below the int level = ... declaration:
CODE:
Please log in to see this code.


And you'll see that your lastEntryPrice is equal to 74230 when the trades stopped. Your futures market has dropped to 30,000-40,000 since then, so taking new trades is not an option.

P.S. Another strong reason for not taking trades can usually be in position sizing settings, but here it's not the case.
profile picture

Jojo142

#17
Hi Eugene, tkx for your help...I ve forgotten to tell you that I had suppress the condition of volume because has you said, I don t use this data, so you re right.
I understand what you tell me about "the key condition is that closing prices should be higher than last position entry price"... Ok, so I would like to change it, as it is in the RSI AGITA (inicial strategy for long positions)...If you see the first strategy , the closing price should be lower than last position entry price but only DURING THE TRADE...so what must I modify in this way?
profile picture

Eugene

#18
QUOTE:
Ok, so I would like to change it, as it is in the RSI AGITA (inicial strategy for long positions)...If you see the first strategy , the closing price should be lower than last position entry price but only DURING THE TRADE...so what must I modify in this way?

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

Jojo142

#19
Eugene..no trades are done now...where is the problem?

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

Cone

#20
CODE:
Please log in to see this code.


Well, I'm not following this entire thread, but the problem has to do with the lastEntryPrice filter condition.
profile picture

Jojo142

#21
Wonderful :-))...
One more question...if I run a strategy the performance is always very superior os the Profit$ shown in the "trades"...could you say me why?
profile picture

Eugene

#22
Oops. I mistakenly read Jojo142's idea the other way as "last position entry price should be lower than the closing price..." - therefore the .MaxValue and not .MinValue.

Good that Jojo142 noticed that and ignored my incorrect change:
QUOTE:
//if (Bars.Close[bar] > lastEntryPrice)
if (Bars.Close[bar] < lastEntryPrice)
profile picture

Jojo142

#23
Wonderful :-))...
One more question...if I run a strategy the performance is always very superior os the Profit$ shown in the "trades"...could you say me why?
for example in this strategy : Performance shown 119000 points, if I look at the trades, only 2500 points...why the diference?
profile picture

Eugene

#24
QUOTE:
if I look at the trades, only 2500 points

In the Trades list, what you see is a per-trade profit. On the other hand, the Performance tab shows an aggregated figure.

P.S. When copying to Excel/OpenOffice/whatever, make sure that all values are numerical and not marked as textual.
profile picture

Jojo142

#25
That was the point...
TKX a lot, Eugene , Cone...