Formula Writing 1000 Questions 36-37

36. Question:
How to express ema(c,n) in vbs Answer (old bug): According to the algorithm, I compiled a {if Y=EMA(X,N) then Y=[2 X+(N-1) Y' ] / (N+1), where Y' represents the value of Y in the previous period} input:n(20,1,999); a:=c; VARIABLE:y=0 c; for i=1 to datacount do y[i]:= (2 a[i]+(n-1) y[i-1])/(n+1); Worm: y; Zhenzong: ema(c,n); Answer (chasing the wind and chasing the moon): a:= c;n:=5; y[1]:=a[1]; for i=2 to datacount do y[i]:=(2 a[i]+(n-1)* y[i-1] )/(n+1); Worm: y; Zhenzong: ema(c,n); QUOTE: 37. Q: How to remove the stocks that have been suspended for more than 10 days in the Flying Fox conditional stock selection Answer (Lin Hanming): Main indicator source code: Large market:=STKINDI('1A0001','Suspension call',0,6); Individual stock:=BARSCOUNT©; Days of suspension:=General market-REF(large market,1)-(individual stock-REF(individual stock,1)); DRAWTEXT (days of suspension, SYSPARAM(5)*1.05, 'days of suspension'), ALIGN2; DRAWNUMBER(days of suspension, SYSPARAM(5), days of suspension, 0), ALIGN2; DRAWTEXT(days of suspension, SYSPARAM(5), 'days '); VERTLINE (days of suspension), POINTDOT; Call indicator source code: barscount©Sometimes the suspension time is long, so the source code of the main indicator can be changed to: (note, a call indicator is added) Market: =STKINDI('1A0001','Suspension call',0,6); Individual stocks:=BARSCOUNT©; Days of suspension in the previous period :=big market-REF(big market,1)-(individual stock-REF(individual stock,1)); DP:=CURRENTDATE; interval:=DATEDIFF(DATE,DP); 2',0,6); Current trading suspension days:=ISLASTBAR (interval-market interval); DRAWTEXT(previous suspension days, SYSPARAM(5)*1.05,'previous suspension days'),ALIGN2; DRAWNUMBER(previous suspension days, SYSPARAM(5), days of previous suspension, 0), ALIGN2; DRAWTEXT(days of previous suspension, SYSPARAM(5), 'days'); VERTLINE(days of previous suspension), POINTDOT; DRAWTEXT(current suspension days, SYSPARAM(4)* 1.05,'current suspension days'),ALIGN2; DRAWNUMBER(current suspension days,SYSPARAM(4),current suspension days,0),ALIGN2;DRAWTEXT(current suspension days,SYSPARAM(4),'days'); VERTLINE(current Suspension days), POINTDOT; The source code of the second call indicator: DP:=CURRENTDATE; Interval:=DATEDIFF(DATE,DP); REF(interval,1)-interval-1; : (also very accurate) Large market:=STKINDI('1A0001','Suspension call',0,6); Individual stocks:=BARSCOUNT©; Days of previous suspension:=General market-REF(large market,1)-(individual stocks-REF( Individual stocks, 1)); DRAWTEXT(Number of trading suspension days in the previous period, SYSPARAM(5)1.05,'Number of trading suspension days in the previous period'), ALIGN2,COLORYELLOW; DRAWNUMBER(Number of trading suspension days in the previous period,SYSPARAM(5),Days suspension in the previous period,0),ALIGN2,COLORYELLOW; DRAWTEXT(Number of trading suspension days in the previous period,SYSPRAM(5),'days' ),COLORYELLOW; VERTLINE(the number of suspension days in the previous period),POINTDOT; Large market:=STKINDI('1A0001','Suspension calls 3.VAR1',0,6); Large market 2:=STKINDI('1A0001','Suspension calls 3. VAR2',0,6); Current suspension days:=ISLASTBAR (Large-Large 2); DRAWTEXT(Current suspension days,SYSPARAM(4)*1.05,'Current suspension days'),ALIGN2,COLORWHITE; DRAWNUMBER(Current suspension Days, SYSPARAM(4), current suspension days, 0), ALIGN2, COLORWHITE; DRAWTEXT(current suspension days, SYSPARAM(4),'days'),COLORWHITE; VERTLINE(current suspension days),POINTDOT; calling indicator source code: VAR1 :DATACOUNT; VAR2:BARSCOUNT©;

Guess you like

Origin blog.csdn.net/qq974416775/article/details/129515042