SetChartType(ChartType.HEIKIN_ASHI); # def haClose = ohlc4; def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2; def haHigh = Max(high, Max(haClose, haOpen)); def haLow = Min(low, Min(haClose, haOpen)); def haColor = haClose > haOpen; # #Addlabel(1,hacolor); # plot trendUp = haColor and !haColor[1]; #trendUp.SetDefaultColor(Color.CYAN); #trendUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); # plot trenddown = !haColor and haColor[1]; #trendDown.SetDefaultColor(Color.MAGENTA); #trendDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); # AddOrder(OrderType.Buy_To_Open, trendUp, close[1], 1, Color.MAGENTA,Color.MAGENTA, "BTO"); AddOrder(OrderType.Sell_To_Close, trenddown, close[2],1, Color.MAGENTA, Color.MAGENTA,"STC"); AddOrder(OrderType.Sell_To_Open, trenddown, close[1], 1,Color.MAGENTA,Color.MAGENTA,"STO"); AddOrder(OrderType.Buy_To_Close, trendup, close, 1,Color.MAGENTA,Color.MAGENTA,"BTC");