2 people like it.

DSL for Price Patterns (Demo)

Examples that use domain-specific langauge for detecting price patterns. To run the sample, load the previous snippet in TryF#. It opens the sample automatically.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
open Price

let win = ClassifierWindow()
win.Run("MSFT")
win.Stop()

win.Add("Always rising", rising)
win.Add("Mostly rising", regression rising)
 
let upDown = sequenceAnd (regression rising) (regression declining)
win.Add("Up & Down", upDown)

win.Add("Minimum", minimum)
win.Add("Minimum", maximum)
win.Add("Average", average)
win.Clear()

let diff = both minimum maximum |> map (fun (l, h) -> h - l)
win.Add("Difference", diff)

let averageLessThan lo =
  average |> map (fun v -> v < lo)
let risingUnder26 = 
  bothAnd (regression rising) (averageLessThan 26.0)
win.Add("Rising <26", risingUnder26)
val win : obj

Full name: Script.win
val upDown : obj

Full name: Script.upDown
val diff : obj

Full name: Script.diff
val averageLessThan : lo:'a -> 'b

Full name: Script.averageLessThan
val lo : 'a
val risingUnder26 : obj

Full name: Script.risingUnder26

More information

Link:http://fssnip.net/bL
Posted:12 years ago
Author:Tomas Petricek
Tags: dsl