Tradescript Not Working

i am trying to back test below code and no outputs are generating , please help

To buy a stock which was bearish on yesterday and opened today for a lower price than yesterdays close and today trading above the yesterdays close.

To sell a stock which was bullish on yesterday and opened today for a higher price than yesterdays close and today trading below yesterdays close.

I have selected daily chart for last 2 months.

Buy script

REF(CLOSE,2)<REF(OPEN,2) AND
REF(OPEN,1)<REF(CLOSE,2) AND
REF(LAST,1)>REF(CLOSE,2)

Sell script

REF(CLOSE,2)>REF(OPEN,2) AND
REF(OPEN,1)>REF(CLOSE,2) AND
REF(LAST,1)<REF(CLOSE,2)

the signals will generate only when the condition met, i have tried the same code to HDFCBANK daily charts for 10 months and i am getting signals in backtest, 

Try with more historical data or check with hour or minute to check if it is working


Hi,
Thanks , it works for equities but when i am trying the same formula it doesn’t work on future stocks.
Can you please check this script on stock futures.
Even i can see future stock candles which are applicable to this formula, but not getting appeared while back testing the future stocks.
And can i use this formula in expert advisor to scan charts , if so how can i use this formula on multiple charts at same time?
Thanks,Aljo

yes you can create EA

Hi,
Thanks Sree, i want to run this across all the nifty 50 stocks to receive the alerts on alerts page, any luck for that.
Right now i have to open individual script charts and run EA across them that too maximum for 10 or 15 scripts.
And also you didn’t commented me on the future stock candles not getting applicable to the formula in my previous query.
Regards,
Aljo

you can use scanner and add the script and selected stocks list

Hi,
Tired to use the scanner but it doesn’t gives the option for daily in periodicity column.
Also can we use the buy and sell scripts on same scanner, if possible can you share how to do that?
Regards,
Aljo

Hi,
please help to sort this out, how can i use scanner on daily candles for 50 stocks.
if i cant use scanner for daily candles, whats the other options.
Rgds,
Aljo

Hello … I want a scan where the close ( at the end of the bar) is greater than the highest high of the past 5 bars .

I tried
close > ref(hhv(5),1)

  1. Is the code correct ?
  2. Also the scanning is taking place every second . I have set the periodicity to 5 min , but still it scans every second . Where am i going wrong ?

yes it is correct, scanner checks on every LTP