AFL highlighter for ConTEXT (free editor).afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:12k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    AFL highlighter for ConTEXT (free editor)
  4. //  Author/Uploader: Dave Merrill 
  5. //  E-mail:          
  6. //  Date/Time Added: 2004-02-07 22:41:26
  7. //  Origin:          Based on Geoff Mulhall's original version in the library, updated to AB 4.5 and tweaked since.
  8. //  Keywords:        ConTEXT editor highlight
  9. //  Level:           semi-advanced
  10. //  Flags:           system,exploration,indicator,commentary,function
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=333
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=333
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  ConTEXT is a really good freeware programmer's editor, available at
  17. //  http://www.fixedsys.com/context. This file teaches it AFL's keywords, so it
  18. //  can color and format them like AmiBroker does. I often keep my standard AFL
  19. //  #include file open in it while working in AB.
  20. //
  21. //  Since there doesn't appear to be any direct way to capture all the keywords
  22. //  in use in the current version of AB, maintenance of this file is dependant
  23. //  on me or someone else noticing missing items. So, any additions and
  24. //  corrections are most welcome (:-). Please write directly to dmerrill at usa
  25. //  dot net, in case I don't come back here right away.
  26. //
  27. //  Thanks to Graham Kavanagh for his notes.
  28. //
  29. //------------------------------------------------------------------------------
  30. //////////////////////////////////////////////////////////////////////////////
  31. //
  32. // Amibroker Formula Language 
  33. //
  34. //////////////////////////////////////////////////////////////////////////////
  35. //////////////////////////////////////////////////////////////////////////////
  36. // language name
  37. Language:               AFL
  38. //////////////////////////////////////////////////////////////////////////////
  39. // default file filter
  40. // note: if more than one extension is associated, eg:
  41. // C/C++ files (*.c,*.cpp,*.h,*.hpp)|*.c;*.cpp;*.h;*.hpp
  42. Filter:                 AFL files (*.afl)|*.afl
  43. //////////////////////////////////////////////////////////////////////////////
  44. // help file which will be invokend when F1 is pressed
  45. HelpFile: C:Program FilesAmiBrokerBroker.chm
  46. //////////////////////////////////////////////////////////////////////////////
  47. // language case sensitivity
  48. //                      0  - no
  49. //                      1  - yes
  50. CaseSensitive:          0
  51. //////////////////////////////////////////////////////////////////////////////
  52. // comment type: LineComment - comment to the end of line
  53. // BlockCommentBeg - block comment begin, it could be
  54. // multiline
  55. // BlockCommentEnd - block comment end
  56. LineComment:            //
  57. BlockCommentBeg:        /*
  58. BlockCommentEnd:        */
  59. //////////////////////////////////////////////////////////////////////////////
  60. // identifier characters
  61. // note: characters shouldn't be delimited, except arrays
  62. // array of chars could be defined as from_char..to_char
  63. IdentifierBegChars:     a..z A..Z _
  64. IdentifierChars:        a..z A..Z _ 0..9 
  65. //////////////////////////////////////////////////////////////////////////////
  66. // numeric constants begin characters
  67. // note: characters shouldn't be delimited, except arrays
  68. // array of chars could be defined as from_char..to_char
  69. // number always starts with 0..9 except when NumConstBeg
  70. // defines other
  71. NumConstBegChars:       0..9 
  72. //////////////////////////////////////////////////////////////////////////////
  73. // numeric constants characters
  74. // note: characters shouldn't be delimited, except arrays
  75. // array of chars could be defined as from_char..to_char
  76. // number always starts with 0..9 except when NumConstBeg
  77. // defines other
  78. NumConstChars:          0..9 A..Z . -
  79. //////////////////////////////////////////////////////////////////////////////
  80. // escape character
  81. EscapeChar:
  82. //////////////////////////////////////////////////////////////////////////////
  83. // keyword table
  84. // note: delimited with spaces, lines could be wrapped
  85. // you may divide keywords into five groups which can be
  86. // highlighted differently
  87. // reserved words and variable names
  88. KeyWords1:
  89. // reserved words
  90. AND OR NOT Null True False
  91. // reserved variable names
  92. Open O
  93. Close C
  94. High H
  95. Low L
  96. Volume V
  97. OpenInt OI
  98. Avg
  99. Buy Sell Short Cover
  100. BuyPrice SellPrice ShortPrice CoverPrice
  101. BarCount
  102. MarginDeposit
  103. PointValue
  104. PositionScore
  105. PositionSize
  106. RoundLotSize
  107. TickSize
  108. scoreNoRotate
  109. Title
  110. MaxGraph
  111. GraphXSpace
  112. GraphZOrder
  113. Filter
  114. NumColumns
  115. Graph0 Graph1 Graph2 Graph3 Graph4 Graph5 Graph6 Graph7 Graph8 Graph9
  116. Graph0Name Graph1Name Graph2Name Graph3Name Graph4Name Graph5Name Graph6Name Graph7Name Graph8Name Graph9Name
  117. Graph0Color Graph1Color Graph2Color Graph3Color Graph4Color Graph5Color Graph6Color Graph7Color Graph8Color Graph9Color
  118. Graph0BarColor Graph1BarColor Graph2BarColor Graph3BarColor Graph4BarColor Graph5BarColor Graph6BarColor Graph7BarColor Graph8BarColor Graph9BarColor
  119. Graph0Style Graph1Style Graph2Style Graph3Style Graph4Style Graph5Style Graph6Style Graph7Style Graph8Style Graph9Style
  120. colorAqua
  121. colorBlack
  122. colorBlue
  123. colorBlueGrey
  124. colorBrightGreen
  125. colorBrown
  126. colorDarkBlue
  127. colorDarkGreen
  128. colorDarkGrey
  129. colorDarkOliveGreen
  130. colorDarkRed
  131. colorDarkTeal
  132. colorDarkYellow
  133. colorDefault
  134. colorGold
  135. colorGreen
  136. colorGrey40
  137. colorGrey50
  138. colorIndigo
  139. colorLavender
  140. colorLightBlue
  141. colorLightGrey
  142. colorLightOrange
  143. colorLightYellow
  144. colorLime
  145. colorOrange
  146. colorPaleBlue
  147. colorPaleGreen
  148. colorPaleTurquoise
  149. colorPink
  150. colorPlum
  151. colorRed
  152. colorRose
  153. colorSeaGreen
  154. colorSkyblue
  155. colorTan
  156. colorTeal
  157. colorTurquoise
  158. colorViolet
  159. colorWhite
  160. colorYellow
  161. colorCustom1
  162. colorCustom2
  163. colorCustom3
  164. colorCustom4
  165. colorCustom5
  166. colorCustom6
  167. colorCustom7
  168. colorCustom8
  169. colorCustom9
  170. colorCustom10
  171. colorCustom11
  172. colorCustom12
  173. colorCustom13
  174. colorCustom14
  175. colorCustom15
  176. colorCustom16
  177. styleArea
  178. styleBar
  179. styleCandle
  180. styleDots
  181. styleHistogram
  182. styleLeftAxisScale
  183. styleLine
  184. styleNoDraw
  185. styleNoLabel
  186. styleNoLine
  187. styleNoRescale
  188. styleOwnScale
  189. stylePointAndFigure
  190. styleStaircase
  191. styleSwingDots
  192. styleThick
  193. shapeCircle
  194. shapeDigit0
  195. shapeDigit1
  196. shapeDigit2
  197. shapeDigit3
  198. shapeDigit4
  199. shapeDigit5
  200. shapeDigit6
  201. shapeDigit7
  202. shapeDigit8
  203. shapeDigit9
  204. shapeDownArrow
  205. shapeDownTriangle
  206. shapeHollowCircle
  207. shapeHollowDownArrow
  208. shapeHollowDownTriangle
  209. shapeHollowSmallCircle
  210. shapeHollowSmallDownTriangle
  211. shapeHollowSmallSquare
  212. shapeHollowSmallUpTriangle
  213. shapeHollowSquare
  214. shapeHollowStar
  215. shapeHollowUpArrow
  216. shapeHollowUpTriangle
  217. shapeNone
  218. shapePositionAbove
  219. shapeSmallCircle
  220. shapeSmallDownTriangle
  221. shapeSmallSquare
  222. shapeSmallUpTriangle
  223. shapeSquare
  224. shapeStar
  225. shapeUpArrow
  226. shapeUpTriangle
  227. Column0 Column1 Column2 Column3 Column4 Column5 Column6 Column7 Column8 Column9
  228. Column0Format Column1Format Column2Format Column3Format Column4Format Column5Format Column6Format Column7Format Column8Format Column9Format
  229. Column0Name Column1Name Column2Name Column3Name Column4Name Column5Name Column6Name Column7Name Column8Name Column9Name
  230. in15Minute in1Minute in5Minute inDaily inHourly inMonthly inWeekly
  231. compressHigh compressLast compressLow compressOpen compressVolume
  232. expandLast expandFirst expandPoint
  233. // functions
  234. KeyWords2:
  235. _N
  236. _TRACE
  237. abs
  238. AccDist
  239. acos
  240. AddColumn
  241. AddTextColumn
  242. AddToComposite
  243. ADLine
  244. AdvIssues
  245. AdvVolume
  246. ADX
  247. AlertIf
  248. AMA
  249. AMA2
  250. ApplyStop
  251. atan
  252. ATR
  253. BarIndex
  254. BarsSince
  255. BBandBot
  256. BBandTop
  257. BeginValue
  258. CategoryAddSymbol
  259. CategoryGetName
  260. CategoryGetSymbols
  261. CategoryRemoveSymbol
  262. CCI
  263. ceil
  264. Chaikin
  265. Correlation
  266. cos
  267. CreateObject
  268. CreateStaticObject
  269. Cross
  270. Cum
  271. Date
  272. DateNum
  273. DateTime
  274. Day
  275. DayOfWeek
  276. DayOfYear
  277. DecIssues
  278. DecVolume
  279. DEMA
  280. EMA
  281. EnableRotationalTrading
  282. EnableScript
  283. EnableTextOutput
  284. EncodeColor
  285. EndValue
  286. Equity
  287. exp
  288. ExRem
  289. ExRemSpan
  290. fclose
  291. feof
  292. fgets
  293. Flip
  294. floor
  295. fopen
  296. Foreign
  297. fputs
  298. frac
  299. FullName
  300. GapDown
  301. GapUp
  302. GetBaseIndex
  303. GetCategorySymbols
  304. GetChartID
  305. GetDatabaseName
  306. GetExtraData
  307. GetScriptObject
  308. GroupID
  309. HHV
  310. HHVBars
  311. Highest
  312. HighestBars
  313. HighestSince
  314. HighestSinceBars
  315. Hold
  316. Hour
  317. IIf
  318. IndustryID
  319. Inside
  320. int
  321. Interval
  322. InWatchList
  323. IsEmpty
  324. IsFavorite
  325. IsFinite
  326. IsIndex
  327. IsNan
  328. IsNull
  329. IsTrue
  330. LastValue
  331. LineArray
  332. LinearReg
  333. LinRegIntercept
  334. LinRegSlope
  335. LLV
  336. LLVBars
  337. log
  338. log10
  339. Lowest
  340. LowestBars
  341. LowestSince
  342. LowestSinceBars
  343. MA
  344. MACD
  345. MarketID
  346. Max
  347. MDI
  348. Median
  349. MFI
  350. Min
  351. Minute
  352. Month
  353. Name
  354. Now
  355. NumToStr
  356. NVI
  357. Nz
  358. OBV
  359. Optimize
  360. OscP
  361. OscV
  362. Outside
  363. Param
  364. ParamColor
  365. ParamStr
  366. PDI
  367. Peak
  368. PeakBars
  369. Percentile
  370. Plot
  371. PlotForeign
  372. PlotGrid
  373. PlotOHLC
  374. PlotShapes
  375. PlotVAPOverlay
  376. Prec
  377. Prefs
  378. printf
  379. PVI
  380. Random
  381. Ref
  382. RelStrength
  383. RestorePriceArrays
  384. RMI
  385. ROC
  386. round
  387. RSI
  388. RSIa
  389. RWI
  390. RWIHi
  391. RWILo
  392. SAR
  393. Second
  394. SectorID
  395. SelectedValue
  396. SetBarsRequired
  397. SetForeign
  398. SetFormulaName
  399. SetOption
  400. SetTradeDelays
  401. sign
  402. Signal
  403. sin
  404. sqrt
  405. Status
  406. StdErr
  407. StDev
  408. StochD
  409. StochK
  410. StrExtract
  411. StrFind
  412. StrFormat
  413. StrLeft
  414. StrLen
  415. StrMid
  416. StrRight
  417. StrToNum
  418. Study
  419. Sum
  420. tan
  421. TEMA
  422. TimeFrameCompress
  423. TimeFrameExpand
  424. TimeFrameGetPrice
  425. TimeFrameRestore
  426. TimeFrameSet
  427. TimeNum
  428. Trin
  429. Trix
  430. Trough
  431. TroughBars
  432. TSF
  433. Ultimate
  434. UncIssues
  435. UncVolume
  436. ValueWhen
  437. Version
  438. Wilders
  439. WMA
  440. WriteIf
  441. WriteVal
  442. Year
  443. Zig
  444. // flow of control statements, variable scope
  445. KeyWords3:
  446. do while for if else
  447. function return procedure
  448. local global
  449. //////////////////////////////////////////////////////////////////////////////
  450. // string delimiter: StringBegChar - string begin char
  451. // StringEndChar - string end char
  452. // MultilineStrings - enables multiline strings, as perl
  453. // has it
  454. StringBegChar:          "
  455. StringEndChar:          "
  456. MultilineStrings:       0
  457. //////////////////////////////////////////////////////////////////////////////
  458. // use preprocessor: 0 - no
  459. // 1 - yes
  460. // note: if yes, '#' and statements after it will be
  461. // highlighted with Preprocessor defined colors
  462. UsePreprocessor:        1
  463. //////////////////////////////////////////////////////////////////////////////
  464. // highlight line: 0 - no
  465. // 1 - yes
  466. // note: if yes, current line will be highlighted
  467. CurrLineHighlighted:    0
  468. //////////////////////////////////////////////////////////////////////////////
  469. // colors
  470. // note:                first value is foreground, second is background color
  471. //                        and third (optional) represents font attribute:
  472. //                        B - bold
  473. //                        I - italic
  474. //                        U - underline
  475. //                        S - strike out
  476. //                        attributes can be combined: eg. B or BI
  477. //                      as value, it could be used any standard windows color:
  478. //                        clBlack, clMaroon, clGreen, clOlive, clNavy,
  479. //                        clPurple, clTeal, clGray, clSilver, clRed, clLime,
  480. //                        clYellow, clBlue, clFuchsia, clAqua, clLtGray,
  481. //                        clDkGray, clWhite, clScrollBar, clBackground,
  482. //                        clActiveCaption, clInactiveCaption, clMenu, clWindow,
  483. //                        clWindowFrame, clMenuText, clWindowText, clCaptionText,
  484. //                        clActiveBorder, clInactiveBorder, clAppWorkSpace,
  485. //                        clHighlight, clHighlightText, clBtnFace, clBtnShadow,
  486. //                        clGrayText, clBtnText, clInactiveCaptionText,
  487. //                        clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText,
  488. //                        clInfoBk
  489. //                      as value, it could be used hex numeric constant too:
  490. //                        $BBGGRR - BB: blue, GG: green, RR: red, eg: $FF6A00
  491. SpaceCol:               clWindowText clWindow
  492. Keyword1Col:            clBlack clWindow B
  493. Keyword2Col:            clBlue clWindow
  494. Keyword3Col:            $000080 clWindow B
  495. Keyword4Col:            clBlue clWindow
  496. Keyword5Col:            clBlue clWindow
  497. IdentifierCol:          clWindowText clWindow
  498. CommentCol:             clGreen clWindow
  499. NumberCol:              clFuchsia clWindow
  500. StringCol:              clFuchsia clWindow
  501. SymbolCol:              clBlack clWindow
  502. PreprocessorCol:        $000080 clWindow B
  503. SelectionCol:           clWhite clNavy
  504. CurrentLineCol:         clBlack clYellow