I am playing around with thinkscript strategies. This one buy with a EMA crossing and ADX > x
And it sells with another EMA crossing below. So far so good.
I like to close it with a parabolic SAR, but have no idea how to write that as it doesn't seem to touch or cross anything.
Part of code:
And it sells with another EMA crossing below. So far so good.
I like to close it with a parabolic SAR, but have no idea how to write that as it doesn't seem to touch or cross anything.
Part of code:
Code:
def cond_1 = price crosses above emaLong;
def cond_2 = adxRef > adxBuy;
addOrder(OrderType.BUY_TO_OPEN, cond_1 and cond_2, tickColor = Color.BLUE, arrowColor = Color.BLUE, name = "open", tradeSize = tradeSize);
AddOrder(OrderType.SELL_TO_CLOSE, price crosses below emaShort, tickColor = Color.ORANGE, arrowColor = Color.ORANGE, name = "close", tradeSize = tradeSize);