
等级: 新手上路
- 注册:
- 2022-8-8
- 曾用名:
|
我的测试公式代码如下:
VARIABLE: shoushu := 100;
_rand : rand(2), nodraw;
DEBUGFILE('D:\temp\weistock_301333.TXT', STKLABEL&':shoushu='&numtostr(shoushu,0)&';_rand=%.0f', _rand);
shuju : c - (rand(5)+5), COLORWHITE;
gap : shuju - c, nodraw;//这一步是为了方便看出shuju : c + rand(50)+5;这句话产生的rand是随机的还是固定的。
is_lastBar : ISLASTBAR(), NODRAW;
//if not(ISLASTBAR()) THEN EXIT;
_barpos : BARPOS, NODRAW;
shoushu := shoushu+100;
显示shoushu: shoushu;
cond : round(_rand%2)=0, NODRAW;
显示Buy : BUY(cond , shoushu, THISCLOSE), NODRAW;
显示holding : HOLDING, NODRAW;
line := '';
FOR i=1 TO BARPOS DO
BEGIN
//DEBUGFILE('D:\temp\weistock_301333.TXT', ' '&'i='&'%.0f',i);
//line := line & numtostr(_rand[i],0) & ',';
line := line & numtostr(显示Buy[i],0) & ',';
END
DEBUGFILE('D:\temp\weistock_301333.TXT', STKLABEL&':收盘价='&numtostr(c,2)&';手数=%.0f', shoushu);
DEBUGFILE('D:\temp\weistock_301333.TXT', ' '&line&'$$$%.0f',0);
//DEBUGFILE('D:\temp\weistock_301333.TXT', ' '&STKLABEL&':_rand=%.0f', _rand);
//DEBUGFILE('D:\temp\weistock_301333.TXT', ' '&STKLABEL&':c_ref2=%.2f', c_ref2);
//DEBUGFILE('D:\temp\weistock_301333.TXT', ' '&STKLABEL&'c_next1=%.2f', c_next1);
//DEBUGFILE('D:\temp\weistock_301333.TXT', ' '&STKLABEL&'c_next2=%.2f', c_next2); |
|