JNSAR stands for Just Nifty -0.14% Stop & Reverse. This is a Trend Following Daily Bar Trading System for NIFTY -0.14% . Original idea belongs to ILLANGO @ I coded the pine version of this system based on a request from @stocksonfire. Use it at your own risk after validation at your end. Neither me or my company is responsible for any losses you may incur using this system. Hope you like this system and enjoy trading it !!!

Updated V3 code for the T7 JNSAR system earlier published here V2 and here V1
Following updates made to the code

1. Added a 22 Period Simple moving average filter over and above the standard JNSAR value for generating trading signals. This simple filter reduces the whipsaw trades drastically along with similar improvements in the max draw down and overall profitability of the system. The SMA filter is turned ON by default but can be turned OFF by user through the settings window.
2. Backtest option is now turned ON by default.

Also am republishing the trading rules here again with some modification

1. Go Long when the daily close is above the JNSAR line. Go Short when the daily close is below the JNSAR line. JNSAR line is the varying green line overlayed over the price chart. Once a signal comes at market close enter in the direction of the signal @ market price @ next day market open.

2. Trade only Nifty -0.14% Index. This system was developed and backtested only for NIFTY -0.14% Index. So trade in its Futures or Options, as you may deem fit. My recommendation is to choose futures for simplicity. If you want to reduce the trading cost and go with options, trade with deep in the money options, preferably 2 strikes far from the spot price.

3. Trade all signals. Markets trend only 30-35% of the time and hence the system is only accurate to that extend. But system tends to make enough money, in this small trending window, to keep the overall profitability in good health. But one never knows when a big trend may come and when it comes its absolutely imperative that you take it. To ensure that, trade all signals and don't be choosy about what signals you are going to trade. Also I wouldn't recommend using your own analysis to trade this system. Too many drivers will crash the car.

4. Like all trend following systems, this system will have many whipsaws during flat markets along with large trade and account drawdowns. Also some months and even years may not be profitable. But to trade this system profitably, it is necessary to take these in one's stride and keep trading. As the backtester results from 1990 to 2017 proves, this system is profitable overall thus far. Take confidence from that objective fact.

5. Trade with only that amount of money you can afford to loose. Initial capital that you need to have to trade one lot of NIFTY -0.14% should be atleast - (Margin Money required to take and hold 1 lot position + maximum drawdown amount per lot)*1.2. Be prepared to add more if need be, but the above formula will give a rough idea of what you need to have to start trading and be in the game always.

6. Place an After Market Order @ Market Price with your broker after market close so that you get to execute the trade next trading day @ Market open to capture near similar price as the daily open price seen on the chart. This execution mode will give you the best chance to minimize the slippage and mimic the backtester results as closely as practically possible.

7. Follow all the 6 rules above religiously, as if your life depends on it. If you cant, then don't trade this system; You will certainly loose money.

Happy Trading !!! As always am looking out for your valuable feedback.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
Syam @ T7 Wealth Creators Pvt Ltd - Makes Life Easier.

You can support me by opening an account with Zerodha via link - or by subscribing to Trading view plans via link -


What to do when the close is between JNSAR and 22-SMA ?
Rmnkpr003 Rmnkpr003
Sir, please clarify. Thanks
@hasmu2, No not yet. But can be developed at a small price. Please PM me for more details.

Please let me know how to use to 22 periods SMA filter. My understanding is go long when the daily close is above the JNSAR and SMA line. Go short when the daily close is below the JNSAR and SMA line. Am i right? Please clarify. Thanks.
syam-mohan-vs ShekarSrinivasan
@ShekarSrinivasan, U r rite. Anyway you just need to see the arrows which will appear promptly when the conditions you stated are met. The plots are just for added effects....
ShekarSrinivasan syam-mohan-vs
@syam-mohan-vs, Sir one clarification, please... I notice the arrows appear once the price closes below or above the 22 period SMA. Then what is the relevance of JNSAR? We can just follow 22 periods SMA. Because when its long 22 SMA is always above the JNSAR line and vice versa. Need your guidance. Thanks.
syam-mohan-vs ShekarSrinivasan
@ShekarSrinivasan, Both are used together in code as the SMA filter overlayed above the JNSAR gives a better result. There is an option of turning off SMA filter and you can view the backtester results with and without the same. I have tested with just the plane SMA as well but the results were inferior to the combined JNSAR, SMA signalling. Hope this helps.
ShekarSrinivasan syam-mohan-vs
@syam-mohan-vs, Thank You.
ShekarSrinivasan syam-mohan-vs
@syam-mohan-vs, Sir, One more clarification please, how do you arrive those numbers Jnsar Long +126, Jnsar short -123 etc.?
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out