never_noob
New member
Hi all, new to Thinkscript. I am working on a strategy in TS where I have my normal long/short exits defined, but I would like to also add stop losses. In particular, I want to close my longs if the current price goes below the the low of any the preceding 3 bars and cover my shorts if the current price goes above the high of any of the preceding bars. I seem to be stuck because I can't find any value that's just "current price" or even "last".
I think the function I want for defining my stop price is "Lowest(low,3)" and "Highest(high,3)", but can't figure out the right trigger to get the orders to actually be incorporated into the code. I tried just entering them with the same conditions I have for my BUY_AUTO and SELL_AUTO orders, but that didn't work.
I'm sure I'm missing something really simple here, but I can't quite figure it out. Can someone point me in the right direction?
I think the function I want for defining my stop price is "Lowest(low,3)" and "Highest(high,3)", but can't figure out the right trigger to get the orders to actually be incorporated into the code. I tried just entering them with the same conditions I have for my BUY_AUTO and SELL_AUTO orders, but that didn't work.
I'm sure I'm missing something really simple here, but I can't quite figure it out. Can someone point me in the right direction?