Hi,
I have a general thinkscript question. Let's say i have the following code:
Now to exit, i want to check a few conditions only if i'm already in a trade. How do i know whether im already in a trade? A simple example might be: if im in a trade, and the current bar is x% higher than the opening trade bar, i want to exit. Im not sure how i would do this w/ TOS thinkscript code.
Any help would be appreciated.
Thanks
I have a general thinkscript question. Let's say i have the following code:
def macd = reference MACD(fastLength, slowLength, macdLength, averageType).Diff;
def macd_buy_sig = macd crosses above 0;
AddOrder(OrderType.BUY_TO_OPEN, macd_buy_sig, price = close, shares, tickcolor = Color.GREEN, arrowcolor = Color.GREEN);
Now to exit, i want to check a few conditions only if i'm already in a trade. How do i know whether im already in a trade? A simple example might be: if im in a trade, and the current bar is x% higher than the opening trade bar, i want to exit. Im not sure how i would do this w/ TOS thinkscript code.
Any help would be appreciated.
Thanks