♥ 0 |
Hi Pete, Awhile ago you gave the code for a relative strength moving average. https://www.hahn-tech.com/ans/reference-an-indicator-dataset/ I’m trying to use it as a strategy and I’m not getting any buy order. Did I forget someting ? Of course, enabled is checked and position effect is “auto”. I’ve made both the long entry/exit as follow: Long entry: input CorrelationWithSecurity = “SPX”; input averageType = AverageType.EXPONENTIAL; input length = 21; def close2 = close(CorrelationWithSecurity); plot RS = if close2 == 0 then 0 else close/close2; RS.setDefaultColor(GetColor(6)); def sr = CompoundValue(“historical data” = RS, “visible data” = if isNaN(sr[1]) then RS else sr[1]); plot SRatio = sr; SRatio.setDefaultColor(GetColor(5)); plot ma = MovingAverage(averageType, RS, length); def rsma = ma [0]>ma[2]; AddOrder(OrderType.BUY_AUTO, rsma [0], open [-1], tickcolor = GetColor (0), arrowcolor = GetColor (0)) ; Long exit: same exept for: def rsma = ma[0] < ma[2] ; AddOrder(OrderType.SELL_AUTO, rsma [0], open [-1], tickcolor = GetColor (4), arrowcolor = GetColor (4)) ; Also, SPX is the default symbol in the code for the rs. Is there any way it can be the same as the one used in the relative strength moving average lower study ? Thank’s ! Louis
Marked as spam
|
Please log in to post questions.