Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
How to I keep the variable once an event occurred? For example, once RSI becomes overbought, I want the condition1 = true, and then look for breakouts.
A simple "if RSI (close, 14) < 30 then condition1 = true" doesn't work, because in the next several bars it can move above 30, while the breakout I want hasn't happened.
How do I keep the condition or a variable the same once it occurred, even if it changes in the next several bars?
Can you help answer these questions from other members on NexusFi?
Thanks for the replies. I suspect I am not terribly bright when it comes to coding. Currently I am struggling with another code, sort of related to the earlier one.
I am trying to get the strategy to go long if both RSI of weekly and RSI of daily price are below a value. I thought the code should be as simple as that:
If RSI (close, length) < 30 AND RSI (close of Data2, length) < 10 then buy this bar at close; //Default timeframe is daily, Data2 is weekly
For some reason it doesn't work, and the strategy doesn't take trades. I tried RSI (close of data2, length[1] and CloseW (1). Doesn't work. What am I missing? Should I assign a variable to the weekly rsi and use that instead? As in RSI (close of data2, length) = o_sold; if 0_sold <=10 the buy etc.
I would suggest starting with the free EasyLanguage Essentials PDF that will give you a good, solid foundation of the basics. This includes how you can correctly compute functions on secondary data series.
As previously suggested, use the print reserved word to check what is going on within your code i.e. are conditions fulfilled or not, are values different than you think they should be etc.. This usually is an invaluable tool for tracking code issues down.