Registered User Joined: 8/13/2008 Posts: 44
|
Can You convert the following into Real Code. I tried but there were lots of errors:
Code 001:
Sub VolBandExtremes(Length,Mult)
Dim TXMA, ZL_TXMA As BarArray
Dim StDev, BandHigh, BandLow, BandWidth
Dim PctBand
Dim BuyThresh, SellThresh
BuyThresh = 0.2
SellThresh = 0.8
TXMA = TEMAPlus(Close, Length, 0)
ZL_TXMA = ZL_TEMA(TXMA, Length, 0)
If ZL_TXMA[Length-1] > 0 Then
StDev = StdDevPlus(Close, ZL_TXMA, Length)*Mult
BandHigh = ZL_TXMA+StDev
BandLow = ZL_TXMA-StDev
BandWidth = (BandHigh - BandLow)
If BandWidth > 0 Then
PctBand = (Close - BandLow) / BandWidth
Else
PctBand = 0.5
End If
End If
If CrossesUnder(PctBand,BuyThresh) Then
Buy ("LowBandBuy",1,0,Market,Day)
End If
If CrossesOver(PctBand,SellThresh) Then
Sell ("HighBandSell",1,0,Market,Day)
End If
End Sub
Code 002:
Sub VolBandBreakout(Length,ChanLen,Mult)
Dim TXMA As BarArray
Dim ZL_TXMA As BarArray
Dim BandH,BandL As BarArray
Dim StDev
TXMA = TEMAPlus(C, Length, 0)
ZL_TXMA = ZL_TEMA(TXMA, Length, 0)
If ZL_TXMA[Length-1] > 0 Then
StDev = MovingStDev(C, ZL_TXMA, Length, Mult)
End If
BandH = ZL_TXMA+StDev
BandL = ZL_TXMA-StDev
If (BandH - BandL) <> 0 Then
Buy("BandBreakBuy",1,Highest(BandH,ChanLen,0)+GetActiveMinMove(),Stop,Day)
Sell("BandBreakSell",1,Lowest(BandL,ChanLen,0)-GetActiveMinMove(),Stop,Day)
End If
End Sub
Thanks,
(email removed by moderator)
Roger Goshen
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No, I cannot. It would appear to be code for some sort of Bollinger Band / Standard Deviation variation based around Zero Lag Triple Exponential Moving Averages instead of Simple Moving Averages, but I can only broadly guess at what types of algorithms might be used in the various functions called throughout the code.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|