TradingView
AtulGoswami
16 janv. 2023 02:44

Nifty36Scanner 

Ethereum / TetherUSBinance

Description

This code is written for traders to be able to automatically scan 36 stocks of their choice for MACD , EMA200 + SuperTrend and Half Trend . Traders can be on any chart, and if they keep this scanner/indicator on , it will start displaying stocks meeting scanning criteria on the same window without having to go to Screener section and running it again and again. It will save time for traders and give them real time signals.


Indicators for scanning stocks are:
  • MACD

  • EMA200

  • Supertrend

HalfTrend - originally developed by EVERGET
Combination of EMA200 crossover/under and MACD crossover/under has worked well for me for long time, so using this combination as one of the criteria to
Scan the stocks. Using Everget's Half Trend method confirms the signal given by MACD , EMA200 and Supertrend Crossover.
I have added 36 of my favourite stocks from Nifty 50 lot. Users of this script can use the same stocks or change it by going into the settings of this scanner.


The Code is divided into 3 Sections

Section 1: Accepting input from users as boolean so that they can scan on the basis of one of the criteria or any combination of the criteria.

Section 2: "Screener function" to calculate Buy/ Sell on the basis of scanning criteria selected y the user.

screener=>
[supertrend,direction] = ta.supertrend(2.5,10)
Buy/Sell on the basis of Supertrend crossing Close of the candle

//using ta.macd function to calculate MACD and Signal
[macdline, sigline, histline] = ta.macd(close, 12, 26, 9)

using HalfTrend indicator to calculate Buy/Sell signals , removed all the plotting functions from the code of Half Trend

Bringing Stock Symbols in S series variables
s1=input.symbol('NSE:NIFTY1!', title='Symbol1', group="Nifty50List", inline='0')

Assigning Bull/Bear ( Buy/Sell) signals to each stocks selected
[c1,v1]=request.security(s1, tf, screener())

Assign BUY to all the stocks showing Buy signals using
buy_label1:= c1?buy_label1+str.tostring(s1)+'\n': buy_label1



Follow the same process for SELL Signals


Section 3: Plotting labels for the BUY/SELL result on the in terms of label for any stocks meeting the criteria with deletion of any previous signals to avoid clutter on the chart with so many signals generated in each candle

Display Buy siganaling stocks in teh form of label using Label.new function with parameters as follows:
barindex
close as series
color
textcolor
style as label_up,
yloc =price
textalign=left


Delete all the previous labels
label.delete(lab_buy[1])


STOCKS SELECTION
We have given range f 36 stocks from NIFTY 50 that can be selected at anytime,. User can chose their own 36 stocks using setting button.

INDICATORS SELECTION

1. MACD: It i sone of the most reliable trading strategy with 39.3% Success rate with 1.187 as profit factor for NIFTY Index on Daily time frame

2. EAM200 + Super trend : Combination of EMA200 crossover and Super trend removes any false positives and considered a very reliable way of scanning for Buy/Sell signals

3. HALF TREND: Originally developed as an indicator by Everget and modified as strategy by AlgoMojo, it generates Buy/Sell signals with 40.2% success rate with 1.469 as profit faction, on 15 minutes timeframe.







Notes de version

I have changed the scanners Default status from False to true so that users don't have to. Now users can disable nay o fteh options if they need. By default it is fully active.

Notes de version

Just changes the picture to show scanners working.
Commentaires
AnkhMara
This is great! This will take trading to a whole new level! I have been conducting an intense search for something like this and came across yours on TradingView! By the way, I am a Futures Day-trader. I have a few questions:
1) How low of a time frame would you recommend?
2) Can you add the ability to change the parameters on the indicators in order to better accommodate lower time frames? For example, I'm wondering if changing the EMA to 20 instead of 200 will work better for lower time frames (e.g. a 5 min. time frame).
AtulGoswami
@AnkhMara, Changing timeframe from 200 to 20 will completely change the result and we my start gettign lots of false positives as the push you need to cross ema 20 is not much. But to cross ema 200 , market needs to work hard and push it really with big force and that gives us momentum which stays for few days atleast. So yiu can use it for any time frame with same parameters. I have tested it for different time period emas and the best result comes with ema200 only.
AnkhMara
@AtulGoswami, Thanks
AnkhMara
Hello Atul,
I have a couple suggestions:
1) Can you provide a mechanism such that if a signal is generated - a person can click on a link that can take them to a TV chart of that instrument?
2) It would be great to have a facility where a person can 'look back' to the previous Bar or X number of Bars and compare the signals that were generated. For example a person may want to know if a currently generated signal also showed up X number of bars ago. One way to potentially accomplish this is to provide a table that captures and displays all signals over X number of bars.
Thanks
AtulGoswami
@AnkhMara, Hi, first one is difficult as there is no provision to create a hyperlink for the scripts coming as result of the scan in TV. But second one is possible. Let me work on it one of the weekends.
AnkhMara
@AtulGoswami, Great, I'd actually would be willing to help out with a donation for the second one. Let me know. Thanks
AtulGoswami
@AnkhMara, Thanks you very much for the kind offer. I would like to do it because it may help you and many fellow traders. but will take some time as i am working on the development of a commercial trend reversal indicator based on time cycles. that will lift up the trading success rate significantly.
AnkhMara
@AtulGoswami, OK, Got it! Let me know when your new Trend Reversal indicator is ready - since I will likely be interested. Best
AnkhMara
@AnkhMara, Hello Atul, Any updates on the feature enhancements? Or on the reversal indicator?
Plus