Is it possible to create a script
1. moves a trend line with a set moving average.
2 the trend line should be one candle ahead of the last candle and stretch back for 4 candles
3 the trend line properties require three names depending on its orientation trending up (BUY1) / trending down (SELL1) / flat (NOTRADE) ( think this is the hard bit)
See picture.