I was wondering if the community would provide guidance for code conversion.
I'm new to NinjaTrader ( Previous TradeStation EL) and wanting to learn how to program for it.
Reading the book Secrets of a Pivot Boss, Frank Ochoa. (It's a good book and worth looking at) he provides code at in the Appendix but it's VBA. I've seen his pivot code out on the internet but not for his Candlestick code. I know and use NinjaTrader's candlestick indicators but I think turning his code into indicators this will help consolidate them.
I'm putting them up here in hopes that they can be converted so that I can see how it's done or the community can point me in the right direction that I can convert myself.
Conversion right now feels like a foreign language to me.
Wick Reversal System
#System
#PARAM "Wick_Multiplier", 2.5, .5, 20
#PARAM "Body_Percentage", .25, .1, 1
If C>O
AND (O - L) >= ((C - O)) * Wick_Multiplier) _
AND (H - C) <= ((H - L)) * Body_Percentage) _
or C<O
AND (C - L) >= ((O - C) * Wick_Multiplier) _
AND(H - L) <= ((H - L) * Body_Percentage) _
or C = O AND NOT C = H _
AND (H - L) >= ((H - C) * Wick_Multiplier) _
AND (H - C <= ((H - L) * Body_Percentage) _
or O = H AND C = H
AND H - L >= AVG(H-L, 50) Then
Signal = LongSignal
Else C < O_
AND (H - O) >= ((O - C) * Wick_Multiplier) _
AND (C - L) <= ((H - L) * Body_Percentage) _
OR C > O
AND (H - C) >= ((C - O) * Wick_Multiplier) _
AND (C - L) <= ((H - L) * Body_Percentage) _
OR C = O AND NOT C = L
AND (H - L) >= ((C - L) * Wick_Multiplier) _
AND (C - L) <= ((H - L) * Body_Percentage) _
OR O - L AND C = L
AND O = L AND C = L
AND H - L >= AVG(H-L, 50) Then
Signal = ShortSignal
End If
Extreme Reversal System
#PARAM “Bodysize”, .525, .05, 1
#PARAM “BarsBack”, 50, 1, 50
#PARAM “BodyMultiplier”, 2, .25, 5
Dim Averagebody As Single
Dim myBodySize As Single
Dim myCandleSize As Single
Dim AverageCandle As Single
MyBodySize = ABS (C – O)
AverageBody = Average (myBodySize, BarsBack)
myCandleSize = (H – L)
AverageCandle = Average (myCandleSize, BarsBack)
If ((O[1] – C[1]) >= (BodySize * (H[1] – L[1]))) AND _
((H[1] – L[1]) > (AverageCandle * BodyMultiplier)) AND _
((O[1] – C[1] > AverageBody) AND _
(O > C) Then
Signal = LongSignal
ElseIf ((C[1] - O[1]) >= BodySize * (H[1] – L[1])) AND _
((C[1] – O[1]) > AverageBody) AND _
(O > C) Then
Signal = ShortSignal
End if
Outside Reversal System
#System
#PARAM “BarMultiplier”, 1.25, .05, 3.5
#PARAM “BarsBack”, 50, 1, 250
Dim AverageCandle As Single
Dim MyCandleSize As Single
MyCandleSize = (H- L)
AverageCandle = Average (myCandleSize, BarsBack)
If L < L[1] AND C> H[1] AND
((H – L) >= (AverageCanlde * BarsMultiplier)) Then
Signal = LongSignal
Else H > H[1] AND C < L[1] AND _
((H – L) >= (AverageCandle * BarMultiplier)) Then
Signal = ShortSignal
End If
Doji Reversal System
#System
#PARAM “Percentage”, .10
Dim fRangeHL As Single
Dim fRangeCO As Single
fRangeHL = H[1] - L[1]
fRangeCO = ABS(C[1] - O[1])
If fRangeCO <= fRangeHL * Percentage _
AND C < L[1] _
AND L[1] > SMA(10) _
AND C < O _
Or C < L[2] AND NOT C[1] < L[2] _
AND fRangeCO[1] <= fRangeHL[1] * Percentage _
AND C < O _
AND L[2] > SMA(10) Then
Signal = ShortSignal
ElseIf fRangeCO <= fRangeHL * Percentage _
AND C > H[1] _
AND H[1] < SMA(10) _
AND C > O _
OR C > H[2} AND NOT C[1] > H[2] _
And fRangeCO[1] <= fRangeHL[1] * Percentage _
AND C > O _
AND H[2] < SMA(10) Then
Signal = LongSignal
End If
Thank you
Brett
If anybody has any questions, I have the book so that I can reference the questions.
Comment