├── MC內建函數中文說明 ├── README.md ├── 【指標】%B ├── 【指標】@Angle Power ├── 【指標】PL8力道K線指標 ├── 【指標】價差指標進出場 ├── 【指標】冰火能量圖 ├── 【指標】預估成交量 ├── 【訊號】MTM策略星 ├── 【訊號】區間突破進場階梯式出場 by Ray's ├── 【訊號】慢速KD交叉 ├── 【訊號】特定比例順勢突破當沖 by Ray's ├── 【訊號】突破+50-20 by Angel chen ├── 【訊號】突破10根K棒YCTSENG ├── 【訊號】跳空進場Bituzi ├── 【訊號】連續3根K棒+布林軌道斜率 └── 【訊號】連續K棒上漲下跌ey90223 /MC內建函數中文說明: -------------------------------------------------------------------------------- 1 | 2 | 目錄 函數名稱 說明 3 | A AbsoluteBreadth 依上漲家數和下跌家數計算市場功能 4 | AccumDist 進貨/出貨函數,分析資金流向,找出市場多空方向 5 | AccumSwingIndex 計算累計的 SwingIndex 值 6 | AdaptiveMovAvg 計算最佳移動平均 7 | AdvanceDeclineDiff 累計的上漲家數和下跌家數之和 8 | AdvanceDeclineRatio 上漲家數和下跌家數的比率 9 | ADX 平均動向指數 10 | ADXClassic 原始的平均動向指數定義公式 11 | ADXCustom 和 ADX 相同,但可自訂計算DMI的數列 12 | ADXCustomClassic 和 ADXClassic 相同,但可自訂計算 DMI 的數列 13 | ADXR 平均動向指數評估 14 | ADXRClassic 原始的平均動向指數評估定義公式 15 | ADXRCustom 和 ADXR 相同,但可自訂計算DMI的數列 16 | ADXRCustomClassic 和 ADXRClassic 相同,但可自訂計算DMI的數列 17 | ArmsIndex 阿姆斯指數,漲跌家數和漲跌量的比率 18 | Average 計算數列的簡單移動平均 19 | Average_a 計算陣列的簡單移動平均 20 | AverageArray 計算陣列的簡單移動平均 21 | AverageDnMove 平均下跌幅度 22 | AverageFC 快速計算的簡單移動平均 23 | AverageUpMove 平均上漲幅度 24 | AvgDeviation 計算數列的平均絕對偏差 25 | AvgDeviation_a 計算陣列的平均絕對偏差 26 | AvgDeviationArray 計算陣列的平均絕對偏差 27 | AvgPrice 計算K棒開高低收的均價 28 | AvgTrueRange 平均真實波幅 29 |       30 | B BarAnnualization 取得目前週期的年化因數 31 | BarNumber 目前K棒的編號 32 | BarQuality 有效K棒占總K棒的百分比 33 | BearishDivergence 熊市背離 34 | BearishEngulfing 空頭吞噬 35 | BjerkStenCall 以 Bjerksund & Stensland 模型計算美式買權的理論價 36 | BjerkStenPhi BjerkStenCall 的子函數 37 | BlackModel 以 Black 模型計算歐式期貨選擇權理論價 38 | BlackScholes 以 Black-Scholes 模式計算歐式選擇權理論價 39 | BollingBand 計算布林格通道價格 40 | BullishDivergence 牛市背離 41 | BullishEngulfing 多頭吞噬 42 | BussinessDays 計算有多少個營業日 43 |       44 | C C_3WhSolds_3BlkCrows 三白兵或三烏鴉 45 | C_BullEng_BearEng 多頭吞噬或空頭吞噬 46 | C_BullHar_BearHar 多頭母子或空頭母子 47 | C_Doji 十字線 48 | C_Hammer_HangingMan 錘子或吊人 49 | C_MornDoji_EveDoji 晨星十字或夜星十字 50 | C_PierceLine_DkCloud 曙光初現或烏雲罩頂 51 | C_ShootingStar 流星 52 | CalcDate 以參考日期計算新的日期 53 | CalcTime 以參考時間計算新的 HHMM 時間 54 | CalcTime_s 以參考時間計算新的 HHMMSS 時間 55 | CCI 順勢指標 56 | CCIClassic 原始的順勢指標定義公式 57 | ChaikinOsc 蔡金擺動指標 58 | CloseD 日線收盤價 59 | CloseM 月線收盤價 60 | CloseW 周線收盤價 61 | CloseY 年線收盤價 62 | CoefficientR 計算數列的相關係數 63 | CoefficientRArray 計算陣列的相關係數 64 | CoefficientREasy 計算數列的相關係數(只用一個數列) 65 | coefR 計算收盤價數列的相關係數 66 | coefR_a 計算陣列的相關係數 67 | Combination 計算組合的個數 68 | CopyColumn 複製二維陣列中的元素 69 | Correlation 計算二個數列的相關性 70 | Correlation_a 計算二個陣列的相關性 71 | CorrelationArray 計算二個陣列的相關性 72 | CounterTrendStocks 73 | CountIf 計算符合條件的次數 74 | Covar 計算兩個數列的共變數 75 | CovarArray 計算兩個陣列的共變數 76 | CovarEasy 計算數列的共變數(只用一個數列) 77 | Covariance 計算二個數列的共變異數 78 | Covariance_a 計算二個陣列的共變異數 79 | CSI 股票選擇指標 80 | CSIClassic 原始的股票選擇指標定義公式 81 | Cum 累加指定數列 82 | CurrentAsk 即時賣價 83 | CurrentBid 即時買價 84 | CurrentSession 目前交易時段 85 | CurrentSessionMS 目前合併的交易時段 86 |       87 | D DailyLosers 指定日期的虧損交易次數 88 | DailyWinners 指定日期的獲利交易次數 89 | DarkCloud 烏雲罩頂 90 | DaysOfWeekFix 星期幾 91 | DaysToExpiration 計算股票選擇權的到期天數 92 | Delta 計算選擇權的 Delta 93 | Detrend 區間震盪指標 94 | DevSqrd 計算數列離差的平方和 95 | DevSqrd_a 計算陣列離差的平方和 96 | DevSqrdArray 計算陣列離差的平方和 97 | DirMovement 計算 Welles Wilder 的動向指標 98 | Divergence 計算是否出現背離現象 99 | DMI 動向指標 100 | DMICustom 和 DMI 相同,但可自訂計算 DMI 的數列 101 | DMIMinus ‐DI 102 | DMIMinusCustom 和 ‐DI 相同,但可自訂計算的數列 103 | DMIPlus +DI 104 | DMIPlusCustom 和 +DI 相同,但可自訂計算的數列 105 | Doji 十字線 106 |       107 | E EaseOfMovrment 簡易波動指標 108 | ELDate 轉換成 YYYMMDD 的日期 109 | ELDate_Consol 將 YYYYMMDD 日期轉換成 YYYMMDD 日期 110 | ELDateToString 將 YYYMMDD 轉換成 MM/DD/YYYY 的字串 111 | EntireHigh 傳回波段的最高收盤價 112 | EntireToday 指定日期的進場次數 113 | EveningStar 晨星 114 | ExitsToday 指定日期的出場次數 115 | ExtremePrice 區間端點最高價/區間端點最低價 116 | ExtremePriceRatio 區間最高價/區間最低價 117 | Extremes 計算出現數列極值的價格和K棒編號 118 | ExtremesArray 計算出現陣列極值的價格和K棒編號 119 | ExtremesFC 快速計算出現數列極值的價格和K棒編號 120 |       121 | F Factorial 階乘 122 | FastD 隨機指標的 FastD 123 | FastDClassic 原始的隨機指標 FastD 定義公式 124 | FastDCustom 和 FastD 相同,但可自訂計算的數列 125 | FastDCustomOrig 和 FastDClassic 相同,但可自訂計算的數列 126 | FastHighestBar 快速計算數列最高價的 K 棒位置 127 | FastK 隨機指標的 FastK 128 | FastKCustom 和 FastK 相同,但可自訂計算的數列 129 | FastKCustomEasy 僅用一個數列計算 FastK 130 | FastKCustomOrig 原始的隨機指標 FastK 定義公式,但可自訂計算的數列 131 | FastLowestBar 快速計算數列最低價的 K 棒位置 132 | FindBar 找出指定日期時間的 K 棒位置 133 | FirstofMonthJul 當月月初的儒略日 134 | FirstofNextMonthJul 次月月初的儒略日 135 | FirstofPrevMonthJul 前月月初的儒略日 136 | FirstSession 星期幾第一個交易時段的編號 137 | FirstSessiomMS 星期幾第一個合併交易時段的編號 138 | Fisher 將相關係數做費雪轉換 139 | FisherINV 反轉費雪轉換 140 |       141 | G Gamma 計算選擇權的 Gamma 142 | GCD 最大公因數 143 | GenerateStrike 計算指定間距的選擇權履約價 144 | GetRGBValues 從 RGB 色碼取得三原色 145 |       146 | H Hammer 錘子 147 | HangingMan 吊人 148 | HarmonicMean 計算數列的調和平均數 149 | HarmonicMean_a 計算陣列的調和平均數 150 | HarmonicMeanArray 計算陣列的調和平均數 151 | HeapPush HeapSift 的子函數,用於一維陣列的堆積排序法 152 | HeapPush2D HeapSift2D 的子函數,用於二維陣列的堆積排序法 153 | HeapSift SortHeapArray 的子函數,用於一維陣列的堆積排序法 154 | HeapSift2D SortHeap2DArray 的子函數,用於二維陣列的堆積排序法 155 | HighD 日線最高價 156 | HighDGen 數列 N 的日線最高價 157 | Highest 取得數列的區間最高價 158 | Highest_a 取得陣列的區間最高價 159 | HighestArray 取得陣列的區間最高價 160 | HighestBar 取得數列最高價的 K 棒位置 161 | HighestFC 快速計算數列的區間最高價 162 | HighM 月線最高價 163 | HighW 周線最高價 164 | HighY 年線最高價 165 | HPI 海利克精指數 166 |       167 | I IFF IF 的函數 168 | IFFLogic IF 的函數,傳回值為布林值 169 | IffString IF 的函數,傳回值為字串 170 | ImpliedVolatility 計算選擇權的隱含波動率 171 | Intrisic 計算選擇權的內含價值 172 | IsWorkDay 是否為營業日(週一至週五) 173 |       174 | K KeltnerChannel 肯特納通道 175 | Kurtosis 計算數列的峰度 176 | Kurtosis_a 計算陣列的峰度 177 | KurtosisArray 計算陣列的峰度 178 | KurtosisOpt 計算數列的峰度 179 |       180 | L LastBarOnChart 是否為走勢圖上最後一根 K 棒 181 | LastBarOnChart_s 是否為走勢圖上最後一根 K 棒,用在分線一下的週期 182 | LastCalcDate 最後一根完成 K 棒的日期 183 | LastCalcTime 最後一根完成 K 棒的時間(HHMM) 184 | LastCalcTime_s 最後一根完成 K 棒的時間(HHMMSS) 185 | LastDayOfMonth 傳回指定月份的最後一天(不考慮瑞年) 186 | LastHour 目前 K 棒時間是否為交易時段的最後一小時 187 | LastSession 傳回指定日期最後一個交易時段的編號 188 | LastSessionMS 傳回指定日期最後一個合併交易時段的編號 189 | Leader 判斷 K 棒的中點是否高於昨高或低於昨低 190 | LinearReg 計算數列回歸線的斜率、角度及回歸值 191 | LinearRegAngle 計算數列回歸線的角度 192 | LinearRegAngleFC 快速計算數列回歸線的角度 193 | LinearRegFC 快速計算數列回歸線的斜率、角度及回歸值 194 | LinearRegLine 繪製回歸線 195 | LinearRegSlope 計算數列回歸線的斜率 196 | LinearRegSlopeFC 快速計算數列回歸線的斜率 197 | LinearRegValue 計算數列回歸線的回歸值 198 | LinearRegValueFC 快速計算數列回歸線的回歸值 199 | LinRegAngleArray 計算陣列回歸線的角度 200 | LinRegAngleArray2 利用最小平方法計算陣列回歸線的角度 201 | LinRegArray 計算陣列回歸線的斜率、角度及回歸值 202 | LinRegArray2 利用最小平方法計算陣列回歸線的斜率、角度及回傳值 203 | LinRegForecast_a 計算陣列回歸線的回歸值 204 | LinRegForecastArray 計算陣列回歸線的回歸值 205 | LinRegForecastArray2 利用最小平方法計算陣列回歸線的回歸值 206 | LinRegInterceptArray2 利用最小平方法計算陣列回歸線在價格軸的截距 207 | LinRegIntercept_a 計算陣列回歸線在價格軸的截距 208 | LinRegInterceptArray 計算陣列回歸線在價格軸的截距 209 | LinRegSlope_a 計算陣列回歸線的斜率 210 | LinRegSlopeArray 計算陣列回歸線的斜率 211 | LinRegSlopeArray2 利用最小平方法計算陣列回歸線的斜率 212 | LowD 日線最低價 213 | LowDGen 數列 N 的日線最低價 214 | Lowest 數列區間最低價 215 | Lowest_a 陣列最低價 216 | LowestArray 陣列最低價 217 | LowestBar 數列區間最低價的位置 218 | LowestFC 快速計算數列區間最低價 219 | LowM 月線最低價 220 | LowW 周線最低價 221 | LowY 年線最低價 222 | LRO 指定區間內,條件最先成立的位置 223 | LWAccDis Larry Williams 版本的進貨/出貨函數 224 |       225 | M MACD 計算快速移動平均和慢速移動平均的差值 226 | MassIndex 重量指數 227 | McClellanOsc McClellan 市場廣度指標 228 | Median 計算數列的中位數 229 | Median_a 計算陣列的中位數 230 | MedianArray 計算陣列的中位數 231 | MedianPrice 計算 K 棒中價 232 | MFI K 棒區間除以成交量 233 | MidPoint 傳回數列在指定區間內的中價 234 | MinutesIntoWeek 將時間以每週的第幾分鐘表示 235 | MinutesToTime 將分鐘表示的時間轉換成 HHMM 的格式 236 | Mode 傳回數列在指定區間最出現最多的值 237 | Mode_a 傳回陣列在指定區間最出現最多的值 238 | ModeArray 傳回陣列在指定區間最出現最多的值 239 | Momentum 計算數列在區間內的變動 240 | MoneyFlow 資金流量指標 241 | MRO 指定區間內,條件最近成立的位置 242 | MyPrice K 棒高、低、收的平均價 243 |       244 | N Next3rdFirday 計算到下次每月第三個週五的天數 245 | NormalCumDensity 指定價格、平均數及標準差,計算常態累積分配 246 | NormalCumDensity_a 指定價格及陣列,計算常態累積分配 247 | NormalDensity 指定價格、平均數及標準差,計算常態機率密度 248 | NormalDensity_a 指定價格及陣列,計算常態機率密度 249 | NormalSCDensity 由價格計算標準常態累積分配 250 | NormCumDensity 計算數列的常態累積分配 251 | NormCumDensityArray 計算陣列的常態累積分配 252 | NormDensity 計算數列的常態機率密度 253 | NormDensityArray 計算陣列的常態機率密度 254 | NormGradientColor 利用常態分配取得漸增色彩 255 | NormSCDensity 由價格計算標準常態累積分配 256 | NthDayofMonth 由指定日期起算,第幾個星期幾 257 | NthEtremes 取得指定區間內的第 N 個最高值或最低值 258 | NthEtremesArray 取得陣列的第 N 個最高值或最低值 259 | NthHighest 取得數列區間內的第 N 個最高值 260 | NthHighest_a 取得陣列的第 N 個最高值 261 | NthHighestArray 取得陣列的第 N 個最高值 262 | NthHighestBar 取得數列區間內第 N 個最高值的位置 263 | NthLowest 取得數列區間內第 N 個最低值 264 | NthLowest_a 取得陣列的第 N 個最低值 265 | NthLowestArray 取得陣列的第 N 個最低值 266 | NthLowestBar 取得數列區間內第 N 個最高低的位置 267 | NumericRank 計算價格在數列內的排序位置 268 | NumericRankArray 計算價格在陣列內的排序位置 269 | NumUnits 依資金及交易單位取得可交易的單位數 270 |       271 | O OBV 計算 OBV 指標 272 | OHLCPeriodsAgo 取得過去 K 棒的開高低收價 273 | OHLCPeriodsAgoGen 取得數列 N 過去 K 棒的開高低收價 274 | OneAlert 在條件符合時,每根 K 棒只送出一次警示 275 | OpenD 日線開盤價 276 | OpenM 月線開盤價 277 | OpenW 周線開盤價 278 | OpenY 年線開盤價 279 | OptionPrice 計算選擇權理論價(會依輸入參數自動決定計算模型) 280 | OptionsComplex 利用 BlackScholes 模型計算選擇權理論價及希臘字母 281 | OS_Intrinsic 計算選擇權的內含價值 282 | Outside 子母線 283 |       284 | P Parabolic SAR 285 | ParabolicCustom 和 SAR 相同,但可自訂計算的數列 286 | ParabolicSAR 傳回當根及次根 K 棒的 SAR 參考價 287 | PartSessionCountDay 傳回當天沒有同時具有開盤和收盤的交易時段 288 | Pennant 三角收斂 289 | PercentChange 價格變動率 290 | Percentile 計算數列的百分位數 291 | Percentile_a 計算陣列的百分位數 292 | PercentileArray 計算陣列的百分位數 293 | PercentR 威廉指標 294 | PercentRank 計算價格在數列中的百分等級 295 | PercentRank_a 計算價格在陣列中的百分等級 296 | PercentRankArray 計算價格在陣列中的百分等級 297 | Permutation 計算排列的個數 298 | Pivot 計算最近的反轉點的價格 K 棒位置 299 | PivotHighVS 計算最近的反轉高點的價格 300 | PivotHighVSBar 計算最近的反轉高點的 K 棒位置 301 | PivotLowVS 計算最近的反轉低點的價格 302 | PivotLowVSBar 計算最近的反轉低點的 K 棒位置 303 | PivotReversalGen 傳回最近突破的高點或低點的價格及強度 304 | PositionProfitCustom 依指定價格數列計算部位損益 305 | PriceOscillator 計算快速移動平均及慢速移動平均的差距 306 | PriceVolTrend 價量趨勢指標 307 | ProbAbove 依波動率計算未來價格會大於等於特定價位的機率 308 | ProbBelow 依波動率計算未來價格會小於等於特定價位的機率 309 | ProbBetween 依波動率計算未來價格會特定價格區間內的機率 310 |       311 | Q QualityBar 有效的 K 棒 312 | Quartile 計算數列的四分位數 313 | Quartile_a 計算陣列的四分位數 314 | QuartileArray 計算陣列的四分位數 315 |       316 | R Range 計算 K 棒的高低價差 317 | RangeLeader 判斷 K 棒的中點是否高於昨高或低於昨低且 K 棒高低價差變大 318 | Rank 取得數列中指定排名的數值 319 | Rank_a 取得陣列中指定排名的數值 320 | RateOfChange 價格變動率(單位為百分點) 321 | RecentOcc MRO 和 LRO 的子函數 322 | Rho 計算選擇權的 Rho 323 | Ring 前六根 K 棒內出現一個轉折低點,且目前 K 棒低於前一根 K 棒 324 | Round2Fraction 四捨五入到最小的價格刻度 325 | RS_Average 在日內週期取得日線資料資料的平均值 326 | RS_BarsPerDay 每日 K 棒數量 327 | RS_DailyDataArray 在日內週期取得日線資料資料的供其他 RS 函數使用 328 | RS_Extremes 在日內週期取得日線資料資料的極值 329 | RS_PriceExtension 日線延伸的方向 330 | RS_ReversalPatterns 找出日線反轉類型 331 | RS_TrueExtremes 從 RS_DailyDataArray 的陣列中整理出最高價、最低價及平均真實波幅 332 | RSI RSI 指標 333 | RSIClassic 原始的 RSI 定義公式 334 | RSquare 計算數列 R Square 335 | RSquareArray 計算陣列 R Square 336 | RSquared 計算收盤價的 R Square 337 | Rsquared_a 計算陣列 R Square 338 |       339 | S SecondsToTime 將 HHMM 轉換成以秒數表示 340 | SecondsToTime_s 將 HHMMSS 轉換成以秒數表示 341 | SerFunc 遞增值(每次呼叫就自動加 1 後回傳) 342 | SerialHighsLows 創新高新低的 K 棒比率 343 | SessionCountDay 傳回指定星期幾所含完整交易時段的數量 344 | SessionFirstBarTime 傳回指定交易時段的第一根 K 棒時間 345 | ShootingBar 晨星 346 | ShowLongStop 在圖表上顯示多單停損的文字 347 | ShowShortStop 在圖表上顯示空單停損的文字 348 | Skew 傳回一個數列分配的偏態 349 | Skew_a 傳回一個陣列分配的偏態 350 | SkewArray 傳回一個陣列分配的偏態 351 | SkewOpt 數列的最佳偏態 352 | SlowD 隨機指標的 SlowD 353 | SlowDClassic 原始的隨機指標 SlowD 定義公式 354 | SlowDCustom 和 SlowD 相同,但可自訂計算的數列 355 | SlowDCustomOrig 原始的隨機指標 SlowD 定義公式,但可自訂計算的數列 356 | SlowK 隨機指標的 SlowK 357 | SlowKClassic 原始的隨機指標 SlowK 定義公式 358 | SlowKCustom 和 SlowK 相同,但可自訂計算的數列 359 | SlowKCustomOrig 原始的隨機指標 SlowK 定義公式,但可自訂計算的數列 360 | SmoothedAverage 平滑簡單移動平均 361 | SnapFundValid 362 | Sort2DArray 排序二維陣列 363 | SortArray 排序一維陣列 364 | SortDown_a 遞減排序一維陣列 365 | SortHeap2DArray 以堆積排序法排序二維陣列 366 | SortHeapArray 以堆積排序法排序一維陣列 367 | SortUp_a 遞增排序一維陣列 368 | StandardDev 計算數列的標準差 369 | StandardDevAnnual 計算數列的年化標準差 370 | StandardDevArray 計算陣列的標準差 371 | StandardError 計算數列的標準誤 372 | StandardError_a 計算陣列的標準誤 373 | Standardize 傳回數列標準化常態分配的值 374 | Standardize_a 傳回陣列標準化常態分配的值 375 | StandardizeArray 傳回陣列標準化常態分配的值 376 | StdDev 計算數列的母體標準差 377 | StdDevP_a 計算陣列的母體標準差 378 | StdDevPAnnualized 計算數列的年化母體標準差 379 | StdDevS 計算數列的樣本標準差 380 | StdDevS_a 計算陣列的樣本標準差 381 | StdDevSAnnualized 計算數列的年化樣本標準差 382 | StdError 計算數列的標準誤 383 | StdErrorArray 計算一維陣列的標準誤 384 | StdErrorArray2 計算二維陣列的標準誤 385 | Stochastic 隨機指標(FastK、FastD、SlowK、SlowD) 386 | StochasticExp 以指數移動平均方式計算隨機指標(FastD、SlowD) 387 | StrColorToNum 將代表顏色的字串轉換對應的數值 388 | Summation 計算數列的總和 389 | Summation_a 計算陣列的總和 390 | SummationArray 計算陣列的總和 391 | SummationFC 快速計算數列的總和 392 | SummationIf 計算數列符合特定條件的總和 393 | SummationRecArray 計算陣列的倒數總和 394 | SummationSqrArray 計算陣列的平方總和 395 | SwingHigh 找出數列的轉折高價 396 | SwingHighBar 找出數列的轉折高點 K 棒位置 397 | SwingIndex 利用 +100 到 -100 的數值表示市場的方向及強弱 398 | SwingLow 找出數列的轉折低價 399 | SwingLowBar 找出數列的轉折低點 K 棒位置 400 |       401 | T TDirec 402 | Text_Exist 檢查指定的文字物件是否存在 403 | Text_Float 將文字物件固定在書面上的固定位置 404 | Theta 計算選擇權的 Theta 405 | TimeSeriesForecast 計算回歸線的投影值 406 | TimeToMinutes 將 HHMM 的時間轉成以分鐘表示 407 | TimeToSeconds 將 HHMMSS 的時間轉成以秒表示 408 | TL_Exist 檢查指定的趨勢線物件是否存在 409 | TLAngle 計算趨勢線的角度 410 | TLAngleEasy 計算趨勢顯得角度(僅能指定一個數列) 411 | TLSlope 計算趨勢線的斜率 412 | TLSlopeEasy 計算趨勢線的斜率(僅能指定一個數列) 413 | TLValue 計算趨勢線的對應價格 414 | TLValueEasy 計算趨勢線的對應價格(僅能指定一個數列) 415 | TrendingStocks 416 | TriAverage 三角移動平均(中央權重較重) 417 | TriAverage_Gen 三角移動平均(中央權重較重)和 TriAverage 的權重稍有不同 418 | TrimMean 計算數列去除部分極值後的平均數 419 | TrimMean_a 計算陣列去除部分極值後的平均數 420 | TrimMeanArray 計算陣列去除部分極值後的平均數 421 | TRIX 三重指數平滑移動平均 422 | TrueHigh 真實高點 423 | TrueLow 真實低點 424 | TrueRange 真實波幅 425 | TrueRangeCustom 和 TrueRange 相同,但可自訂計算的數列 426 | TypicalPrice 和 AvgPrice 類似,為高、低、收的平均價 427 |       428 | U UlcerIndex 潰瘍指數,衡量商品拉回的壓力程度 429 | UltimateOsc 終極擺蕩指標 430 | UltimateOscillator 終極擺蕩指標(原始公式) 431 |       432 | V Variance 計算數列的樣本變異數 433 | VarianceArray 計算陣列的變異數 434 | VarianceP 計算數列的母體變異數 435 | VarianceP_a 計算陣列的母體變異數 436 | VariancePS 計算數列的變異數 437 | VarianceS_a 計算陣列的樣本變異數 438 | Vega 計算選擇權的 Vega 439 | Volatility TrueRange 的指數移動平均 440 | VolatilityClassic TrueRange 的簡單移動平均 441 | VolatilityExVal 442 | VolatilityStdDev 計算商品的歷史波動率(只能用於日線) 443 | VolatilityStocks 444 | VolumeOsc 計算成交量的快速移動平均及慢速移動平均差距 445 | VolumeROC 成交量變動率 446 | vwapResttable 時段分割的成交量加權平均 447 |       448 | W WAverage 計算數列的加權移動平均 449 | WeightedClose 和 TypicalPrice 類似,但收盤價較高權重 450 |       451 | X XAverage 計算數列的指數移動平均,權重為 2/(Len+1) 452 | XAverageOrig 計算數列的指數移動平均,權重為 1/Len 453 |       454 | Z Zprob 變尾 Z 檢定的 P-value 455 | Ztest 標準常態分配下變尾 Z 檢定的 P-value 456 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MultiCharts-PowerLanguage 2 | *【FinTech】 3 | 4 | #### 收集網路上公開的程式碼學習筆記與改進作法 5 | 6 | 為什麼想進行程式交易? 7 | 8 | 上班不能看盤 9 | 10 | 避免人性的干擾造 11 | 12 | 以上都是,但最初的夢想只是很簡單的想在金幣上衝浪和游泳而已 13 | -------------------------------------------------------------------------------- /【指標】%B: -------------------------------------------------------------------------------- 1 | {BandWidth} 2 | {input:BarNo(20),Sueeze(300),StdMulti(4) ; 3 | Vars: BandWidth(0) ; 4 | BandWidth = StdDev(Close,BarNo)*StdMulti ; 5 | plot1(BandWidth,"BandWidth") ; 6 | plot2(Sueeze,"Sqeeze") ;} 7 | { % BBand } 8 | {input:{BarNo(60),}HB(1),MB(0.5),LB(0) ; 9 | Value1 = StdDev(Close,20) ; 10 | Value2 = (Close-(Average(Close,20)-2*Value1))/(Value1*4) ; 11 | 12 | Plot1(Value2,"%B") ; 13 | Plot2(HB,"HB") ; 14 | Plot3(MB,"MB") ; 15 | Plot4(LB,"LB") ;} 16 | 17 | input: Length(20), NumDevsUp(2), NumDevsDn(-2); 18 | vars: var0(0), var1(0), var2(0), var3(0); 19 | 20 | var0 = AverageFC(c, Length); 21 | var1 = StandardDev(c, Length, 1); 22 | var3 = var0 + NumDevsUp*var1; 23 | var2 = var0 + NumDevsDn*var1; 24 | 25 | if var3 - var2 > 0 then begin 26 | value1 = ((close - var2)/(var3 - var2))*100; 27 | 28 | end; 29 | 30 | plot1(value1); 31 | plot2(100); 32 | plot3(0); 33 | plot4(50); 34 | -------------------------------------------------------------------------------- /【指標】@Angle Power: -------------------------------------------------------------------------------- 1 | inputs: 2 | avg_length( 20 ), 3 | X_Length( 20 ),slop_or_angle(1); 4 | 5 | variables:var0( 0 ),var1(0),var2(0),var3(0),a1(0) ; 6 | 7 | a1=Average(close,avg_length); 8 | 9 | condition1 = CurrentBar > AbsValue( 0) ; 10 | 11 | if condition1 then 12 | Value1 = LinearReg( a1, X_Length, 0, var0, var1, var2, var3 ) ; 13 | 14 | 15 | switch(slop_or_angle) begin 16 | 17 | case 0: 18 | 19 | Plot1( var0); 20 | 21 | If var0> 0 then SetPlotColor(1,red) 22 | else 23 | SetPlotColor(1,green); 24 | 25 | case 1: 26 | 27 | Plot1( var1); 28 | If var1> 0 then SetPlotColor(1,red) 29 | else 30 | SetPlotColor(1,green); 31 | 32 | end; 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /【指標】PL8力道K線指標: -------------------------------------------------------------------------------- 1 | input:len(60); 2 | { 3 | Var:MA1(0),MA2(0),XHigh(0),XLow(0),Diff(0); 4 | MA1=xaverage(xaverage(c,len/6),len/6/5); 5 | MA2=xaverage(xaverage(c,len),len/5); 6 | XHigh=absvalue((MA1-MA2)/5)+MA1; 7 | XLow=MA1-absvalue((MA1-MA2)/5); 8 | if MA1>MA2 then 9 | Diff=XHigh-Xlow; 10 | if MA1MA2 thensetplotcolor(1,red) else setplotcolor(1,green); 17 | if MA1>MA2 thensetplotcolor(3,red) else setplotcolor(3,green); 18 | if MA1>MA2 thensetplotcolor(4,red) else setplotcolor(4,green); 19 | } 20 | Var:MA1(0),MA2(0),XHigh(0),XLow(0),Diff(0); 21 | MA1=xaverage(xaverage(c,10),2); 22 | MA2=xaverage(xaverage(c,60),12); 23 | XHigh=absvalue((MA1-MA2)/5)+MA1; 24 | XLow=MA1-absvalue((MA1-MA2)/5); 25 | if MA1>MA2 then 26 | Diff=XHigh-Xlow; 27 | if MA1MA2 then setplotcolor(1,red) else setplotcolor(1,green); 31 | -------------------------------------------------------------------------------- /【指標】價差指標進出場: -------------------------------------------------------------------------------- 1 | //計算不同商品價差(3分鐘線) 2 | inputs: DataSeries1( Close of data1), DataSeries2( Close of data2); 3 | Plot1( DataSeries1 - DataSeries2, "SprdDiff" ); 4 | 5 | if DataSeries2 <> 0 then Plot1( DataSeries1/DataSeries2, "SprdRatio" ); 6 | 7 | //正價差作多,逆價差作空 8 | diff=close of Data1 - close of Data2; 9 | if diff cross over 0 then buy next bar ar market; 10 | if diff cross under 0 then sellshort next var at market; 11 | 12 | //正價差作空,逆價差作多 13 | diff=close of Data1 - close of Data2; 14 | if diff cross under 0 then buy next bar ar market; 15 | if diff cross over 0 then sellshort next var at market; 16 | 17 | 18 | 19 | //小時線,逆價差突破高點買進,正價差突破低點賣出,停損停利 20 | //正逆價差交易 21 | 22 | input: SL(0.0125), PL(0.03), rr(0.4), aa(-40), bb(20); 23 | value1 = close of data1 - close of data2;//計算期貨和現貨的價差值 24 | if H-L>0 then begin 25 | condition1 = (C-L)/(H-L)>rr and C>O and C[1]>O[1];//重要的濾網 26 | condition2 = (C-L)/(H-L)<1-rr and C0915 and t<1324 then begin 29 | if condition1 and value1 cross over aa then buy next bar at market;//逆價差縮小買進多單 30 | if condition2 and value1 cross under bb then sellshort next bar at market;//正價差所小買進空單 31 | end; 32 | //停損停利 33 | if marketposition=1 then sell next bar entryprice*(1-SL) stop; 34 | if marketposition=-1 then buytocover next bar at entryprice*(1+SL) stop; 35 | if marketposition=1 then sell next bar at entryprice*(1+PL) limit; 36 | if marketposition=-1 then buytocover next bar at entryprice*(1-PL) limit; 37 | //結算日平倉 38 | if marketposition<>0 and dayofweek(date)=3 and dayofmonth(date)>14 and dayofmonth(date)<22 then begin 39 | sell all contracts this bar on close; 40 | buytocover all contracts this bar on close; 41 | end; 42 | 43 | -------------------------------------------------------------------------------- /【指標】冰火能量圖: -------------------------------------------------------------------------------- 1 | { 2 | http://white5168.blogspot.tw/2016/06/multicharts-excel-8.html#.V8zYlk197IU 3 | TXF1-UV:台指連續月1外盤量 4 | TXF1-TB:台指連續月1累計買成筆 5 | TXF1-TA:台指連續月1累計賣成筆 6 | TXF1-DV:台指連續月1內盤量 7 | TXF1-BV:台指連續月1委買量 8 | TXF1-BO:台指連續月1委買筆 9 | TXF1-AV:台指連續月1委賣量 10 | TXF1-AO:台指連續月1委賣筆 11 | http://wenschair.blogspot.tw/2013/10/by-xdtrader.html 12 | 四種業界主觀交易常用的即時籌碼指標: 13 | (1) MasterForce主力指標:利用即時委買、委賣量的差值換算出的籌碼動向,這些資訊被解讀為大戶(或主力)的動向,被認為具有領先特性。 14 | (2) DealtForce成交力差指標:利用即時多空單累計成交量的差值,計算出實際的成交力道,此資訊常被用來判斷行情的確立或是走勢延續。 15 | (3) SlaveForce散戶指標:利用即時多空委買賣的筆數差值,計算出小單交易的狀況,此資訊常被認為是用來判斷散戶的動態,當行情呈現趨勢盤時,容易與趨勢反向,具有反指標意義;但在量縮盤整的時候,則不一定。 16 | (4) TWSEForce氣氛指標:利用即時的大盤漲跌家數差值變化,可以看出目前現貨的狀況,如果是強多格局,大盤漲的家數會大勝跌的家數,此時漲勢具有延續性。 17 | } 18 | 19 | value1 = c data2 - c data3; 20 | plot1(value1, "BV-AV", iff(value1 > 0, red, green)); 21 | 22 | value1 = c data4 - c data5; 23 | plot1(value1, "TA-TB", iff(value1 > 0, red, green)); 24 | 25 | value1 = c data6 - c data7; 26 | plot1(value1, "BO-AO", iff(value1 > 0, red, green)); 27 | 28 | value1 = (c data3 / c data5 - c data2 / c data4)*100; 29 | plot1(value1, "bv/bo-av/ao",iff(value1 > 0, red, green)); 30 | -------------------------------------------------------------------------------- /【指標】預估成交量: -------------------------------------------------------------------------------- 1 | {http://wenschair.blogspot.tw/2013/10/by-easytrader.html} 2 | 3 | Input: Ratio(0.3) ; 4 | 5 | vars: V_sum(0),V_est(0),TodayVol(0),YesterDayVol(0); 6 | 7 | if date <> date[1] then begin 8 | 9 | YesterDayVol = TodayVol[1] ; 10 | 11 | V_sum = ticks; 12 | 13 | end 14 | 15 | else begin 16 | 17 | V_sum = V_sum + ticks; 18 | 19 | end; 20 | 21 | if time<=0850 then V_est = V_sum * 28.90 22 | 23 | else if Time >0850 and time <= 0855 then V_est = V_sum * 18.67 24 | 25 | else if Time >0855 and time <= 0900 then V_est = V_sum * 14.29 26 | 27 | else if Time >0900 and time <= 0905 then V_est = V_sum * 9.54 28 | 29 | else if Time >0905 and time <= 0910 then V_est = V_sum * 7.20 30 | 31 | else if Time >0910 and time <= 0915 then V_est = V_sum * 6.11 32 | 33 | else if Time >0915 and time <= 0920 then V_est = V_sum * 5.25 34 | 35 | else if Time >0920 and time <= 0925 then V_est = V_sum * 4.73 36 | 37 | else if Time >0925 and time <= 0930 then V_est = V_sum * 4.27 38 | 39 | else if Time >0930 and time <= 0935 then V_est = V_sum * 3.88 40 | 41 | else if Time >0935 and time <= 0940 then V_est = V_sum * 3.60 42 | 43 | else if Time >0940 and time <= 0945 then V_est = V_sum * 3.33 44 | 45 | else if Time >0945 and time <= 0950 then V_est = V_sum * 3.12 46 | 47 | else if Time >0950 and time <= 0955 then V_est = V_sum * 2.95 48 | 49 | else if Time >0955 and time <= 1000 then V_est = V_sum * 2.80 50 | 51 | else if Time >1000 and time <= 1005 then V_est = V_sum * 2.65 52 | 53 | else if Time >1005 and time <= 1010 then V_est = V_sum * 2.53 54 | 55 | else if Time >1010 and time <= 1015 then V_est = V_sum * 2.42 56 | 57 | else if Time >1015 and time <= 1020 then V_est = V_sum * 2.32 58 | 59 | else if Time >1020 and time <= 1025 then V_est = V_sum * 2.24 60 | 61 | else if Time >1025 and time <= 1030 then V_est = V_sum * 2.17 62 | 63 | else if Time >1030 and time <= 1035 then V_est = V_sum * 2.10 64 | 65 | else if Time >1035 and time <= 1040 then V_est = V_sum * 2.05 66 | 67 | else if Time >1040 and time <= 1045 then V_est = V_sum * 1.98 68 | 69 | else if Time >1045 and time <= 1050 then V_est = V_sum * 1.92 70 | 71 | else if Time >1050 and time <= 1055 then V_est = V_sum * 1.88 72 | 73 | else if Time >1055 and time <= 1100 then V_est = V_sum * 1.83 74 | 75 | else if Time >1100 and time <= 1105 then V_est = V_sum * 1.79 76 | 77 | else if Time >1105 and time <= 1110 then V_est = V_sum * 1.75 78 | 79 | else if Time >1110 and time <= 1115 then V_est = V_sum * 1.71 80 | 81 | else if Time >1115 and time <= 1120 then V_est = V_sum * 1.68 82 | 83 | else if Time >1120 and time <= 1125 then V_est = V_sum * 1.63 84 | 85 | else if Time >1125 and time <= 1130 then V_est = V_sum * 1.59 86 | 87 | else if Time >1130 and time <= 1135 then V_est = V_sum * 1.56 88 | 89 | else if Time >1135 and time <= 1140 then V_est = V_sum * 1.53 90 | 91 | else if Time >1140 and time <= 1145 then V_est = V_sum * 1.51 92 | 93 | else if Time >1145 and time <= 1150 then V_est = V_sum * 1.48 94 | 95 | else if Time >1150 and time <= 1155 then V_est = V_sum * 1.45 96 | 97 | else if Time >1155 and time <= 1200 then V_est = V_sum * 1.43 98 | 99 | else if Time >1200 and time <= 1205 then V_est = V_sum * 1.40 100 | 101 | else if Time >1205 and time <= 1210 then V_est = V_sum * 1.38 102 | 103 | else if Time >1210 and time <= 1215 then V_est = V_sum * 1.35 104 | 105 | else if Time >1215 and time <= 1220 then V_est = V_sum * 1.33 106 | 107 | else if Time >1220 and time <= 1225 then V_est = V_sum * 1.31 108 | 109 | else if Time >1225 and time <= 1230 then V_est = V_sum * 1.30 110 | 111 | else if Time >1230 and time <= 1235 then V_est = V_sum * 1.28 112 | 113 | else if Time >1235 and time <= 1240 then V_est = V_sum * 1.26 114 | 115 | else if Time >1240 and time <= 1245 then V_est = V_sum * 1.24 116 | 117 | else if Time >1245 and time <= 1250 then V_est = V_sum * 1.22 118 | 119 | else if Time >1250 and time <= 1255 then V_est = V_sum * 1.21 120 | 121 | else if Time >1255 and time <= 1300 then V_est = V_sum * 1.19 122 | 123 | else if Time >1300 and time <= 1305 then V_est = V_sum * 1.16 124 | 125 | else if Time >1305 and time <= 1310 then V_est = V_sum * 1.15 126 | 127 | else if Time >1310 and time <= 1315 then V_est = V_sum * 1.13 128 | 129 | else if Time >1315 and time <= 1320 then V_est = V_sum * 1.11 130 | 131 | else if Time >1320 and time <= 1325 then V_est = V_sum * 1.09 132 | 133 | else if Time >1325 and time <= 1330 then V_est = V_sum * 1.08 134 | 135 | else if Time >1330 and time <= 1335 then V_est = V_sum * 1.05 136 | 137 | else if Time >1335 and time <= 1340 then V_est = V_sum * 1.03 138 | 139 | else if Time >1340 and time <= 1345 then V_est = V_sum * 1.00; 140 | 141 | 142 | 143 | 144 | if time = 1345 then TodayVol = V_sum ; 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | plot1(V_sum, "Daily V sum"); 153 | 154 | plot2(V_est, "Volume Est"); 155 | 156 | plot3(YesterDayVol,"LastdayVol"); 157 | 158 | plot4(YesterDayVol*Ratio, "VolumeRatio"); 159 | -------------------------------------------------------------------------------- /【訊號】MTM策略星: -------------------------------------------------------------------------------- 1 | input:n(9),m(5),xx(70),yy(26); 2 | 3 | var:MTM(0),MTMMA(0); 4 | MTM=close-close[n]; 5 | MTMMA=Average(MTM,m); 6 | 7 | if marketposition=0 and mtm crosses above mtmma and rsi(close,16)>=xx then buy ("bk")next bar market; 8 | //RSI 9 | 10 | if marketposition=0 and mtm crosses below mtmma and rsi(close,16)<=yy then sellshort("sk") next bar at market; 11 | //RSI 12 | 13 | 14 | ////////////////////////////// 15 | input:stoppoint(10); 16 | var:longstop(0),barHH(0); 17 | 18 | if barssinceentry=0 then begin 19 | longstop=minlist(low,low[1])-stoppoint; 20 | barHH=high; 21 | end; 22 | 23 | if high>barHH then barHH=high; 24 | if barssinceentry>0 then begin 25 | if c>barHH[1] then longstop=minlist(low,low[1])-stoppoint; 26 | end; 27 | if marketposition=1 then sell("EL") next bar at longstop stop ; 28 | // 29 | 30 | ///////////////////////////////////////////////////////////// 31 | 32 | input:stoppoint1(10); 33 | var:longstop1(0),barll(0); 34 | 35 | if barssinceentry=0 then begin 36 | longstop1=maxlist(high,high[1])+stoppoint; 37 | barll=low; 38 | end; 39 | 40 | if low0 then begin 42 | if cdate[1] then begin 5 | value1 = barnumber; 6 | end; 7 | 8 | Kbar = barnumber-value1+1; 9 | if Kbar=N then begin 10 | kh = highest(high,N); 11 | end; 12 | 13 | //可以改成STOP進單 14 | if Kbar>N then begin 15 | if close crosses above kh and k1<1 then begin 16 | buy next bar at market; 17 | //---red word 18 | buyexit = lowest(low,2); 19 | //--- 20 | end; 21 | //k1 限制一天要做幾次,k1<1買單只做一次。 22 | end; 23 | 24 | //---red word 25 | if highest(high,barsSinceEntry(0)) > highest(high,barsSinceEntry(0))[1] then 26 | buyexit = lowest(low,2); 27 | //--- 28 | //利用barsSiceEntry來看進場後是否有創新高,如果有把buyexit值用當根及前一根低點比較,最低的丟進去。 29 | 30 | //出場也可以改成sell next bar at buyexit stop; 31 | if marketposition>0 and close55 then begin 37 | sell next bar at market; 38 | k1 = 0; 39 | kh = 99999; 40 | end; 41 | 42 | //使用陣列改善效能 43 | { 44 | if (high>currenthighvalue) 45 | begin 46 | high = currenthighvalue 47 | buyexit = lowest(low,2) 48 | end 49 | 50 | if Kbar>N then begin 51 | if close crosses above kh and k1<1 then begin 52 | buy next bar at market; 53 | currenthighvalue = high 54 | buyexit = lowest(low,2); 55 | end; 56 | //k1 限制一天要做幾次,k1<1買單只做一次。 57 | end; 58 | } 59 | -------------------------------------------------------------------------------- /【訊號】慢速KD交叉: -------------------------------------------------------------------------------- 1 | inputs: Price(close), Len_Short(9), Len_Long(10); 2 | vars: var1(0), var2(0); 3 | 4 | var1= SlowK(Len_Short); 5 | var2= SlowD(Len_long); 6 | 7 | if marketposition= 0 and var1 Crosses Above var2 then begin 8 | buy("buy") next bar at market; 9 | end; 10 | 11 | if marketposition= 0 and var1 Crosses Under var2 then begin 12 | sellshort("sell") next bar at market; 13 | end; 14 | 15 | if marketposition>0 and var1 Crosses Under var2 then begin 16 | sell("EXIT_buy") next bar at market; 17 | end; 18 | 19 | if marketposition<0 and var1 Crosses Above var2 then begin 20 | buytocover("EXIT_sell") next bar at market; 21 | end; 22 | -------------------------------------------------------------------------------- /【訊號】特定比例順勢突破當沖 by Ray's: -------------------------------------------------------------------------------- 1 | vars: F(0.006), k1(0), k2(0); 2 | if date[0]<>date[1] then BEGIN 3 | k1 = 0; 4 | k2 = 0; 5 | end; 6 | 7 | condition1 = highd(0)>=open(0)*(1+F); 8 | condition2 = (high=highd(0) and high>=opend(0)*(1+F)) or highlowd(0); 11 | 12 | if marketposition=0 and k1=0 and time>0900 and time<=1300 and condition1 and condition3 then 13 | buy("b") next bar at highd(0) stop; 14 | if marketposition=0 and k2=0 and time>0900 and time<=1300 and condition2 and condition4 then 15 | sellshort("s") next bar at lowd(0) stop; 16 | 17 | //?????0.5% 18 | if marketposition<0 then begin 19 | buytocover("Stop_loss_short") next bar at entryprice*(1+0.005) stop; 20 | k2 = 1; 21 | end; 22 | if marketposition>0 then begin 23 | sell("Stop_loss_long") next bar at entryprice*(1-0.005) stop; 24 | k1 = 1; 25 | end; 26 | // 27 | 28 | //??????? 29 | if time>=1325 then begin 30 | sell next bar at market; 31 | buytocover next bar at market; 32 | end; 33 | -------------------------------------------------------------------------------- /【訊號】突破+50-20 by Angel chen: -------------------------------------------------------------------------------- 1 | if time=0915 then value1=opend(0); 2 | 3 | if time>=0915 and time<1300 then begin 4 | buy next bar value1+30 stop; 5 | sellshort next bar value1-30 stop; 6 | end; 7 | 8 | if time>=1300 then begin 9 | buytocover next bar market; 10 | sell next bar market; 11 | end; 12 | 13 | setstoploss(40*bigpointvalue); 14 | -------------------------------------------------------------------------------- /【訊號】突破10根K棒YCTSENG: -------------------------------------------------------------------------------- 1 | input: Length(10),endTime(1330); 2 | var: K(1),toBuy(99999),toShort(0); 3 | 4 | K= iff( D>D[1], 1, K+1 ); 5 | 6 | if sessionlastbar then begin 7 | tobuy=99999; 8 | toshort= 0; 9 | end; 10 | if K=Length then begin 11 | toBuy=Highest(High,K); 12 | toShort=Lowest(Low,K); 13 | end; 14 | if K>=Length and T<=endTime then begin 15 | if marketposition<=0 then 16 | buy next bar toBuy stop; 17 | 18 | if marketposition>=0 then 19 | sellshort next bar toShort stop; 20 | end; 21 | 22 | setexitonclose; 23 | 24 | setstoploss(25*bigpointvalue); 25 | 26 | -------------------------------------------------------------------------------- /【訊號】跳空進場Bituzi: -------------------------------------------------------------------------------- 1 | 2 | input :BTime(0905) , ETime(1245); 3 | 4 | var : THigh(0) , TLow(99999) , mp(0) , x(0) , y(0) ; 5 | 6 | if date <> date[1] then begin 7 | mp=0; 8 | x=0; 9 | y=0; 10 | THigh=0; 11 | TLow=99999; 12 | end; 13 | 14 | if time=BTime then begin 15 | THigh=highd(0); 16 | TLow=lowd(0); 17 | end; 18 | 19 | 20 | if BTime < Time and Time < ETime then begin 21 | 22 | if marketposition = 0 and x<1 and opend(0)>closed(1)+10 and close>Thigh 23 | and high>average(close,120) then buy next bar at high+1 stop; 24 | 25 | if marketposition = 0 and y<1 and opend(0)1 and mp=1 then begin 33 | x=1; 34 | end; 35 | 36 | if mp[1]<>-1 and mp=-1 then begin 37 | y=1; 38 | end; 39 | 40 | setstoploss(10000); 41 | 42 | if marketposition =1 then begin 43 | sell next bar at entryprice-50 stop ; 44 | if time>1310 then sell next bar at lowest(low,3)-1 stop; 45 | if time>1335 then sell this bar on close; 46 | end; 47 | 48 | if marketposition =-1 then begin 49 | buytocover next bar at entryprice+50 stop ; 50 | if Time>1310 then buytocover next bar at highest(high,3)+1 stop; 51 | if Time>1335 then buytocover this bar on close; 52 | end; 53 | 54 | setexitonclose; 55 | -------------------------------------------------------------------------------- /【訊號】連續3根K棒+布林軌道斜率: -------------------------------------------------------------------------------- 1 | inputs: Length(20), NumDevsUp(2), NumDevsDn(-2); 2 | vars: AVG(0), UPline(0), DOWNline(0); 3 | 4 | AVG = AverageFC( close, Length); 5 | value1 = StandardDev( close, Length, 1); 6 | UPline = AVG+NumDevsUp*value1; 7 | DOWNline = AVG+NumDevsDn*value1; 8 | value2 = AVG; 9 | 10 | condition1 = CountIf( close>open, 3)>=3; 11 | condition2 = CountIf( close>close[1], 3)>=3; 12 | condition3 = CountIf( open>open[1], 3)>=3; 13 | condition4 = open>open[1] and open[1]>open[2] and close>close[1] and close[1]>close[2]; 14 | 15 | condition5 = CountIf( UPline>Upline[1], 3)>=3; 16 | if condition1 and condition2 and condition3 and condition4 and condition5 and marketposition=0 then buy next bar at Highest( high, 5) stop; 17 | 18 | condition6 = CountIf( close=3; 19 | condition7 = CountIf( close=3; 20 | condition8 = CountIf( open=3; 21 | condition9 = close=3; 24 | if condition6 and condition7 and condition8 and condition9 and condition10 and marketposition=0 then sellshort next bar at lowest( low,5) stop; 25 | 26 | 27 | { 28 | if marketposition>0 and (openclose) then begin 33 | buytocover("EXIT_sell") next bar at market; 34 | end; 35 | } 36 | setstoploss(10000); 37 | 38 | if marketposition =1 then begin 39 | sell next bar at entryprice-50 stop ; 40 | if time>1310 then sell next bar at lowest(low,3)-1 stop; 41 | if time>1335 then sell this bar on close; 42 | end; 43 | 44 | if marketposition =-1 then begin 45 | buytocover next bar at entryprice+50 stop ; 46 | if Time>1310 then buytocover next bar at highest(high,3)+1 stop; 47 | if Time>1335 then buytocover this bar on close; 48 | end; 49 | 50 | setexitonclose; 51 | {setstoploss(60*bigpointvalue);} 52 | 53 | -------------------------------------------------------------------------------- /【訊號】連續K棒上漲下跌ey90223: -------------------------------------------------------------------------------- 1 | inputs: Length(20), NumDevsUp(2), NumDevsDn(-2); 2 | vars: AVG(0), UPline(0), DOWNline(0); 3 | 4 | AVG = AverageFC( close, Length); 5 | value1 = StandardDev( close, Length, 1); 6 | UPline = AVG+NumDevsUp*value1; 7 | DOWNline = AVG+NumDevsDn*value1; 8 | value2 = AVG; 9 | 10 | condition1 = CountIf( close>open, 3)>=3; 11 | condition2 = CountIf( close>close[1], 3)>=3; 12 | condition3 = CountIf( open>open[1], 3)>=3; 13 | condition4 = open>open[1] and open[1]>open[2] and close>close[1] and close[1]>close[2]; 14 | 15 | condition5 = CountIf( UPline>Upline[1], 3)>=3; 16 | if condition1 and condition2 and condition3 and condition4 and condition5 and marketposition=0 then buy next bar at Highest( high, 5) stop; 17 | 18 | condition6 = CountIf( close=3; 19 | condition7 = CountIf( close=3; 20 | condition8 = CountIf( open=3; 21 | condition9 = close=3; 24 | if condition6 and condition7 and condition8 and condition9 and condition10 and marketposition=0 then sellshort next bar at lowest( low,5) stop; 25 | 26 | 27 | { 28 | if marketposition>0 and (openclose) then begin 33 | buytocover("EXIT_sell") next bar at market; 34 | end; 35 | } 36 | setstoploss(10000); 37 | 38 | if marketposition =1 then begin 39 | sell next bar at entryprice-50 stop ; 40 | if time>1310 then sell next bar at lowest(low,3)-1 stop; 41 | if time>1335 then sell this bar on close; 42 | end; 43 | 44 | if marketposition =-1 then begin 45 | buytocover next bar at entryprice+50 stop ; 46 | if Time>1310 then buytocover next bar at highest(high,3)+1 stop; 47 | if Time>1335 then buytocover this bar on close; 48 | end; 49 | 50 | setexitonclose; 51 | {setstoploss(60*bigpointvalue);} 52 | 53 | --------------------------------------------------------------------------------