Sei sulla pagina 1di 100

Power Language

Power Language

STSSniper IDE

Power Language

K
Power Language

IF close > High[1] then


Buy ("") next bar at market
End IF
4

(520)
K

Power Language
IF close < MA(close,5) + 20 and low <low[1] then
Sell ("") next bar at close
End IF
5

IF close < MA(close,5) + 20 and low <low[1] then

Sell ("") next bar at close

End IF

STS

6

Power Language-Sniper IDE

1.
3.
5.

2.
4.
6.

2.(~)
STS
3.()
STSSTS
4.()
STS
5. ()

6.()
F7

-STS

/
Data

Alert()
1.
2.
Alert ();

3.Format Analysis Techniquesenable alert


alert
4.
Alert(Warning!!)
Warning!!

10

-
FileAppendFileDelete

1.
2.
FileAppend(,)
FileDelete()
3.
FileAppend(c:\test.txt,test))
C:test.txttest
FileDelete(c:\test.txt)
C:test.txt
11

-
Print

1.
2.
Print(1,2,,n)
Print(File(),1,2,,n)
3.RunBar

4.
Print(value1,value2,value3)
value1value2value3

12

13

Time

Date

24(HHMMSS)
145134500

If Time=134500~~~

//(YYYMMDD)
2008/9/221080922
1998/10/13981013

If Date>Date[1]~~~
14

Data-

Open

Bar

High

Bar

Low

Bar

Close

Bar

OpenInt

Bar

OI

Volume

Bar

Upticks

Bar

Bar/

Downticks

Bar

Bar/
15

Data-Bar
DataCompression
1.Bar
2.

Bar

Tick

ox
16

Data-Bar

BarInterval
1.Bartimeflame
2.
(1)BarIntraday Bar
(2)Bar3030
55

17

Data-Bar

Currentbar
1.Bar
2.
(1)CurrentbarBar
Currentbar[1]Bar
3.
If condition1 then value1 = Currentbar
If Currentbar = value1 + 20 then exitlong
20Bar

18

( )

(high+low+close)/3

input, var

[]

high[1]1bar high
high[2]2bar high

//

/*
*/

19

()

()

an
at
by
does
is
of

the
()

on
than
the
was

20

-()

AbsAbsValue

AbsValue(-25.54)25.54

ArcTangent

tan

ArcTangent(45)88.7270

Ceiling

Ceiling(4.5)5

Cosine

cos

Cosine(45)0.7071

Sine

sin

Sin(45)0.7071

Tangent

tan

Tangent(45)1

ExpValue

Square

Squareroot

ExpValue(4.5)90.0171
Square(10)100
Squareroot(100)10
21

-()

Log

Floor

Floor(4.5)4

Mod

Mod(17,5)2

MaxList

MaxList(18,67,98)98

MinList

MaxList(18,67,98)18

Power

Power(2,3)8Power(4,5)
4096

Random

Random(100)0-100

Round

Log(172)5.1475

Round(9.5687,3)9.569
22

-Highest

HighestLowest

1.HighestLowest
2.
Highest(,)
Lowest(,)

3.
(1)
(2)Bar3030Bar
4.
Highest(High,50) 50Bar
Lowest(Close,30) 30Bar
23

-StdDev

StdDev;

1.
2.
StdDev()
3.

4.
StdDev(close,20);
20Bar
24

-Average

Average
1.nbar
2.
Average(,)
3.
Average(close,20)
20Bar
Bar20MA
25

-RSI

RSI(

1.
2.
RSI(,)
3.
RSI(Close,50);
50BarRSI

2Bar50RSI
26

-MACD

MACD

1.nbar
2.
MACD(,_,_)
3.
MACD(close,5,20)
530

27

- SwingHigh

SwingHighSwingLow
()

1.(SwingHigh)
(SwingLow)
2.
SwingHigh(,,,)
SwingLow(,,,)
3.
(1)12
(2)close
(3)33

(4)
1
28

- SwingHighBar

SwingHighBarSwingLowBar
()

1.(SwingHighBar)
(SwingLowBar)BarBar
2.
SwingHighbar(,,,)
SwingLowbar(,,,)
3.
(1)12
(2)close
(3)33

(4)
1
29

30

MA

31

/
: + ,- ,* , /, ^
: <> , = , >= , > ,< , <>
And, Or, Not
If~ Then~ End If, for ~ end for

32

Example:
Value1=(Close+High+Low)/3

Close=7100;High=7150;Low=7050
value1=7100

Value2=value2*(1+10%)

+
*
/

value2=7000
Value2=value2*(1+10%)
value2=7070

33


Example:
Condition1=High>8000
High=8100
Condition1True

Condition2=Close<7900
Close=8000
Condition2false

Condition3=(High-Low)<>100
High=8100Low=8000
Condition3false

<>

<

>=

>

<=

34

-
Example:
Condition1=value1 cross over value2

Condition2=value1 cross under value2

Cross over

Cross above
Cross under

Cross Below

()

()

35


Example:
Condition1=(C>7000) And (H<8000)
Condition2=(C>7000) Or (H<8000)
Condition3=NOT(C>7000)

Condition1=(C>7000) And (H<8000)


70008000

Condition1=True

(C>7000)

(H<8000)

NOT A

A And B

A OR B

36

()
^
*/
+ = <><>=><=
andornot

1
2
3
4
5
6

condition1=(H>(C+10*2^2)) and (H>O)


H=7200C=7100O=7170
Condition=(True or False)
37

If () Then
{}
End If

IF C>H Then
value1=C
End IF

C>H

Value1=C

If () Then
{}
else
{}
End If

IF C>H Then

value1=C
C>H
Else
value1=H
Value1=H
Value1=C
End IF

38

Iff ( () ,)

Iff ( C>H ,C,H)

C>H

Value1=H

Value1=C

39

and
1 and 2 and 3
If 1. and 2. and 3.3 then
K
End IF
1~3

Condition~
Condition1=
Condition2=
Condition3=3
IF Condition1 and Condition2 and Condition3 then
K
Else
K
End IF
40

-()

For begin end for

For = to
{}

End For
For i = 0 to Length-1
sum = sum +close[i]
End For
Value1=sum / length
lengthMA

41

-()

Do WhileLoop

Do While ()
{}
Loop

Do While close > close[1]


value1=value1+volume
End For

42

(ex1,2,3)

43

vs

(1,2)

(Numeric)

(True ,False)

(True ,False)

(Boolean)

(String)

aaa = 2+3

If close <close[1] then


bbb = true
End IF

ccc = Hi"

44

STS-
()

()

VariableVariables
VarVars

Array,Arrays

Variable:()

Array:[]()

Variable:aaa(0)
Variable:flag(True)
Variable:months ("")

Array :aaa[3] (0)


Array :flag[2] (True)
Array :months[12] ("")

45

STS
()

()

VariableVariables
VarVars

Parameter Parameters
ParamParams

Variable:()

Parameter:()

Variable:Length(0)
Variable:flag(True)
Variable:months ("")

Parameter:Length(10)
Parameter:flag(True)

Parameter:months ("March")
46

MACD

Kbar3MA

47

(1)
()()
Close
Close=100
(2)()
Value1 ~ Value99
Condition1 ~ Condition99

Value0-99

(Numeric)

Condition0-99

(Boolean)

(True,False)
48

(1)Draw1-99 DrawBar1-99()
(2)Candle PatternDrawPoint1-99()
(3)FindPoint1-99()
50

Draw/DrawBase()-

1.
2.
DrawN(,[],[/Default],[])
3.
(1)-115
Default
(2)
4.

51

-1

default

10

11

12

13

14

15

52

-K

DrawBar()-

1.KHeikin-Ashi
2.
DrawBarN(Bar, Bar, Bar,Bar,
,[],[],[])
3.BarBar
4.

53

NoDraw/NoDrawBar()-

1.DrawDrawbar

2.
NoDraw(N) NoDrawbar(N)
4.

54

-()

Drawpoint()Candle Pattern ()

1.K
2.
DrawpointN(topside/bottomside,,[/Default],[])
4.

55

NoDrawPoint()Candle Pattern ()

1.Candle PatternDrawPoint

2.
NoDrawpoint(N)
4.

56

-()

FindPoint/noFindpoint()-

1.DrawPointnoDrawPoint
2.
FindpointN(topside/bottomside,,[/Default],[])
noFindpoint(N)

57

Txt_New

1. Txt_New
2.
Txt_New(,,,)

3.
241345145

4.

58

TL_New
1. TL_New
2.
TL_New((T),,,(T+1),
,)
3.

59

MACD
/* Moving Average Convergence & Divergence */
Parameter: FastMA(12), SlowMA(26), MacdMA(9)
Value1 = MACD(Close, FastMA, SlowMA)
Value2 = EMA( Value1, MacdMA)

Draw1( Value1, "MACD", Red, Default, 1)


Draw3( Value1 - Value2, "MADiff", Iff(Value1-Value2>0, Red,
Green), Default,5)
Draw2( Value2, "MACDAvg", Blue)
DrawBase1(0, "0", DarkGray)

60


/* BollingerBands*/
Parameter: Price(Close), Length(20), UpMultiplier(2.0),
DnMultiplier(-2.0)
Value11 = MAFC(Price, Length)
Value12 = StdDev(Price, Length)
Value1=Value11+UpMultiplier*value12
Value2=Value11+DnMultiplier*value12
If CurrentBar >= 1 Then
Draw1 ( Value1, "BollTop")
Draw2 ( Value2, "BollBot")
Else
NoDraw(1)
NoDraw(2)
End If
61

KD
/* Stochastic Line*/
Parameters :OverSold(20), OverBought(80)
variables: rsv(0), kk(0), dd(0)
rsv=((close-lowest(low,9))/(highest(high,9)- lowest(low,9)))*100
kk=kk[1]*2/3+rsv*1/3
dd=dd[1]*2/3+kk*1/3
DrawBase1( OverBought, "Over Bought", DarkGray )
DrawBase2( OverSold, "Over Sold", DarkGray )
Draw2( Round(kk,2), "%K", Red)
Draw1( Round(dd,2), "%D", Blue)

62


Parameter:(50)
Variables:up(0)
up=(H+L)/2
IF LastBarOnChart THEN
value20=TXT_New( Date,Time,up ,space(+1)+NumToStr(up,1) +"
up")
TXT_SetColor( Value20,RED)
End If

63

65

Buy

Sell

ExitLong

ExitShort

1.from
2.

: Buy() this bar on close


()K
66

This bar

Bar

Today

Next bar

Bar

Tomorrow

On Close

Bar

this bar

At Market

Bar

next bar

Limit

()

1.next bar
2.

Stop

()

1.next bar
2.

67

-
If condition1 then
{}
End IF

Buy ()
Buy on close ()
Buy("") on close ()
Buy("") this bar on close ()
Buy("") next bar at market ()
Buy("") 1 contract this bar at close (1)
Buy() 1 contract next bar at market (1)

BuySell
68

-
If condition1 then
{}
End IF

exitlong ()
exitlong on close ()
exitlong("") on close ()
exitlong("") this bar on close ()
exitlong("") next bar at market ()
exitlong("") 1 contract this bar at close (1)
exitlong("") 1 contract next bar at market (1)

exitlongexitshort
69

-()
If condition1 then
Buy("") next bar at market
End IF

If condition2 then
exitlong from entry("") next bar at market
End IF
If condition1 then
Buy 1 contract this bar on close
End IF

If condition2 then
exitlong all contracts next bar at market
All contractstotal
End IF
70

-
If condition1 then
{}
End IF

Buy Stop=or higher


SellStop= or lower
Buy limit=or lower
better
Selllimit= or higher

Buy("") next bar at high[1] stop/limit()

Buy("") next bar at high[1]+2 point stop


Buy("") 1 contract next bar at high[1] limit
Buy("") 1 contract next bar at high[1]+2 point stop

BuySell
71

-
If condition1 then
{}
End IF

exitlong Stop=or lower


exitshortStop= or higher
exitlong limit=or higher
exitshortlimit= or lower

better

exitlong("") next bar at high[1] stop/limit()

exitlong("") next bar at high[1]+2 point stop


exitlong("") 1 contract next bar at high[1] limit
exitlong("") 1 contract next bar at high[1]+2 point stop

exitlongexitshort
72

-
Order

Stop

Buy

Or Higher

Or Lower

Or Lower

Or Higher

Or Lower

Or Higher

Or Higher

Or Lower

Exitlong
Sell

Exitshort

Limit
better
better

73

Commission_B
Commission_S
Commission_XL
Commission_XS

Margin

Slippage

74

Marketposition

()

1-1
0

22
-22
0

PositionProfit(0)

PositionProfit(3)3
PositionProfit(0)

OpenPositionProfit

AvgEntryPrice

CurrentContracts

:
If MarketPosition = -1 and condition1 Then
ExitShort (XS") Next Bar at Close-50 Stop
End If

75

BarSinceEntry
Bar
() BarBar

BarSinceEntry(2)2
BarBarBar

BarSinceExit

Bar
BarBar

BarSinceEntry(2)2
BarBarBar

EntryDate

EntryDate(2)2

EntryTime

EntryTime(2)2

EntryPrice
EntryPrice(2)2
()
ExitDate

ExitDate(2)2

ExitTime

ExitTime(2)2

ExitPrice

ExitPrice(2)2

ExitShort(XS) at EntryPrice(0)-30 Stop


(-30)
76

LargestLosTrade

LargeWinTrade

MaxIDDrawDown

DrawDown

NetProfit

PercentProfit

MaxConseclosers

MaxConsecWinners

GrossProfit

AvgBarsLosTrade

Bar

TotalTrades

77

KD

KD
KD

K80
K20

78

KD

79

5bar
5bar5bar
()
5bar
5bar5bar
()

80

81

20

=+(-)*1.382
=(+)/2
=-(-)*1.382

82

83

84

85

PowerLanguage
This Bar
PLStopThis bar

If close > open then buy this bar at low


buy this bar at open + 20 point stop


20

86

This bar

If close cross over average(close,30) then


buy this bar
End If
this bar

87

this Bar

If high >= (entryprice(0) + 50) then


If open>=(entryprice(0) + 50) then
Exitshort this bar at open or higher
Exitshort this bar at open or lower
Else
Exitshort this bar at (entryprice(0) + 50) or higher
Exitshort this bar at (entryprice(0) + 50) or lower
End if
End if

88

(1)Ma5Ma10

(2)

89

90

-MA

3
value1

92

(1)
(2)
93

Average()

(1)
Average

so
(Numeric)

94

Average()

(1)

()
(), Average
price(),Length()

(8000)

(True/False)

("" )

param :Price(Numeric) param :Price(bool)


param :Price(string)
param :Length(Numeric) param :Length(bool) param :Length(string)

95

Average
2

96

97

Bollingerband
(Numeric)

98

99

~~

100

Potrebbero piacerti anche