Based on the idea.
viewtopic.php?f=27&t=63320Trade direction is defined by averages indicator color change.
If Evaluation Method is set to "Current"
Profitable Trade
Current price is greater than price on opening
If Evaluation Method is set to "Onward"
Profitable Trade
Price N Periods after opening, is greater than price on opening
Averages.lua is available here.
viewtopic.php?f=17&t=2430