Introd u ction to signals FIN AN C IAL TR AD IN G IN R Il y a - - PowerPoint PPT Presentation

introd u ction to signals
SMART_READER_LITE
LIVE PREVIEW

Introd u ction to signals FIN AN C IAL TR AD IN G IN R Il y a - - PowerPoint PPT Presentation

Introd u ction to signals FIN AN C IAL TR AD IN G IN R Il y a Kipnis Professional Q u antitati v e Anal y st and R programmer What are signals ? Signals are the interactions of : Market data w ith indicators Indicators w ith other indicators E


slide-1
SLIDE 1

Introduction to signals

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-2
SLIDE 2

FINANCIAL TRADING IN R

What are signals?

Signals are the interactions of: Market data with indicators Indicators with other indicators Examples: 50-day MA crossing over 200-day MA Oscillator crosses under 20 Signal is necessary (but not sucient) for buy/sell order

slide-3
SLIDE 3

FINANCIAL TRADING IN R

Using add.signal()

Very similar to the process for creating indicators Only a few signal functions

add.signal(strategy.st, name = “function", arguments = list(arguments), label = "label")

Again, similar to apply family

slide-4
SLIDE 4

FINANCIAL TRADING IN R

Four types of signals

sigComparison : Relationship between two indicators, returns 1 if relationship is true sigCrossover: Similar to sigComparison, returns 1 on the rst

  • ccurrence

sigThreshold: Compares range-bound indicator to a static quantity sigFormula: Flexible signal function

slide-5
SLIDE 5

FINANCIAL TRADING IN R

Examples

slide-6
SLIDE 6

FINANCIAL TRADING IN R

Examples

slide-7
SLIDE 7

Let's practice!

FIN AN C IAL TR AD IN G IN R

slide-8
SLIDE 8

sigComparison and sigCrossover

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-9
SLIDE 9

FINANCIAL TRADING IN R

Trend indicators

sigCrossover and sigComparison

Both compare two variable quantities Example: shorter lookback MA crosses over longer lookback MA (50- day versus 200-day SMA)

slide-10
SLIDE 10

FINANCIAL TRADING IN R

Structure

add.signal(strategy.st, name = "sigComparison", arguments = list(columns = c("str1", "str2"), relationship = "lt" ), label = "siglabel") add.signal(strategy.st, name = "sigCrossover", arguments = list(columns = c( "str1", "str2"), relationship = "eq"), label = "siglabel")

“gt”, “lt”, “eq”, “lte”, “gte”

slide-11
SLIDE 11

FINANCIAL TRADING IN R

Structure

add.signal(strategy.st, name = "sigCrossover", arguments = list(columns = c("SMA50", "SMA200"), relationship = "gt"), label = "longfilter") add.signal(strategy.st, name = "sigComparison", arguments = list(columns = c("SMA50", "SMA200", relationship = "lt" ), label = "filterexit")

slide-12
SLIDE 12

FINANCIAL TRADING IN R

Examples

slide-13
SLIDE 13

Let's practice!

FIN AN C IAL TR AD IN G IN R

slide-14
SLIDE 14

sigThreshold

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-15
SLIDE 15

FINANCIAL TRADING IN R

About sigThreshold

deals with bounded indicators interacting with critical (and usually xed) values Examples: when the DVO crosses under 20

  • n indicator with running probability value (between 0 and

1)

  • n rolling ratio’s that center on 0
slide-16
SLIDE 16

FINANCIAL TRADING IN R

Structure

add.signal(strategy.st, name = “sigThreshold", arguments = list(column = "str1", threshold = 20, cross = TRUE, relationship = "lt" ), label = "siglabel")

cross = TRUE mimics sigCrossover cross = FALSE mimics sigComparison

slide-17
SLIDE 17

FINANCIAL TRADING IN R

Examples

add.signal(strategy.st, name = “sigThreshold", arguments = list(column = "DVO_2_126", threshold = 20, cross = FALSE, relationship = “lt"), label = "thresholdfilter") add.signal(strategy.st, name = “sigThreshold", arguments = list(column = "DVO_2_126", threshold = 80, cross = TRUE, relationship = "gt"), label = "thresholdfilter")

slide-18
SLIDE 18

FINANCIAL TRADING IN R

Examples

slide-19
SLIDE 19

Let's practice!

FIN AN C IAL TR AD IN G IN R

slide-20
SLIDE 20

sigFormula

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-21
SLIDE 21

FINANCIAL TRADING IN R

About sigFormula

Catch-all signal allowing for combinations of signals Uses string evaluation Example: ONLY act upon oscillator signaling if favorable market environment (50-day SMA above 200-day SMA) make sure to buy a temporary pullback, not a large decline

slide-22
SLIDE 22

FINANCIAL TRADING IN R

Structure

add.signal(strategy.st, name = "sigFormula", arguments = list(formula = "statement1 & statement2”, cross = TRUE), label = "yourlabel")

Base R: if( statement 1 and statement 2)

add.signal(strategy.st, name = "sigFormula", arguments = list(formula = "regular logical statement inside an if statement", cross = TRUE), label = "yourlabel")

slide-23
SLIDE 23

FINANCIAL TRADING IN R

Example

add.signal(strategy.st, name = “sigFormula", arguments = list(formula = "longthreshold & longfilter", cross = TRUE), label = "longentry")

make sure that the columns in the logical statement are in the strategy prior to the sigFormula signal call

slide-24
SLIDE 24

Let's practice!

FIN AN C IAL TR AD IN G IN R