When back testing the EA code Bullish 1 white solider (Long Trades)
for nifty futures, 5 min candles for the last 60 days resulted in an error.
the Buy script from the link is pasted below for ease
TREND(CLOSE,3)= DOWN AND
and the returned Error was
"Your script generated an error: Error: Script generated no trades."
Whats wrong with this code?
It gives no trades error if the pattern does not matches as of the condition. try to backtest with nifty and check.
checking on nifty-50 spot also does not help. I chose couple of other stocks as well but no luck. Probably all of them did not have this particular pattern.
this leads to my next question.
In the first line(TREND(CLOSE,3)= DOWN), it checks, if the previous 3 bars are in down trend.
and in the last line (REF(CLOSE,1)>REF(OPEN,2)), it checks, if the previous close is higher than the open of one more bar before.
For me it looks these two conditions can not be coexisting.
But if this code is published and has been working in at least some places (which i am yet to find) then what does the TREND function actually do here?
a. does it look for lower lows and/or lower highs for DOWN trend?
b. does it look on each and every candle comparing the above condition (for ex: lower lows) to one candle before it, in the given range (in this example 3 candles)
does it look if there is a condition satisfaction (for ex: higher low) ONLY between the first and last candle in the specified range (in our example comparing n-3 candle to n-1 candle) ?
Please clarify !
if you are using trend based on close of three candles it checks all the three closes higher or low with each other up/down. as you are using AND operator if both happens then only the signal will some. It is also important to choose the right combination in technical analysis. for more information http://zerodha.com/varsity/module/technical-analysis/