Hi
How can I program this Heiki-indicator so I get a value that I can call for like I did in this code (https://www.prorealcode.com/topic/calling-indicator/) where it returns values? I want one value or when it goes red and one value when it turns green.
Found this screener from Nicolas (https://www.prorealcode.com/prorealtime-market-screeners/bullish-and-bearish-heiken-ashi-screener/) but can’t figure out how to get values that i can use in a system.
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
c1 = xClose>xOpen AND xClose[1]<xOpen[1]
c2 = xClose<xOpen AND xClose[1]>xOpen[1]
SCREENER [c1 OR c2]
Perhaps you mean something like this?
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
c1 = xClose>xOpen AND xClose[1]<xOpen[1]
c2 = xClose<xOpen AND xClose[1]>xOpen[1]
result = 0
if c1 then
result = 1
endif
if c2 then
result = -1
endif
return result
Thx… I and how do I call it in my system?
This should work. Change myIndicator to whatever you have called the indicator.
result = CALL "myIndicator"[(close)]
Personally I would just hard code such a simple indicator into my strategy.