I'm trying to set my profit and stop losses using the entry price for an order, however, entryPrice() always returns NaN; even when an order is active.
Even in the simple example below, EntryPrice() always returns NaN.
What am I missing or doing wrong?
Even in the simple example below, EntryPrice() always returns NaN.
What am I missing or doing wrong?
Code:
input price = close;
input length = 14;
input over_bought = 70;
input over_sold = 30;
input rsiAverageType = AverageType.WILDERS;
def rsi = reference RSI(price = price, length = length, averageType = rsiAverageType);
AddOrder(OrderType.BUY_AUTO, rsi crosses above over_sold, tickColor = GetColor(0), arrowColor = GetColor(0), name = "RSI_LE");
AddOrder(OrderType.SELL_AUTO, rsi crosses below over_bought, tickColor = GetColor(1), arrowColor = GetColor(1), name = "RSI_SE");
addLabel(yes,entryPrice());