Comparing an indicator to the value the previous day
Author: spekul8r
Creation Date: 10/17/2008 4:38 PM
profile picture

spekul8r

#1
Hello, I am trying to use the Drag and Drop method to build a Strategy and one of the things I need to do is to compare the current Value of the RSI to the value for the last 3 days. For example, I would like to know if the 5 period RSI has been dropping for 3 days. Is there a way to do that just with the drag and drop functionality or do I need to program the strategy code?

If I do need to program the strategy code then how whould I write this?

Thanks,
Mike
profile picture

Eugene

#2
1. "Create Strategy From Rules"
2. Select an Entry condition,
3. Go to "Conditions" tab
4. Open "General Indicators"
5. Drag and drop the following condition onto the entry: "Indicator decreases a consecutive number of bars"
6. "Click here to select an indicator", select RSI from the list
profile picture

spekul8r

#3
Ok, I got that. Thank you very much. One more question, let's say I want to verify that the value of the RSI 3 days ago was below 75, how would I do that?

Thanks again.
profile picture

spekul8r

#4
Never mind, I found the answer. I would use the Indicator is below its value a number of bars ago under General Conditions. Thanks
profile picture

spekul8r

#5
Actually I am still having a problem with the previous question. I want to verify that the value of the RSI 3 days ago was below 75, how would I do that?
profile picture

Cone

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


See also CrossOver and CrossUnder functions in the QuickRef.
profile picture

topcat77

#7
Continuing this line of enquiry, my (simple) breakout strategy wants to exit at increments (positive and negative) to the rsi of the break-out bar. So if the breakout bar - for instance, the bar that closed above the upper BB and therefore generated a buy signal - had an Rsi of 34 I would like to exit at the close of the bar that crossed over an Rsi of 34 plus or minus 5, whichever came first ( i.e sell at market when Rsi is over 39 or under 29) .

I'm have two probelems locating script for this logic - first, being able to reference the rsi of the bar that generated the buy signal (in my example rsi 34); second, contructing an oco exit that is not decribed in terms of price (eg sell at 2% gain / or 1% loss).

I'm including a drag-and-drop skeleton for the strategy (with an Rsi-based exit that I want to replace as above):

CODE:
Please log in to see this code.


profile picture

Cone

#8
QUOTE:
wants to exit at increments
What does that mean exactly?

QUOTE:
being able to reference the rsi of the bar that generated the buy signal
Create a variable to store the bar number when the BuyAtMarket signal is executed.

QUOTE:
would like to exit at the close of the bar that crossed over an Rsi of 34 plus or minus 5
Use the CrossOver/Under functions that I alluded to previously.

I still don't know what you mean about an incremental exit, but here's what I think you're after for the other two points -
CODE:
Please log in to see this code.
profile picture

topcat77

#9
This is exactly what I was aiming for.Thanks, and apologies for the clumsy description - next time I'll stick to English

I continue to be much impressed by WLab's range and versatility
profile picture

rb2trade

#10
I am looking for something along the lines of the original question here. I would like to use an indicator entrance/exit based on the indicator being x% greater/less than y days ago (i.e. ADX today is 5% > than ADX prior day). Any help/direction would be appreciated.
Thx, Brian
profile picture

Cone

#11
Brian,
When you're looping through the bars, the bar index is the current bar (today for a Daily series). So, bar - x is the index for any Data Series x bars (days) ago.

Example: Color the ADX Pane for ADX today 5% > ADX 8 days ago
CODE:
Please log in to see this code.

Please see the WealthScript Programming Guide for more the basics with useful examples.
profile picture

rb2trade

#12
Thanks, this is helpful...
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).