Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共11 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:几个止盈的源代码

1楼
KKSH 发表于:2011/3/7 15:14:48

1.

 

strata:=10;
If(
C=PREV,
PREV,
If(
((Ref(C,-1)<PREV)AND (C<PREV)),
Min(PREV,C*(1+strata/100)),
If(
(Ref(C,-1)>PREV) AND (C>PREV),
Max(PREV,C*(1-strata/100)),
If(
C>PREV,
C*(1-strata/100),
C*(1+strata/100)))))

 

 

2.

 

If(cum(1)=1,
{then} Close,
{else} If((C*1.1) <= PREV,
{then}(C*1.1),
{else} PREV));

 

3.

 

If(cum(1)=1,
{then} Close,
{else} If((C*1.1) <= PREV,
{then}(C*1.1),
{else} PREV));

 

4.

 

Volatility Stop (Long)

Pds1:= Input("ATR Lookback?",2,100,10);
Mult:= Input("ATR Multiplier?",1,20,3);
Pds2:= Input("HHV Lookback?",2,100,20);
PrelimStop:= HHV(H,Pds1) - ATR(Pds1)*Mult;
ActualStop:= HHV(PrelimStop,Pds2);
ActualStop


Volatility Stop (Short)

Pds1:= Input("ATR Lookback?",2,100,10);
Mult:= Input("ATR Multiplier?",1,20,3);
Pds2:= Input("LLV Lookback?",2,100,20);
PrelimStop:= LLV(L,Pds1) + ATR(Pds1)*Mult;
ActualStop:= LLV(PrelimStop,Pds2);
ActualStop

 

2楼
KKSH 发表于:2011/3/7 15:15:53

可以改变成金字塔的PEL格式

3楼
msy0985 发表于:2011/3/7 15:30:17
现在金字塔能用这些不?
4楼
KKSH 发表于:2011/3/7 15:32:26

periodsshort:=Input("periods if short",1,50,10);
periodslong:=input("periods if long",1,50,10);

HHV(H,periodsshort)-atr(periodsshort);
{stop loss level for short positions}
LLV(L,periodslong)+ATR(periodslong);
{stoploss level for long positions}

5楼
KKSH 发表于:2011/3/7 15:39:03
Uptrend Signal

Peak(1,If(H>Ref(HHV(H,4),-1),Ref(LLV(L,4),-1),0),1) <>
Ref(Peak(1,If(H>Ref(HHV(H,4),-1),Ref(LLV(L,4),-1),0),1),-1)
Downtrend Signal

Peak(1,If(L<Ref(LLV(L,4),-1),Ref(HHV(H,4),-1),0),1) <>
Ref(Peak(1,If(L<Ref(LLV(L,4),-1),Ref(HHV(H,4),-1),0),1),-1)
Uptrend / Downtrend Signals

If(BarsSince(Fml("Downtrend Signal")) <BarsSince(Fml("Uptrend Signal")),
{then} Ref(HHV(H,4),-1), {else} Ref(LLV(L,4),-1))
6楼
fly 发表于:2011/3/7 16:00:08

楼主的CUM(1)和PREV是什么意思 

7楼
KKSH 发表于:2011/3/7 16:03:58
MetaStock  的代码
8楼
KKSH 发表于:2011/3/7 16:47:03

CUM是累计的意思

PREV是类似公式重复计算前一根的意思

[此贴子已经被作者于2011-3-7 16:53:45编辑过]
9楼
KKSH 发表于:2011/3/7 16:50:41

Cumulate(累积)
SYNTAX        cum( DATA ARRAY )

FUNCTION        Calculates a cumulative sum of the DATA ARRAY from the first period in the chart.
EXAMPLE        The formula "cum( 1 )" calculates an indicator that rises one point for each day since the beginning of the chart; the formula "cum( C )" calculates the cumulative total of all closing prices from the beginning of the chart.

 

 


 

PREV
The PREV constant allows you to create self-referencing formulas.  A self referencing formula is one that is able to reference the "previous" period's value of itself.
For example, the following is an example of a self referencing formula:
((H+L+C)/3) + PREV
This simple formula divides the high, low, and closing prices by 3 and then adds this value to yesterday's value of the ((H+L+C)/3).
The calculation of the popular indicator On Balance Volume illustrates the use of the PREV function.

(if(c>ref(c,-1),1,-1)*volume)+PREV
Although On Balance Volume can be calculated without the use of the PREV function, an exponential moving average cannot (other than using the mov() function).  The following formula shows how a 18% exponential moving average (approximately 10-periods) is calculated using the PREV function.
(close*0.18)+(PREV*0.82)

[此贴子已经被作者于2011-3-7 16:50:54编辑过]
10楼
xian_0_9 发表于:2011/3/7 23:57:31

能介绍一下4个都是什么意思么

共11 条记录, 每页显示 10 条, 页签: [1] [2]


Powered By Dvbbs Version 8.3.0
Processed in 0.04688 s, 3 queries.