[Amibroker新手日誌][函式]ApplyStop
- ApplyStop( Type, Mode, amount,ExitAtStop,volatile,ReEntryDelay)
- Type
- 0 stopTypeLoss: 達到最大損失時停損
- 1 stopTypeProfit : 達到獲利目標時,停利
- 2 stopTypeTrail : 追縱止損
- 3 stopTypeNBar : 第n bar 出場
- Mode
- 0 – stopModeDisable :不停損
- 1 stopModePercent stopModeBars : 依百分比停損,或依bar數停損
- 2 stopModePoint:依點數停損
- 3 risk : 依獲利(損失)成數停損
- amount
- ExitAtStop
- 0 check stops using only trade price and exit at regular trade price 用交易價格檢查是否停損,且在特定交易價格出場
- 1 check High-Low prices and exit intraday on price equal to stop level on the same bar when stop was triggered 當停損被驅動的時候,當天會出場
- 2 check High-Low prices but exit NEXT BAR on regular trade price.當停損被驅動的時候,下1個Bar出場
- volatile(true/false) : false 靜態 / true動態
- ReEntryDelay: 停損發生之後,要等多少bar才能出場
- 設定範例
- Scenario 1: 你想要交易在下一個bar的開盤價,然後在當天以停損價出場
- stopModeDisable = 1 (ActivateStopsImmediately turned ON)
- ExitAtStop =1 (當天出場)
- Trade delays set to one
- Trade price set to open
- Scenario 2: 你想要在今天以收盤價交易,然後當天以停損價出場
- ActivateStopsImmediately turned OFF
- ExitAtStop = 1
- Trade delays set to zero
- Trade price set to close
- Scenario 3: 你想要在隔天的開盤交易,然後在如果開盤價落在前天高低價之間就以開盤價停損出場
- ExitAtStop = 2 (NEW)
- Trade delays set to one
- Trade price set to open
- a) (if you want to have stops executed AFTER regular signals, so cash from stopped out positions is NOT available to enter trades the same day)
ActivateStopsImmediately turned ON - b) (if you want to have stops executed BEFORE regular signals, so cash from stopped out positions IS available to enter new trades the same day)
ActivateStopsImmediately turned OFF - Scenario 4: 你想要在今天以收盤價交易,然後若當天的收盤到停損價,就出場
- ActivateStopsImmediately turned OFF
- ExitAtStop = 0
- Trade delays set to zero
- Trade price set to close