Hello,
I joined up after lurking for a bit and found this site to be useful. Thank you for having this form.
I have what I hope is a quick question. I'm trying to use hasearnings() in a strategy to sell the day before earnings and only buy my strategy if its a day after earnings or greater.
It seems like selling the day before is working but buying a day after does not seem to be working. This is what I have in thinkscript.
any help would be much appreciated.
Thank you
def EarningsBuy = sum(hasearnings()[1]);
def EarningsClose = sum(hasearnings()[-1]);
AddOrder(OrderType.BUY_TO_OPEN, EarningsBuy[1] , open[-1], tickcolor = GetColor(0), arrowcolor = GetColor(0), name = "Long-Buy "+ close);
AddOrder(OrderType.SELL_TO_CLOSE, EarningsClose[-1], open[-1], tickcolor = GetColor(4), arrowcolor = GetColor(4), name = "Earnings-Close ");
I joined up after lurking for a bit and found this site to be useful. Thank you for having this form.
I have what I hope is a quick question. I'm trying to use hasearnings() in a strategy to sell the day before earnings and only buy my strategy if its a day after earnings or greater.
It seems like selling the day before is working but buying a day after does not seem to be working. This is what I have in thinkscript.
any help would be much appreciated.
Thank you
def EarningsBuy = sum(hasearnings()[1]);
def EarningsClose = sum(hasearnings()[-1]);
AddOrder(OrderType.BUY_TO_OPEN, EarningsBuy[1] , open[-1], tickcolor = GetColor(0), arrowcolor = GetColor(0), name = "Long-Buy "+ close);
AddOrder(OrderType.SELL_TO_CLOSE, EarningsClose[-1], open[-1], tickcolor = GetColor(4), arrowcolor = GetColor(4), name = "Earnings-Close ");
Last edited by a moderator: