Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"leaves":["script CalcMomentum"],"root":"unitTest"}
19 changes: 19 additions & 0 deletions UDL-samples/thinkScript_Sample.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MTF Moving Average

input AvgType = AverageType.EXPONENTIAL;
input Length = 8;
input priceclose = close;

plot AVG = MovingAverage(AvgType);
AVG.setdefaultcolor(color.yellow);

script CalcMomentum {
input priceData = close;
input lookbackPeriod = 14;

# Calculate the change from X bars ago
def change = priceData - priceData[lookbackPeriod];

# Return the final calculation via a plot statement
plot Result = change;
}
65 changes: 65 additions & 0 deletions UDLs/thinkScript_by_sbh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<NotepadPlus>
<UserLang name="thinkScript" ext="ts" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="2" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1" />
<Keywords name="Numbers, prefix2" />
<Keywords name="Numbers, extras1" />
<Keywords name="Numbers, extras2" />
<Keywords name="Numbers, suffix1" />
<Keywords name="Numbers, suffix2" />
<Keywords name="Numbers, range" />
<Keywords name="Operators1">+ - * / % = == != &lt;&gt; &lt; &gt; &lt;= &gt;= &amp;&amp; ! . , ( ) ;</Keywords>
<Keywords name="Operators2">equals "is equal to" "is not equal to" "is less than" "is greater than" "is less than or equal to" "is greater than or equal to" between crosses "crosses above" "crosses below" "is true" "is false" and or</Keywords>
<Keywords name="Folders in code1, open">{</Keywords>
<Keywords name="Folders in code1, middle" />
<Keywords name="Folders in code1, close">}</Keywords>
<Keywords name="Folders in code2, open" />
<Keywords name="Folders in code2, middle" />
<Keywords name="Folders in code2, close" />
<Keywords name="Folders in comment, open" />
<Keywords name="Folders in comment, middle" />
<Keywords name="Folders in comment, close" />
<Keywords name="Keywords1">hide_on_daily hide_on_intraday lower on_volume once_per_bar real_size upper weak_volume_dependency zerobase</Keywords>
<Keywords name="Keywords2">ask bid close high hl2 hlc3 imp_volatility low ohlc4 open open_interest tick_count volume vwap AddChartBubble AddCloud AddLabel AddVerticalLine AssignBackgroundColor AssignNormGradientColor AssignPriceColor AssignValueColor Color CreateColor DefineColor DefineGlobalColor EnableApproximation GetColor GlobalColor Hide HideBubble HidePricePlot HideTitle SetChartType SetDefaultColor SetHiding SetLineWeight SetPaintingStrategy SetStyle TakeValueColor Delta Gamma GetATMOption GetDaysToExpiration GetNextExpirationOption GetNextITMOption GetNextOTMOption GetStrike GetUnderlyingSymbol IsEuropean IsOptionable IsPut OptionPrice Rho Theta Vega AccumDist Average BodyHeight EMA2 ExpAverage FastKCustom GetMarketMakerMove GetMaxValueOffset GetMinValueOffset Highest HighestAll HighestWeighted IsAscending IsDescending IsDoji IsLongBlack IsLongWhite Lowest LowestAll LowestWeighted Median MidBodyVal MoneyFlow MovingAverage TrueRange Ulcer WildersAverage WMA AbsValue ACos ASin ATan Ceil Cos Crosses Exp Floor IsInfinite IsNaN Lg Log Max Min Power Random Round RoundDown RoundUp Sign Sin Sqr Sqrt Sum Tan TotalSum Correlation Covariance Inertia InertiaAll LinDev StDev StDevAll StErr StErrAll CountTradingDays DaysFromDate DaysTillDate GetDay GetDayOfMonth GetDayOfWeek GetLastDay GetLastMonth GetLastWeek GetLastYear GetMonth GetTime GetWeek GetYear GetYYYYMMDD RegularTradingEnd RegularTradingStart SecondsFromTime SecondsTillTime GetActualEarnings GetDividend GetEstimatedEarnings GetEventOffset GetSplitDenominator GetSplitNumerator HasConferenceCall HasEarnings GetAggregatedPL GetAveragePrice GetNetLiq GetOpenPL GetPortfolioAggregatedPL GetTimeWeightedReturn GetQuantity GetTotalCash DataProfile GetHighest GetHighestValueArea GetLowest GetLowestValueArea GetPointOfControl MonkeyBars Show TimeProfile VolumeProfile BookValuePerShare CurrentRatio DividendPayout DividendsPerShareTTM EarningsPerShareTTM FinancialLeverage FixedChargeCoverageRatio FreeCashFlowPerShare GrossProfitMargin InterestRate InventoryTurnover LongTermDebtToCapital NetProfitMargin OperatingProfitMargin QuickRatio ReturnOnAssets ReturnOnEquity SalesPerShare TaxRate TotalAssetTurnover AddOrder Alert AsDollars AsPercent AsPrice Assert AsText BarNumber Between CompoundValue Concat EntryPrice First FPL Fundamental GetAggregationPeriod GetInterestRate GetPriceType GetSymbol GetSymbolPart GetValue GetYield HasContractChangeEvent TickSize TickValue</Keywords>
<Keywords name="Keywords3">AggregationPeriod MIN TWO_MIN THREE_MIN FOUR_MIN FIVE_MIN TEN_MIN FIFTEEN_MIN TWENTY_MIN THIRTY_MIN HOUR TWO_HOURS FOUR_HOURS DAY TWO_DAYS THREE_DAYS FOUR_DAYS WEEK MONTH OPT_EXP QUARTER YEAR Alert BAR ONCE TICK AverageType EXPONENTIAL HULL SIMPLE WEIGHTED WILDERS ChartType BAR CANDLE CANDLE_TREND HEIKIN_ASHI EQUIVOLUME LINE AREA Color BLACK BLUE CURRENT CYAN DARK_GRAY DARK_GREEN DARK_ORANGE DARK_RED DOWNTICK GRAY GREEN LIGHT_GRAY LIGHT_GREEN LIGHT_ORANGE LIGHT_RED LIME MAGENTA ORANGE PINK PLUM RED UPTICK VIOLET WHITE YELLOW CrossingDirection ABOVE BELOW ANY Curve FIRM LONG_DASH MEDIUM_DASH SHORT_DASH POINTS Double E NaN NEGATIVE_INFINITY Pi POSITIVE_INFINITY EarningTime ANY BEFORE_MARKET AFTER_MARKET Events CONFERENCE_CALL DIVIDEND EARNINGS SPLIT FiscalPeriod QUARTER YEAR FontSize SMALL MEDIUM LARGE LARGER VERY_LARGE X_LARGE FundamentalType HIGH LOW CLOSE OPEN HL2 HLC3 OHLC4 VWAP VOLUME OPEN_INTEREST IMP_VOLATILITY TICK_COUNT Location TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT MonkeyVolumeShowStyle ALL LAST NONE NumberFormat DOLLAR THREE_DECIMAL_PLACES TWO_DECIMAL_PLACES OptionClass CALL PUT OrderType BUY_AUTO BUY_TO_CLOSE BUY_TO_OPEN SELL_AUTO SELL_TO_CLOSE SELL_TO_OPEN PaintingStrategy ARROW_DOWN ARROW_UP BOOLEAN_ARROW_DOWN BOOLEAN_ARROW_UP BOOLEAN_POINTS BOOLEAN_WEDGE_DOWN BOOLEAN_WEDGE_UP DASHES HISTOGRAM HORIZONTAL LINE LINE_VS_POINTS LINE_VS_SQUARES LINE_VS_TRIANGLES POINTS SQUARED_HISTOGRAM SQUARES TRIANGLES VALUES_ABOVE VALUES_BELOW PricePerRow AUTOMATIC TICKSIZE PriceType ASK BID LAST MARK ProfitLossMode COST_BASIS EXECUTION_PRICE Sound NoSound Bell Ding Ring Chimes</Keywords>
<Keywords name="Keywords4">Any boolean constant CustomColor double enum float IDataHolder input int integer_price String Symbol @Date</Keywords>
<Keywords name="Keywords5">above ago and bar bars below between case crosses declare def default do else equal equals false fold from greater if is less no not or plot profile rec reference script switch than then to true while with within yes</Keywords>
<Keywords name="Keywords6" />
<Keywords name="Keywords7" />
<Keywords name="Keywords8" />
<Keywords name="Delimiters">00" 01\ 02" 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008040" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="FF0000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="FF8040" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="0080FF" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="FF00FF" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="FF00FF" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="0080FF" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="800000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
Loading