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
可以改变成金字塔的PEL格式
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}
Uptrend Signal |
Downtrend Signal |
Uptrend / Downtrend Signals |
楼主的CUM(1)和PREV是什么意思
CUM是累计的意思
PREV是类似公式重复计算前一根的意思
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)
能介绍一下4个都是什么意思么