//定义变量
N := 3; // 连续K线数量(可根据需要调整)
Q := 0.05; // 止盈比例5%(可根据需要调整)
HIGH_PRICE := REF(HIGH, 1); // 记录前根阳线的最高价
LOW_PRICE := REF(LOW, 1); // 记录前根阴线的最低价
//做多策略
REF(EVERY(ISDOWN,3),1)&&ISUP&&CLOSE > HIGH_PRICE,BK;
CLOSE < LOW_PRICE,SP;
CLOSE > BKPRICE * (1 + Q),SP;
//做空策略
REF(EVERY(ISUP,3),1)&&ISDOWN&&CLOSE < LOW_PRICE,SK;
CLOSE > HIGH_PRICE,BP;
CLOSE < SKPRICE * (1 - Q),BP;
//设置
AUTOFILTER;