I am having some problems with using strategy.entry
//Condition
prev_color = hmacolor[1]
if (hmacolor == #00ccff and prev_color == #ff0055)
strategy.entry("Long", strategy.long)
if (hmacolor == #ff0055 and prev_color == #00ccff)
strategy.entry("Short", strategy.short)
I want to Entry only in the Strategy, if the previous color is different than the actual color. Now I get an Alert for every candle, but I only want to get an alert if the color of the line changes.
I get an Alert for every candle, but I only want to get an alert if the color of the line changes. If it changes from red to green, it means Long, if it changes from green to red, it means Short Alert.
//Condition
if (hmacolor == #00ccff and hmacolor[1] != #00ccff)
strategy.entry("Long", strategy.long)
if (hmacolor == #ff0055 and hmacolor[1] != #ff0055)
strategy.entry("Short", strategy.short)