SDM Language Indicators
The indicators and logic sections are all defined in the
*.sdc files in the C:/SDM/Definitions folder.
The *.sdc (SDM Chart file) contains first the Layout
definition for the chart:
[Window1]
....
[Window2]
...
Logic:
;---- Define all your indicators
$CCI = CCI(14,9)
...
Strategy:
;---- Trading Strategy Logic for position entries
Entry:
;---- Define your Position Exits
Exit:
;---- Define custom exit conditions
SDM Language Sections
The SDC (SDM Chart) file contains following
sections:
| Layout | Defines the Chart Layout From beginning to keyword "Logic:" |
| Indicator Section | Defines and calculates all your inidicators From "Logic:" to the next keyword (i.e. "Strategy:" or "Entry:") |
| Strategy Section | Defines the logic for your trading strategy - when to go
long or short From "Strategy:" to next keyword (i.e. "Strategy:" or "Entry:") |
| Entry Section | Defines all standard Position Exits, called once when a new
position opened From ":Entry:" to next Keywordk (i.ie. "Exit" or end of FIle) |
| Exit Section | Defines any custom exit conditions, called on each bar as
long as you are not flat From "Exit:" to end of file |
Comments start with a semicolon in the first column.
You can declare a variable instantly in the code, by using '$' and the variable
name.
SDM Conditions (IF/ELDE/ENDIF)
Conditions are defined with the IF/ELSE/ENDIF instructions:
If {Cond}
Statements if TRUE ...
[else]
Statements if FALSE ...
endif
The ELSE Section is optional, but ENDIF is required, IF's
can be nested.
Conditions are defined as:
Obj1 Operand Obj2
The following conditional Operands are available:
| < | Less than |
| <= | Less or eqaul |
| = | Equal |
| <> | Not Equal |
| >= | Greate or Equal |
| > | Greater than |
SDM Objects
The following objects are available:
| $Var | Current Value of the Variable $Var | ||||||||||||||||||||||||||||||
| Constant | 10.0 or -3 Empty indicates an Object to which no value has not yet been assigned |
||||||||||||||||||||||||||||||
| Flexible Constant | &ConstantName:DefaultValue& Example: if $CCI < &MinCCIValue:-100& Flexible Constants can be varied during the back testing process. In the chart and automated trading they use the defined default value Ranges can define default values with the '~' delimiter: if NoRange($CCI,&RangeCCI:~100~120&) |
||||||||||||||||||||||||||||||
| Unilateral Functions | The following unilateral functions are available in IF
conditions:
|
||||||||||||||||||||||||||||||
| Standard Objects | See below for the list of the SDM Standard Data Objects Example: Low = Current Bar Low, Close= Current Bar Close, Time=Current Time |
||||||||||||||||||||||||||||||
| Position Objects | The following Position related Objects are available:
|
||||||||||||||||||||||||||||||
| Timer(n) | Value describing the state of Timer {n}:
|
Assigning Values to Variables
To assign a value to a variable use:
$Var = Obj1 DataOp Obj2 or
$Var = Func(Par1...)
The following Data Operands are available:
| + or Add | Obj1 + Obj2 |
| - or Sub | Obj1 - Obj2 |
| * or Multiply | Obj1 * Obj2 |
| / or Divide | Obj1 / Obj2 |
| % or Mod | Modulo of Obj1 into Obj2 (Obj1 % Obj2) |
SDM Studies
(Scope can be in number of Bars or if negative in
Seconds)
| BollUp(Scope,StdDev,Obj,["Style") BollDown(Scope,StdDev,Obj,["Style") BollWidth(Scope,StdDev,Obj,["Style") BollWidthPercent(Scope,StdDev,Obj,["Style") |
Bollinger Band Calculations:
|
||||||||||||||||||||||||||||||||||||
| CCI(Scope,Smooth,Obj,Show) | Commodity Channel Index (Show values starting at bar, 0=on Scope) | ||||||||||||||||||||||||||||||||||||
| CountSame("Spec") | Count same directional bars:
CountSame(^Adverse=3/MinMove=0.02^) detects accumulations, allowing up to 3 adverse bar with a min of 0.02$ price change, returns accumulative value CountSame(^BarCounter=3/End^) |
||||||||||||||||||||||||||||||||||||
| $Pivots = DeltaInit($PivotMin,$PivotMax) | Initialize Delta Calculations $PivotMin/Max are the Pivot Low/High to be analyzed |
||||||||||||||||||||||||||||||||||||
| DeltaCalc($Pivots,"Cmds",nScope,[nLast]) | Calculate Deltas:
|
||||||||||||||||||||||||||||||||||||
| EMA(Scope,Obj) | Exponential Moving Avgerage, Scope=1 to 1000, Obj=$Var etc | ||||||||||||||||||||||||||||||||||||
| FVE(Scope[,Fac[,PrcObj[,VolObj[,nStyle]]]]) | Finite Volume Elements (FVE) Study
|
||||||||||||||||||||||||||||||||||||
| GetAngle(Obj[,Fac,[Bar]]) | Calculate the Angle (Difference between
points)
|
||||||||||||||||||||||||||||||||||||
| LineOp(Obj,^Type/Flag1/...^,Arg1,Arg2..) |
Line Operations:
| ||||||||||||||||||||||||||||||||||||
| MA(Scope,Obj) | Regular Moving Avgerage, Scope=1 to 1000, Obj=$Var etc | ||||||||||||||||||||||||||||||||||||
| MaxChange({+|-}{$|%|#} , Obj [,nScope[,Ref]]) |
Calculate the Maximum Change in Percent:
|
||||||||||||||||||||||||||||||||||||
| MaxValue({+|-} , Obj [,nScope[,Ref]]) | Find the Maximum Value withjn specified
scope
|
||||||||||||||||||||||||||||||||||||
| MFI(Scope,Smooth,Obj) | Money Flow Index | ||||||||||||||||||||||||||||||||||||
| Percent(Obj,Ref[,Factor]) | Calculate the percent change between Obj and Ref If Factro speicfied multiply percent by it (default Factor=1) |
||||||||||||||||||||||||||||||||||||
| PosInChannel(Obj,Max,Min) | Return the normalized position of the of Obj within the
Max-Min Range as%
|
||||||||||||||||||||||||||||||||||||
| RegChaUp(Obj,Scope[,Delay]) | Calc linear Regression base on values in Obj of the recent
'Scope' bars and a delay of 'Delay' bars (default 10) and find upper touching line |
||||||||||||||||||||||||||||||||||||
| RegChaDn(Obj,Scope[,Delay]) | Calc linear Regression base on values in Obj of the recent
'Scope' bars and a delay of 'Delay' bars (default 10) and find lower touching line |
||||||||||||||||||||||||||||||||||||
| RegChaAngle(Obj,Scope[,Delay[,DIst]]) | Calc the angle (in points per hour) of linear Regression
base on values in Obj of the recent 'Scope' bars and a delay of 'Delay' bars (default 0) Use 'Dist' bars for the difference calculation (default current to bar -10) |
||||||||||||||||||||||||||||||||||||
| RoundDown(Prc,Inc) | Round Price down based on Inrement "Inc" Example: RoundDown(800.12,0.25) = 800.00 |
||||||||||||||||||||||||||||||||||||
| RoundUp(Prc,Inc) | Round Price up based on Inrement "Inc" Example: RoundUp(800.12,0.25) = 800.25 |
||||||||||||||||||||||||||||||||||||
| RSI(Scope,Smooth,Obj[,"Attr"]) | Relative Strength Index of last "Scope" bars using
Smoothing (0=none) for Obj "Attr" can specify additional attributes separated by '/' (Attr1/Attr2..)
|
||||||||||||||||||||||||||||||||||||
| Stoch(Scope,Smooth,Obj) or Stochastic(Scope,Smooth,Obj) or |
Stochastic Range of last "Scope" bars using Smoothing (0=none) for Obj | ||||||||||||||||||||||||||||||||||||
| StochAll(Obj,Smooth or StochasticAll(Obj,Smooth) |
Stochastic Study for entire Intraday Range | ||||||||||||||||||||||||||||||||||||
| TSI(ScopeShort,ScopeLong,Obj) | True Strength Index ScopeShort = ShortTerm scope (e.g. 5) ScopeLong = LongTerm scope (e.g. 40) Obj = Price (e.g. Close, or HighLowClose) |
||||||||||||||||||||||||||||||||||||
| ZScore(Scope,StdDev,Obj) | Normalized Bollinger Bands
|
SDM Standard Data Objects
| Open | Opening price of this bar | ||||||||||||
| High | High price within this bar | ||||||||||||
| Low | Low price within this bar | ||||||||||||
| Close | Closing price of this bar | ||||||||||||
| AvgPrice | Average Price of all ticks of this bar | ||||||||||||
| Volume | Volume of this bar | ||||||||||||
| Date | Date of this Bar (YYYYMMDD) | ||||||||||||
| TimeStart | Starting time of the Bar (HHMMSS) | ||||||||||||
| TimeStartSec | Starting time of the Bar (Number of Seconds from midnight) | ||||||||||||
| Time | Ending time of the Bar (HHMMSS) | ||||||||||||
| TimeSeconds | Ending time of the Bar (Number of Seconds from midnight) | ||||||||||||
| BarCounter | Bar Number (starting at 0 for the first Bar) | ||||||||||||
| HighLow | (High + Low)/2 | ||||||||||||
| HighLowClose TypicalPrice |
(High + Low + Close)/3 | ||||||||||||
| HighLowClose3 | (High + Low + 3xClose)/5 | ||||||||||||
| Close121 | (Close + 2xClose[-1] + Close[-2])/4 | ||||||||||||
| Close1221 | (Close + 2xClose[-1] + 2xClose[-2] + Close[-3])/6 | ||||||||||||
| TodayBarCounter | BarSequence Number relative to the beginning of the day (0=first bar on current date) | ||||||||||||
| Typical121 | (TypicalPrice + 2xTypicalPrice[-1] + TypicalPrice[-2])/4 | ||||||||||||
| Typical1221 | (TypicalPrice + 2xTypicalPrice[-1] + 2xTypicalPrice[-2] + TypicalPrice[-3])/6 | ||||||||||||
| TrueRange | Welles Wilder described these calculations to determine the
trading range for a stock or commodity. True Range is defined as the largest of the following:
Wilder included price comparisons among subsequent bars in order to
account for gaps in his range calculation. The raw True Range is then
smoothed (a 14-period smoothing is common) to give an Average True Range (ATR).
The True Range can be smoothed using a variety of moving average types,
including Simple, Exponential, Welles Wilder, etc. |
||||||||||||
| TickSkew | Normalized position of last tick within Bid/Ask: 100=Ask, 0=Bid, 50=between Bid/Ask | ||||||||||||
| TickDir | TickDirection: 1=Up, -1=Down | ||||||||||||
| TickDirVolume | TickDirection: 1=Up, -1=Down multiplied by the Volume | ||||||||||||
| TickSpeed | Number of ticks per second traded | ||||||||||||
| TickWind | Avg tick position within Bid Ask (Bid=0 Ask=100, in between=50) | ||||||||||||
| DayHigh | Highest Price in the day | ||||||||||||
| DayLow | Lowest Price in the day | ||||||||||||
| DayOpen | Opening price of today | ||||||||||||
| DayClose | Closing price of today | ||||||||||||
| BidAsk(nType) | Get Bid/Ask Size related derivations, based on nType:
(Ratio=100 *(Ask/Cnt - Bid/Cnt)
|
Available SDM Special Functions
| EnveleopeHigh(ScopeS,ScopeL) | ScopeS = Short term scope (default 6
bars) ScopeL = Long term scope (default 20 bars) |
||||||||
| ExpandedScope(nDur,nBack,Seq[,"Sym"]) | Load expanded scope into current stream
|
||||||||
| ExpandedStudy{Seq}:Study(par1...) | Calc "study" in paralellel Stream # Seq | ||||||||
| Study("StudySpec"[,nBack) | Calculate the specified study (see below) (nBack = values back) | ||||||||
| Timer(nID,nDur) | Initiate a Timer with the specified ID and
Duration(nDur in Seconds) Timer(nID) returns the timer elapsed since initiation, -1=expired, -2=just expired Example: if Range(Time,100000,123000) Timer(3,180) ; Start timer for 180 Seconds(3Minutes) endif if Timer(3) >= 0 ; Timer is still running endif |
||||||||