Posted By: boatman
ExitLong/Short not behaving as expected - 07/24/14 10:28
Hi all
I am having some trouble getting the exitLong and exitShort functions to behave as I'd like them to. In the code below, 'Red' refers to a series of prices that I designate as the 'red line'. I want to exit longs if price closes below it, and exit shorts if price closes above it. This code doesn't seem to be working. Can anyone help?
Many thanks
I am having some trouble getting the exitLong and exitShort functions to behave as I'd like them to. In the code below, 'Red' refers to a series of prices that I designate as the 'red line'. I want to exit longs if price closes below it, and exit shorts if price closes above it. This code doesn't seem to be working. Can anyone help?
Many thanks
Code:
if (TradeIsLong and TradeResult > 0 and TradeTime > 1 and priceClose()< Red[0]) exitLong(0); if (TradeIsShort and TradeResult > 0 and TradeTime >1 and priceClose() > Red[0]) exitShort(0);