| ApplyAutoStops |
Example:
|
' This system is based on Trend Detection Index indicator ' Always use the procedure ApplyAutoStops immediately after the "For ... " line. Sub Main() SetStopLoss(5) SetTrailingStop(5) For CurrentBar = BeginBar to EndBar ApplyAutoStops Value = GetValue("Trend Detection Index", CurrentBar) If (Value > 0) and (LastSignal <> 1) then If GetValue("Direction Indicator", CurrentBar) > 0 then Buy(CurrentDay) End If If Value < 0 then Sell(CurrentBar) If LastSignal = Signal then Neutral(CurrentBar) If VarSinceLastBuy < -4 then Sell(CurrentBar) Next End Sub |