edrichmond |
Gold User, Member, Platinum User, TeleChart
|
Registered User |
|
|
|
|
Unsure |
|
Wednesday, July 26, 2006 |
Wednesday, May 19, 2010 12:46:35 PM |
23 [0.01% of all post / 0.00 posts per day] |
|
I have recently purchased Platinum Stockfinder. I have written about 2 dozen Realcode rules to test a dozen different Candlestick formations. I have shared a layout called "Bearish Engulfing Modified with NRC with MA". When I first started used Stockfinder Platinum these codes ran find on sub-day time frames. But this morning when I resumed my work, the layouts would not chart the layout. Can you be of some help. I especially want access to 2, 5, and 15 min time frames. The layouts seem to still work on 1 day time frames or longer but not shorter. A new layout of AA works find for all time frames. Can you be of some help as to why my rules will not work on the sub-day time frames.
Eliezer
|
Thank you mad, that is the answer!! I figured it out after I posted the question. Bruce, if you read this I would like to thank you for your past and future help.
Eliezer
|
Bruce,
In the following code in order to achieve what I want, I need the variable 'countconst' to retain its value from bar to bar. As it is, for each bar,' count' and 'countconst' assume the value of '0' and unless the middle set of if statements are true, keeps the value of zero thru the entire code. The code is
'#wickpercenttop = userinput.single = 2.0
'#wickpercentbottom = userinput.single = 10.0
'#BenchmarkSize = userinput.single = 1.5
'#Retracement = userinput.single = 0.5
Static atr As Single = 0
Dim wickbottom As Single
Dim TH As Single
Dim TL As Single
Dim wicktop As Single
Dim countconst As Single
Dim count As Single
wicktop = wickpercenttop / 100
wickbottom = wickpercentbottom / 100
atr = 0
For i As Integer = 1 To 5
th = system.Math.Max(price.high(i), price.Close(i + 1))
tl = system.Math.Min(price.low(i), price.Close(i + 1))
atr += th - tl
Next i
atr = atr / 5
If price.Close >= price.Open AndAlso _
price.TradeRange >= Benchmarksize * ATR AndAlso _
price.Open - price.Low < wickbottom * price.TradeRange AndAlso _
price.High - price.Close < wicktop * price.TradeRange Then
count = currentindex
If count = currentindex Then countconst = currentindex
End If
If count <= currentindex Then
count = currentindex - count
End If
plot = countconst
Eliezer
|
Bruce,
I still have the question about the error message in the above realcode rule. I can't use the indicator Average True range in my realcode - at least I don't know how
Eliezer
|
jas051,
I intend to use future values because the condition that upcount >= 3 leaves the code at the beginning of a three candle pattern, so I have to examine the future candles in the pattern. In backscan it works out alright if I put the condition that the code open on the 3rd candle.
Eliezer
Bruce
I found that the first two sections of the code are working alright by making an indicator with the same code with a plot = ATR after the 2nd End If. But the above code gives an error message 'End of statement expected' for the line of code ATR += TH-TL; I didn't get this message in the indicator.
Eliezer
|
Bruce,
The following program does not return a value. In particular, the variables TH, TL, ATR do not have a value different from zero. And I wouldn't be surprised if the variable 'resistance' also did not return a value different from zero. Could you help fix this code so that I can run it and get positive results in the backscanner.
Eliezer
Static upcount As Integer = 0
Static ATR As Single = 0
Dim TH As Single
Dim TL As Single
Dim resistance As Single = 0
If currentindex > 0 AndAlso Price.Close(1) >= Price.Open(1) Then
upcount += 1
Else
upcount = 0
End If
If upcount >= 3 Then
For i As Integer = 1 To 5
TH = System.Math.Max(price.high(i), price.Close(i + 1)) AndAlso _
TL = System.Math.Min(price.low(i), price.close(i + 1)) AndAlso _
ATR += (TH - TL)
Next i
ATR = ATR/5
Else
ATR = 0
End If
If upcount >= 3 AndAlso _
price.Close > price.Open AndAlso _
price.TradeRange >= ATR AndAlso _
price.Close - price.Open > price.TradeRange * 0.8 AndAlso _
system.Math.Min(price.open(-1), price.Close(-1)) > price.Close AndAlso _
price.Close(-2) < price.Open(-2) AndAlso _
price.Close(-2) <= price.Close AndAlso _
system.Math.Max(price.close(-3), price.Open(-3)) < resistance Then pass
' price.open (-2) - price.close(-2) > price.traderange(-2) * 0.8 Then pass IS NOT REQUIRED
'Sequence of statements find
' First candle is red
' The range of the first candle >= the Average True Range
' The body of the first candle is >= 0.8*(high-low)
' There is a gap between the bodies of the first candle and the second - candle(-1)
' The third candle must be red
' The body of the third candle, candle(-2), must penetrate or touch the body of the first green candle
' The maximum of the body of the fourth candle must be less than the high of the star, candle(-1)
|
Bruce,
I would like to have a graphical indicator (arrowhead down) that points down when one 5MA (which is advanced one bar) crosses up another 5MA and a second indicator (arrowhead up) when the advanced MA crosses down the other 5MA. I would like these indicators to be color orange and blue repectively.
Eliezer
|
Bruce
I shared the layout "bearish engulfing modified" and after all the confusion I have one question. In the rule #1, the "modified bearish engulfing" rule, you had set
netchange as single = price.close(1) - price.open(1)
instead of
netchange as single = price.close(0) - price.open(0)
even though you did not use netchange. If I tried to use the current candle then all the backscanning results disappeared. If I used the previous candle as you had suggested, everything works find. My question is WHY?
Eliezer
|
Bruce
There are several issues with the backscan of the setup that I am testing
1. In order for the sell short rule, Rule #1, which we have been discussing to occur on the appropriate candle, i.e. the next open after the code is executed I need to put the "Bars from Now" at 2 instead of 1.
2. Rule #3 which should buy to cover after two green bars with the second green bar being a higher high and a higher low I needed to write the following code:
Dim netchange As Single = price.Close(0) - price.Open(0)
Static upcount As Integer = 0
'currentindex > 0 AndAlso
If netchange >= 0 Then
upcount += 1
Else
upcount = 0
End If
If upcount = 2 AndAlso _
price.high > price.High(1) AndAlso _
price.Low > price.Low(1) Then
pass
End If
I needed to set the computation to the present candle instead of the previous candle in netchange. Also I took out the "currentindex > 0 " with no obvious change.
3. After running the backscan on the SP-500, I found the following problems when I looked at the "Trades" under the SP-500 on the BackScanner
A) One the time of the day for the "Enter" and "Exit" is given as 4:00PM instead of 9:30AM as it should be since the rules ask for the action to be taken at the next open.
B) The next open arrow doesn't always occur on the candle after the two green candles but rather on the second green candle. But the value in the "Trades" table under "Exits" agrees with the value of the candle after the two green candles. In the case of the "Enter" column the value in the table does not agree with the value of the candle indicated or the candle to either side.
I am open to any comments, corrections, or coding.
Eliezer
|
Bruce
Maybe I should read the reference manual a second time, because the answers were in Chapter 10. Thanks for your help
Eliezer
|
|