@dvorakm In order to exit a trade based on Heikin Ashi you need to define the Heikin Ashi prices within the Conditional Order script... That is the only way the code knows the Heikin Ashi values... Close in Heikin Ashi is actually
(Open + High + Low + Close) / 4, or
ohlc4... And close is the same as last until the candle closes... The following code is what I use in all of my Heikin Ashi scripts for...
Ruby:
def haClose = ohlc4;
def haOpen = (haOpen[1] + haClose[1]) / 2;
def haHigh = max(high, max(ha_close, ha_high));
def haLow = min(low, min(ha_open, ha_close));
thank you very much!
def haClose = ohlc4;
def haOpen = (haOpen[1] + haClose[1]) / 2;
def ha_high = max(high, max(haclose, ha_high));
def ha_low = min(low, min(haopen, haclose));
def haColor = haClose > haOpen;
def trendUp = haColor and haColor[1] and !haColor[2];
def trendDown = !haColor and !haColor[1] and haColor[2];
plot signal = trendDown;
I believe this would be correct to trigger a conditional order if there is currently a red Heikin Ashi, a red Heikin Ashi before that with a green Heikin Ashi before that. However, I can not get it to take in the conditional order config. It throws a invalid statement: def at 6:1, where it shows the code was deprecated. No matter how many times I paste it in there, it deprecates.