So I've recently taken a step to make my trading more reliable and hopefully more successful. I am trying out Multicharts and one of the features I wish to use is the backtesting feature. It seems, that to use this feature I have to learn "easylanguage" to write my strategy. So I did some reading on the internet and jumped right in the deep end and wrote my first easylanguage strategy. First the strategy:
Show Stocks where RSI(2) is below 5
and price is above 5.00
and average volume(21) is above 250000
and close reached a new 10 day low
and close less than MA(5)
and close less than MA(200)
and close has been decreasing for 5 days
and where ADX(10) is above 30
This is what I have so far:
Now here are my questions:
1. How do I code this "and price reached a new 10 day low".
2. How do I code this "and price has been decreasing for 5 days."
3. I am having trouble with coding the position size and entries as well as the exits. But I will save that for another post.
4. Essentially when backtesting and maybe in future in automated trading, I want this strategy to pick 4-6 stocks (depending on my current positions and position size) from any of the stocks in the NYSE, NASDAQ or AMEX that fill the criteria. I want the strategy to constantly scan all these stocks and buy the ones that best fulfill my criteria.
So initially I just want to make sure that the strategy criteria are correct first and get some answers.
I'm a TradeStation user but I believe the easylanguage code is the same across platforms so see if this helps:
*note: the code below assumes you're using daily bars. If you were not using daily bars then you can use LowD and CloseD to access the daily values on an intraday chart.
1) I would use the "Lowest" function:
2) Probably at least two ways to do this and I'm not sure which method represents what you're after so you can decide:
Method 1: this will only check if the current close is lower than the close 5 periods ago
Method 2: this will ensure the last five consecutive closes are each lower than the previous