Hej, prøve å kode denne strategien i teksten under, noen som kan verifisere at koden er riktig:
If the S&P opens inside of the previous day’s range, and above the previous day’s close, a short will be taken (in a bear regime, aka S&P is under the 100 day SMA)
b1:=ref(L,1)
b2:=ref(H,1)
b3:=ref(C,1)
b4:=ref(O,0)
b5:=lt(b2,b1)
ma100:=mov(b4,100,s)
cond1=lt(b4,b2)
cond2=gt(b4,b1)
cond3=gt(b4,b3)
innehav=eqv(portfolio(v),0)
tidOK=and(eqv(xtime(date(),H),9),lt(xtime(date(),M),1))
shrt1=and(cond1,innehav)
shrt2=and(shrt1,cond2)
shrt3=and(shrt2,cond3)
shrt4=and(shrt3,tidOK)
shrt5=and(shrt4,lt(b4,ma100))
If the S&P opens inside of the previous day’s range, and above the previous day’s close, a short will be taken (in a bear regime, aka S&P is under the 100 day SMA)
b1:=ref(L,1)
b2:=ref(H,1)
b3:=ref(C,1)
b4:=ref(O,0)
b5:=lt(b2,b1)
ma100:=mov(b4,100,s)
cond1=lt(b4,b2)
cond2=gt(b4,b1)
cond3=gt(b4,b3)
innehav=eqv(portfolio(v),0)
tidOK=and(eqv(xtime(date(),H),9),lt(xtime(date(),M),1))
shrt1=and(cond1,innehav)
shrt2=and(shrt1,cond2)
shrt3=and(shrt2,cond3)
shrt4=and(shrt3,tidOK)
shrt5=and(shrt4,lt(b4,ma100))
Comment