Trading Systems
Beginners, don’t worry if you don’t understand when you read this manual. We will explain how to code your technical analysis strategy in the “Code your strategy” section.
Trading systems
A trading system is basically a set of rules that determine entry and exit points for any given stock. Traders often refer to these points as trade signals.
A trading system is objective and mechanical. The purpose is to provide a strategy to produce profits greater than losses by controlling your trades for you.
This chapter provides hands-on learning by teaching the trader how to translate Trading System rules into script form using real trading systems as examples.
Trading Systems usually include one or more technical indicators in their implementation. For example, a Moving Average Crossover system would buy when a short-term moving average crosses above a long-term moving average and sell when a short-term moving average crosses below a long-term moving average.
Trading Systems may have any number of rules, such as don’t buy unless volume is trending upwards, or exit if Parabolic SAR crosses the close, etc.
The actual profitability of a Trading System depends on how well the Trading System’s rules perform on a trade-by-trade basis. Traders spend much of their time optimizing their trading systems in order to increase profits and reduce risks.
In the case of a basic Moving Average Crossover system, this is accomplished by modifying the parameters of the moving averages themselves.
A trader may optimize a Trading System by means of backtesting. The backtesting feature of NEST Pulse allows you to backtest your trading systems and modify parameters to achieve the maximum amount of profit and minimum amount of risk.
MOVING AVERAGE CROSSOVER SYSTEM
The Moving Average Crossover System is perhaps the simplest of all trading systems. This system uses two moving averages to generate signals. A buy signal is generated when a short-term moving average crosses over a long term moving average, and sells when a short-term moving average crosses below a long-term moving average.
The number of signals generated by this trading system is proportional to the length and type of moving averages used. Short-term moving averages generate more signals and enter into trades sooner than longer-term moving averages. Unfortunately, a very short-term moving average crossover system will also generate more false signals than a longer-term system, while a very long-term system will generate fewer false signals, but will also miss a larger proportion of profits. This difficult balance applies to nearly every trading system and is the core subject of numerous books on technical analysis.
One solution to this problem is to use a secondary technical indicator to confirm entry and/or exit signals. A popular technical indicator used primarily for exit signals is the Parabolic SAR. The following script uses a 20/60 EMA for entries and a Parabolic SAR for exits.
Moving Average Crossover System Script
Buy Signals
# 20-period EMA crosses over the 60-period EMA
CROSSOVER(EMA(CLOSE, 20), EMA(CLOSE, 60))
Sell Signals
# 20-period EMA crosses under the 60-period EMA
CROSSOVER(EMA(CLOSE, 60), EMA(CLOSE, 20))
Exit Long
# The close crosses above the Parabolic SAR
CROSSOVER(CLOSE, PSAR(CLOSE, 0.02, 0.2))
Exit Short
# The close crosses below the Parabolic SAR
CROSSOVER(PSAR(CLOSE, 0.02, 0.2), CLOSE)
Sample Script 1 (For Bullish Markets)
Buy Signals
# 10-period EMA crosses over the 30-period EMA and a positive MACD
(EMA(CLOSE,10) > EMA(CLOSE,30)) AND (MACD(6,12,9,EXPONENTIAL) > 0)
Exit Long
# 30-period EMA crosses over the 10-period EMA and a negative MACD
(EMA(CLOSE,10) < EMA(CLOSE,30)) AND (MACD(6,12,9,EXPONENTIAL) < 0)
Sample Script 2 (For Bullish Markets)
Buy Signals
# A combination of Simple moving average,MACD and stochastic.
(SMA(CLOSE,2) > SMA(CLOSE,10)) AND MACD(6,12,9,SIMPLE) > 0 AND (SOPK(9, 3, 9, SIMPLE) > 80 OR SOPD(9, 3, 9, SIMPLE) > 80)
Exit Long
# A combination of Simple moving average,MACD and stochastic
(SMA(CLOSE,2) < SMA(CLOSE,10)) AND MACD(6,12,9,SIMPLE) < 0 AND (SOPK(9, 3, 9, SIMPLE) < 20 OR SOPD(9, 3, 9, SIMPLE) < 20)
Price Gap System
An upward price gap occurs when a stock opens substantially higher than the previous day’s high price. This often occurs after an unexpected announcement, much better than expected earnings report, and so forth.
A large number of buy orders are executed when the market opens. During this time the price may be exaggerated as investors may be buying the stock simply because it shows strength at the opening.
The price often retreats to fill the gap once orders stop coming in and the demand for the stock subsides. The key to this trading system is that reversals usually occur during the first hour of trading. In other words, if the gap is not filled during the first hour then we may assume that buying will continue.
This trading system is often more successful if volume is around twice the fiveday average of volume.
Example: The script returns securities that have gapped up by 2% and closed near the high. When the market opens on the following day, the strategy would be to buy stock after the first hour of trading if the strength sustained.
A stop-loss order would be set at the day’s low. A conservative profit objective would normally be half the percentage of the gap, or 1% in this case.
Price Gap Script
Buy Signals
# A 2% gap up in price over the previous day on high volume
LOW >REF(HIGH,1) * 1.02 AND VOLUME > SMA(VOLUME, 5) * 2
Sell Signals
# A 2% gap down in price over the previous day on high volume
HIGH <REF(LOW,1) * 0.98 AND VOLUME > SMA(VOLUME, 5) * 2
Exit Long
Use a profit objective roughly ½ the size of the gap with a stop-loss.
Exit Short
Use a profit objective roughly ½ the size of the gap with a stop-loss.
Bollinger Bands System
Bollinger bands are similar to moving averages except they are shifted above and below the price by a certain number of standard deviations to form an envelope around the price.
Unlike a Moving Average or a Moving Average Envelope, Bollinger bands are calculated in such a way that allows them to widen and contract based on market volatility. Prices usually stay contained within the bands. One strategy is to buy or sell after the price touches and then retreats from one of the bands. A move that originates at one band usually tends to move all the way to the other band. Another strategy is to buy or sell if the price goes outside the bands. If this occurs, the market is likely to continue in that direction for some length of time. The Bollinger band trading system outlined in this example uses a combination of both trading strategies. The system buys if a recent bar touched the bottom band and the current bar is within the bands, and also buys if the current high has exceeded the top band by a certain percentage. The system sells based on the opposite form of this strategy.
Bollinger Bands Script
Buy Signals
# Buy if a previous value was below the low band and is now above
SET Bottom = BBB(CLOSE, 20, 2, EXPONENTIAL)
SET Top = BBT(CLOSE, 20, 2, EXPONENTIAL)
((REF(CLOSE, 1) < REF(Bottom, 1)) AND CLOSE > Bottom) OR
# Also buy if the close is above the top band plus 2%
CLOSE > Top * 1.02
Sell Signals
# Sell if a previous value was above the high band and is now below
SET Bottom = BBB(CLOSE, 20, 2, EXPONENTIAL)
SET Top = BBT(CLOSE, 20, 2, EXPONENTIAL)
((REF(CLOSE, 1) > REF(Top, 1)) AND CLOSE < Top) OR
# Also sell if the close is below the bottom band minus 2%
CLOSE < Bottom * 0.98
Historical Volatility and Trend
This trading system buys or sells on increasing volume and lessening volatility.
The concept is that trends are more stable if volatility has been decreasing and volume has been increasing over many days.
Volume is an important component to this trading system since almost every important turning point in a stock is accompanied by an increase in volume.
The key element in this trading system is the length of the primary price trend.
The longer the price trend is, the more reliable the signal.
Also try experimenting with this trading system by substituting the TREND function for volume with the Volume Oscillator function, or the Volume Rate of Change function.
Historical Volatility and Trend Script
Buy Signals
# Buy if volatility is decreasing and volume is increasing with price in an uptrend
HistoricalVolatility(CLOSE, 15, 252, 2) < REF(HistoricalVolatility(CLOSE, 15, 365, 2), 15) AND TREND(VOLUME, 5) = UP AND TREND(CLOSE, 40) = UP
# Sell if volatility is decreasing and volume is increasing with price in a downtrend
HistoricalVolatility(CLOSE, 15, 252, 2) < REF(HistoricalVolatility(CLOSE, 15, 365, 2), 15) ANDTREND(VOLUME, 5) = UP AND TREND(CLOSE, 40) = DOWN
Parabolic SAR / MA System
This system is a variation of a standard moving average crossover system. Normally a Parabolic SAR is used only as a signal for exit points, however in this trading system we use the crossover of two exponential moving averages to decide if we should buy or sell whenever the Parabolic SAR indicator crosses over the close.
The Parabolic SAR can be used in the normal way after the trade has been opened. Profits should be taken when the close crosses the Parabolic SAR.
This example shows how to use Boolean logic to find securities that match the condition either for the current trading session or the previous trading day.
Parabolic SAR / MA Script
Buy Signals
# Buy if the Mas crossed today or yesterday and
# if the PSAR crossed today or yesterday
FIND STOCKS WHERE (CROSSOVER(CLOSE, PSAR(0.02, 0.2)) OR CROSSOVER(REF(CLOSE,1), PSAR(0.02, 0.2))) AND (CROSSOVER(EMA(CLOSE, 10), EMA(CLOSE, 20)) OR CROSSOVER(REF(EMA(CLOSE, 10),1), REF(EMA(CLOSE, 20),1)))
Sell Signals
# Sell if the Mas crossed today or yesterday and
# if the PSAR crossed today or yesterday
FIND STOCKS WHERE (CROSSOVER(PSAR(0.02, 0.2), CLOSE) OR CROSSOVER(PSAR(0.02, 0.2), REF(CLOSE,1))) AND (CROSSOVER(EMA(CLOSE, 20), EMA(CLOSE, 10)) OR CROSSOVER(REF(EMA(CLOSE, 20),1), REF(EMA(CLOSE, 10),1)))
MACD Momentum System
In this trading system we use an exponential moving average and the TREND function to identify market inertia, and we use the Moving Average Convergence / Divergence (MACD) indicator to detect market momentum.
As you may know, the MACD indicator reflects the change of power between traders who are on the long side and traders who are on the short side. When the trend of the MACD indicator goes up, it indicates that the market is predominated by bulls, and when it falls, it indicates that bears have more influence. This is known as market momentum. This system buys when both inertia (a TREND of the EMA) and momentum (the MACD) are both in favor of rising prices. The system sells when the reverse is true. Exit signals are generated whenever either signal turns to the opposite direction.
MACD Momentum Script
Buy Signals
# Buy if both momentum and inertia are favourable
TREND(EMA(CLOSE, 20), 15) = UP AND TREND(MACD(13, 26, 9, SIMPLE), 5) = UP
Sell Signals
# Sell if both momentum and inertia are favorable
TREND(EMA(CLOSE, 20), 15) = DOWN AND TREND(MACD(13, 26, 9, SIMPLE), 5) = DOWN
Exit Long Signal
# Exit if either momentum or inertia become unfavorable
TREND(EMA(CLOSE, 20), 15) = DOWN OR TREND(MACD(13, 26, 9, SIMPLE), 5) = DOWN
Exit Short Signal # Exit if either momentum or inertia become unfavorable.
TREND(EMA(CLOSE, 20), 15) = UP OR TREND(MACD(13, 26, 9, SIMPLE), 5) = UP
Narrow Trading Range Breakout
Stocks that remain bound by narrow trading ranges often tend to continue in the direction of their breakout. That is to say, if a stock remains in a narrow range between $40 and $45 for an extended period then breaks above $50, it is likely to continue rising for the foreseeable future. The premise being that the longer a stock remains in a tight range, the more difficult it is becomes to breakout of the trading range. Therefore when the breakout occurs, the uptrend should continue.
Narrow Trading Range Script
# Define a 2% trading range over 50 days
FIND STOCKS WHERE
MAX(CLOSE, 50) < CLOSE * 1.01 AND
MIN(CLOSE, 50) > CLOSE * 0.98 AND
# Filter out inactive securities
CLOSE != REF(CLOSE, 1) AND
REF(CLOSE,1) != REF(CLOSE, 2) AND
REF(CLOSE,2) != REF(CLOSE, 3)
Outside Day System
An Outside Day occurs when the current bar’s high price is higher than the previous bar’s high price, and the current bar’s low price is lower than the previous bar’s low price. The close must be opposite of the trend (if the trend is up, the close must be lower than the open). Outside days occur frequently and may be used as part of a short term trading strategy.
Outside days that occur after a strong uptrend indicate market indecision, and may signal a reversal or temporary correction in price.
Depending on market direction, outside days can be either bullish or extremely bearish. If the reversal occurs at the stock’s resistance level, it is interpreted as bearish. If it occurs at the stock’s support level, it is interpreted as bullish.
Outside Day Script
Buy Signals
# Find outside days
LOW <REF(LOW, 1) AND
HIGH >REF(HIGH, 1) AND
HIGH >REF(HIGH, 1) AND
CLOSE < OPEN AND
# Outside days are more significant if the
# previous bar is shorter in height
HIGH - LOW > (REF(HIGH, 1) - REF(LOW, 1)) * 1.5 AND
# The trend should be up
TREND(CLOSE, 30) = UP
Sell Signals
# Find outside days
LOW <REF(LOW, 1) AND
HIGH >REF(HIGH, 1) AND
HIGH >REF(HIGH, 1) AND
CLOSE < OPEN AND
HIGH - LOW > (REF(HIGH, 1) - REF(LOW, 1)) * 1.5 AND
# The trend should be down for a sell signal
TREND(CLOSE, 30) = DOWN
Happy Trading.
This blog is an extended series of the User Manual for algoZ. You can find the Glossary of Indicators available on algoZ here.
Can you share code for darvas box
Hello
Long Trade
Identify 1 Bar 5 min chart- Check High and Low of 1 5 min bar. 9.15-9.20.
If 5 min chart closing is above 1st 5 min bar high (9.15-9.2), then trade long.
Stop loss- Close on 5 min chart. Below 1st 5 Min Bar low (9.15-9.20)
Target- 40 points + trail with Lowest Low in 2 bar.
Short Trade
Identify 1 Bar 5 min chart- Check High and Low of 1 5 min bar. 9.15-9.20.
If 5 min chart closing is below 1st 5 min bar low (9.15-9.2), then trade short.
Stop loss- Close on 5 min chart. above 1st 5 Min Bar high (9.15-9.20)
Target- 40 points + trail with Highest High in 2 bar.
In zerodha streak ,In advanced MIS orders can i take the intraday leverage
The below macd is giving me error . any problem?
SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)
CROSSOVER(A, B) = TRUE
how can i install pi
You can download Pi here and install it.
I want to do SIP i.e daily buy some quantity of Stock. How can I schedule such order?
Hey Abhinay, for now, you’ll have to place buy orders for the stock each day, I’m afraid. We are working on making equity SIP available on Kite, it’ll just take us a little time.
Hi:
Please help me on below..
1. when i run scanner in PI not getting alerts(yellow color)
2. I need a script for cross over strategy for 5 EMA and 20 TEMA
Thanks in advance!
Hi:
Zerodha…
I want code for PI..scanner …crossover 5 ema and 20 tema
hi, i want a buy signal when renko chart construct a green candle and also its above 13 days exponetial moving average and sell when 2 red candles construct.
plz help
Hi Nitin
I am using zerodha chart on Kite, facing problem, when market opens, 5 min chart is not showing exact market prices on candle i.e open high and close is away from real market prices (I am trading in Nifty and Bank nifty futures) pl solve asap.
Also on PI Software i want to add my formula and the result can be shown in customized column is it possible?
Regards
Rakesh
Hi,
I want code for identifying breakout (both upside and downside) of narrow trading range for 30 days and 50 days.
Thanks in advance!
Best post your query here Amey. A fellow forum member may be able to help.
Is there any way I can draw a 45degree angle from any price point in KITE chart?
Sir, in your pie desktop version there no Pivot indicators plz add it and one more thing Plz plz plz improve your telephonic support when ever any queries arise we are not able to connect no one pick up calls continue only tape recorder runs but none of your executives come to line while trading we new traders are completely helpless. Another thing if am login to kite version from laptop than if I have to login from mobile there should b facilities without log out. At a time we can manage both login.
hi team
i want to know code for opening range breakout on support & resistance.
Can someone please help me on how to create a pivot point scanner?
Sir, i want to know code for range bound stocks for 4 candles of 5mins, pls let me know the code for same, Thanx in adv.
Hello,new to Zerodha and would like to know how to apply any trading system in Kite which will give signals to buy or sell?
hello sir I want code for first 5 min breakout to genrate buy and sell signal
Hi Nitin Kamatha,
Do you provide Weekly pivots and Gaan level calculations in script?
i would need
1. Weekly Pivots
2. Gaan Levels calcualtion based on open
3. TotalBuyers VS total serllers realtime
4. Lt price.
if these are already there in Tradescript then let me know how to use it.
Thanks
Vishwanath
Ah none of these are possible on tradescript. Best you try Amibroker and etc.
Hello Everyone,
Hope everyone is doing good.
I am looking for PPMA, 3 Period Pivot Point Moving Average System.
Thanks in Advance
Siddharth
hi,
please help me with the script identify pin bar candles, and also help me how to scan various stocks for pin bar
Hi,
I am trying to develop a strategy which does following
Plot 1 –
100 -(number of days since highest high in last 100 days)
Plot 2
100-(number of days since lowest low in last 100 days)
I cant find a function or code which i can use to get ‘number of days since highest high in last 100 days)
Say the lowest point among last 100 days have occured 5 days back, then plot 2 should be calculated as (100-‘3’)
You’ll get better response to your coding related query, if you post it here: http://tradingqna.com/ask under the category: Algos, strategies, and code.
Hi All,
Has anyone used Supernsetips service? What about trend blaster indicator from stock maniacs website?
Thank you very much sir, really a great tutorial to get started. I am an absolute beginner to Algorithmic trading so could you please suggest from where I can continue learning more about Algorithmic trading and strategy
Isaac, I guess you have to first start learning programming. Python is a good bet.
Being a computer engineering student it wont take long learning Python 🙂 From where I am supposed to learn after doing Python? Are there any good books or online resources which you would suggest ?
Before you can apply programming to trading, you need to first learn trading. Suggest you to get started here: http://zerodha.com/varsity/
Thanks a lot sir 🙂
Nithin
There is a moving average indicator which has a dual color, it’s not available with all the trading platforms but few major brokers provide it. So the indicator changes color with direction bias. I’m not sure of the formula behind it but it’s a very useful tool in a trader’s arsenal and helps us reduce noise to an extent. It will be a very useful addition in case you do not already have it in Zerodha’s trading platforms. You might want to check Sharekhan’s trade tiger for reference, their moving average is dual color.
Cheers
Manoj
Hi Nitin
Could you kindly review my request. I had requested earlier to add the feature of a dual colored Moving average, Looking forward to seeing that indicator in Kite. It is quite helpful.
Regards
Manoj
Manoj,new indicators will take time.
Thanks a bunch for responding Nitin !
I believe it’s more of modifying the existing moving average indicator . Only the formula would need to be tweaked and the formula is what I’m not sure of either. Actually I have migrated from Sharekhan’s trade tiger to Zerodha platform so I got used to it for a while now. I’m sure others will find this useful too , not just fellow traders in Zerodha who migrated from Sharekhan’s trade tiger but also folks new to this. It helps eliminate a lot of noise that otherwise is visible in the conventional moving average monotone indicator. I understand it is an effort for the development team, but it’s certainly going to be worth while just like the myriad other worthwhile features that you’ve infused into this brilliant platform.
Hoping to see it in one of the forthcoming releases of Kite or Pi.
B.t.w I’m not sure if you already got a consensus from Zerodha users about Pi’s performance , Pi is slower in its response compared to Kite. Is this something we should expect , or is it just with me. I find it is particularly slow when I try to pan across the charts, there’s a bit of lag there.
Thanks for looking into this!
Regards
Manoj
hi,
very happy to say that your provided excellent service in updating software these are very useful in trading through pi software. i have observed that these things can be updated which can be more useful in trading
1) chart grid colors manually selected should be saved
2) pivot lines colors should be different
pivot – green
resistene – dark green
support – red
& line values to be displayed right side corner
3) like kite software, indicator lines must be allowed to change their colors manually (i.e., upper/middle/lower lines) & over sold (red),over bought (green) should be hi-lighted.
4) indicators over sold over bought lines to be adjusted plus or minus ( eg. 70 ,30 or 80 20)
4) darvas boxes to be displayed like kite software
HI
HOW CAN I RUN SCANNER IN PI ON EOD CHARTS..BECAUSE IT GIVES OPTION ONLY FOR MINUTE AND HOUR INTERVAL
ARUN
As of now scanner works only on intraday interval, not EOD.
Dear Nithin,
Just a quick query. I code a strategy. Can it be automated such that it will generate auto buy/sell signal without me to sit and watch the trades. Like i start a service in the cloud which will operate my strategy daily and i will see the results at the end of day.
Please guide.
Thanks,
Tushar
Possible Tushar, requires you to have technical knowledge and also exchange approvals. Check this: https://kite.trade/
Hi,
whats the underlying math used to determine the trend (vector) function
thanks
Can i back test a strategy on a watchlist of stocks or I need to do it individually?
If yes, how many stocks i can keep in watchlist?
You can only backtest one stock at a time.
Thank u.
1)If not back testing, can i run a scanner on todays intraday data(Post market hours) on list of stocks with custom code written using alogz.
2) If yes, how many stocks i can add to watchlist that i can run a scanner on?
algoZ has been discontinued, but you can easily do it on PI our latest desktop app. Check this post. . Yes you can run scanner on todays intraday data, how many stocks you can add will depend on your computational power.
While doing back testing for glenmark eq for last 6 days on 30mins time frame chart for SMA 5 & 13 cross over it is not giving any singnals In pi but on the google chart of 30 mins i can see the cross over are happening .
I AM USING PI, I THOUGHT THAT IN THE SCANNER WE HAVE TO ENTER INDIVIDUAL SCRIPTS NAMES FOR SCANNING, IS IT POSSIBLE TO SELECT THE GROUP OF STOCKS LIKE NIFTY 50, NIFTY PSU BANK OR NIFTY MID CAP AT A TIME?
Not currently.
Count 5 days Up volume and down volume on 5 minute chart
Weighted average of the prices with up volume – WTUP
Weighted average of the price with down volume – WTDWN
If Up Volume > Down Volume Then
If CMP = WTDWN
Sell Signal – CMP
Else
Wait Signal
End If
End If
up volume = Gree Candle
Down Volume = Red Candle
Doji = Up Candle
Need code for this on email. Thanks.
plz… reply
Can you ask all coding queries on tradingqna.com
bollinger band ka code hai
buy script-
SET Bottom = BBB(CLOSE, 20, 2, EXPONENTIAL)
SET Top = BBT(CLOSE, 20, 2, EXPONENTIAL)
((REF(CLOSE, 1) Bottom
sell scrip
SET Bottom = BBB(CLOSE, 20, 2, EXPONENTIAL)
SET Top = BBT(CLOSE, 20, 2, EXPONENTIAL)
((REF(CLOSE, 1) > REF(Top, 1)) AND
CLOSE < Top
zerodha
muze ye puchhna hai ke backtest ka result and live indicator{EA} ka result diffrent kyo aa rha hai.
for example- maine aaj hindalco me EA alpy kiya tha usme muze 2 signal mila but maine jab use same time frame k sath market close hone par backtest kiya to usme signal genrate hi nhi hua
plz tell me i am worrie
Can you post the code in tradingqna.com? We’ll check the code and revert back. http://tradingqna.com
I would like to use TBQ (total bid quantity ) and TSQ (total ask quantity) as part of my trading strategy. Is the possible to incorporate that through a script?
For example:
Buy when
– EMA 3 moves over EMA 5
-TBQ >TSQ.
Thanks.
Guys,
I am using Kite and when we search a stock for the watchlist, we get two listing for example “FMNL” and “FMNL-BE” whats the difference ? Till today I was booking my trades under without “-BE” entries.
Today for “Alpa Labs”, “ALPA” doesnt have any market depth whereas “ALPA-BE” has the movement.
So wondering what is this “BE” mean.
Thanks
This explains what BE means: http://tradingqna.com/19984/hold-shares-overnight-which-traded-well-have-them-series-only
I sold 15 shares of Tree House in MIS mode. How to convert it to CNC mode?
Use the position conversion option from the Admin position window.
How do I sell Tree House Education shares that I bought yesterday?
Hi,
Is this possible to square off my all trade when MTM reach at certain amount at market price. If yes How ?
Not possible currently.
WHY IS THAT I REQUIRE A HIGHER MARGIN TO SET BOTH A TARGET AND SL WHILE BUYING CALL OPTION OR PUT OPTION IN STOCK OR INDEX .EG IF I BUY XYZ PE 330 AT 15 2 LOTS ASSUMING LOT SIZE IS 25 MY INVESTMENT WOULD BE 15*25*2=750 BUT I CAN ONLY SET A TARGET OR SL NOT BOTH WITH THIS KIND OF INVESTMENT WHY
Margin required for option writing and buying differs. When you place an exit and a stol loss order, the system will consider the second order as a fresh one. Hence additional margin required.
Hello Zeordha,
I want to know how to apply moving average strategy on a weekly chart. Please give an example.
And can I find stocks (or commodity) satisfying that condition from all the stocks listed on NSE or BSE.
Thank you.
The logic is exactly the same like how when u apply moving average on a daily chart. Questions on trading, check this: http://tradingqna.com/
Have u seen this on TA on varsity? : http://zerodha.com/varsity/module/technical-analysis/
Why there is no option of choosing Moving Ave. of OHLC ( Open, High, Low, Close ) instead of only Close we get on Pi.
Can there be Update of this on Pi for better / full utilization of Moving Ave. indicators ?
Abhishek, it is available. When you add an indicator by default close is chosen, but if you click on that dropdown, you can see other indicators as well. Check this: http://zerodha.com/z-connect/tradezerodha/pi-tradezerodha/charting-pi
But the width of the dropdown box is so small, one has to the scroll to the right to read the contents every time. You could increase the width for better readability
Yep soon.
i want to start the coding process for technical analysis. how to get started?
My guess is that you are using Zerodha Pi. There is a tradescript help manual in the help menu on Pi. You can also check this section on sample codes: https://zerodha.com/expert-advisors/ and http://tradingqna.com/algos-strategies-and-code
thanx Nithin
I was trying to back test few strategies that are in your web like Bearish meeting line ,Bearish advance block,Bearish kicking and many more but every tme i am getting ths message
“your script generated an error:
Error:scripts generated no trades.
no results:make sure that at least buy and sell scripts are typed in.”
few are working on back test like PSAR, Bollinger band etc. what can be the reason?
Ajay, can you update the latest release of Pi. Go to help menu when you are logged in and click on check for updates and then say okay. I think an in between release had an issue.
I’m using latest PI but have same issues in backtesting
i want a scrip to check the stock purchase on on at market open price and sell at 1% profit. how to do it and check it
Sumanth, currently tradescript can manage only TA strategies as such. Since the buying price is not captured by the programming language, you can’t really use it for coding. But we are start pi bridge + soon, using which u can script such scanners/strategies.
HI Nitin,
Is there a plan to enable 4hr and EOD charts in Pi software?
Nutan, both are already available. When adding a chart, in periodicity choose hour and bar interval as 4 for 4 hr charts. In periodicity choose day and bar interval as 1 for EOD chart.
what may the code for
if i take entry in a candle closing price,, and want to get exit untill the next closing is below previous candle’s close. it means, after taking entry price may be going up for next 3/4 candles, and once a candle is closing below previous candle, i would exit from the trade.
i want coding only for exit
please reply
Raj, check this: http://tradingqna.com/algos-strategies-and-code, we are taking all queries on tradescript here. You can post any questions, if not already answered here.
Hello NIthin,
Would like to bring to your attention that the datatable in the Zerodha trader is not getting updated after 3 p.m. This problem has started from the 30th March 2015 and is still going. A screen shot of the problem is attached along with this note. The same has been send to india@zerodha and even called your customer support. They told me that it will take some time to solve this bug. This is a major bug as a result my charts are not getting updated full in Amibroker and have not traded for the last two days due to this bug. Even i can’t use Pi since its doesn’t have a cross hair and when i insert the MACD indicator in Pi its full of errors when i compare with Amibroker. Kindly solve the problem with regard to the Datatable in Zerodha Trader at the earliest.
Regards,
Joseph.
94972-82865
Yep, we have reported this to Omnesys.
PLS WRITE CODES FOR FOLLOWING CONDITIONS FOR BUY & SELL
BUY WHEN :–
_____________
EMA 3 CROSSES EMA 5 UPWARD
IF ABOVE EVENT OCCURRED SYSTEM NEED TO CHECK FOR FOLLOWING PARAMETERS SATISFY
EMA 13 SHOULD BE ABOVE EMA 21
AND
+DI 14 SHOULD BE ABOVE -DI 14
AND
RSI 21 SHOULD BE ABOVE 50.01
SELL WHEN :–
______________
EMA 3 CROSSES EMA 5 DOWNWARD
IF ABOVE EVENT OCCURRED SYSTEM NEED TO CHECK FOR FOLLOWING PARAMETERS SATISFY
EMA 13 SHOULD BE BELOW EMA 21
AND
+DI 14 SHOULD BE BELOW -DI 14
AND
RSI 21 SHOULD BE BELOW 49.99
Alpa, can you browse and post your queries on coding here: http://tradingqna.com/algos-strategies-and-code (tag your question as tradescript). You can also browse through this: http://zerodha.com/z-connect/charting-coding-and-backtesting/code-your-strategy-tutorial/code-your-technical-analysis-strategy, there are already similar codes on it.
dear sir,
i am trading on your Pi trading platform, which is helpfull.
i would like to create an EA based on PIVOT.
can you give me a script code for PIVOT MA crossover.
rajkumar
code: RR3044.
Raj, can you mention the exact condition that needs to be coded. What moving average, and how are you building the pivot? Do ask this on tradingna under category algos.
hello sir ,
when we use psar in other trading terminal the parameter have .02 &.2 . how to find that signal in nest where we cant put the parameter.
i want to trade using Ami broker. Do i need to purchase the software and datafeed from some vendor.
please guide me on the same.
thanks
Mr.Nithin,
Thankyou. The problem of having two similar software (Omnesys for Zerodha and Reliance Securities)for two brokerages is sorted out.Your sevice team is prompt and good.I have recommended Zerodha to others also.Looking for Pi and Amybroker.
iam new to zerodha can this all available for retail customers also ? if Yes please give us the procedure to activate these modules
Yes, we are launching a much more advanced version of this in our new trading platform Pi, Should be out first week of Jan 2015
Login ID : DD0314
Dear Zerodha,
I have downloaded and replaced NestPulse with Nest Charts 2.9. I use PSAR and I it cannot be set as It shows 4 Input Boxes and gives error when typing fractional value.
Pl. Help and Fix issue, see attached image.
Thanks.
Hi,
I recently have got opened my trading account.
I have few queries regarding AlgoZ to back-test the following strategy on buy side with 5 min. chart.
Buy when 10 EMA closes above 200 EMA and exit when 10 EMA closes below 50 EMA.
First of all please suggest me which closing price is being taken into consideration.
1) Stock’s closing price OR
2) Stock’s EMA closing price
In addition I have notice that in uptrend sometimes 10 EMA closes below 50 EMA but does not close below 200 EMA and then again 10 EMA closes above 50 EMA and makes more upside move.
In short word I want to stay on buy side as long as 10 EMA remains above 200 EMA but also want to exit when 10 EMA closes below 50 EMA. Kindly suggest me how to make a strategy to re-initiate buy call as long as 10 EMA closes Above 200 EMA.
Vice versa I want to initiate sell call as long as 10 EMA closes below 200 EMA.
These strategies would be for Intraday OR delivery?
I want to track and trade in some selected stocks. Is it possible OR stock suggestion would be software base?
Am I able to book partial or full profit manually? Like can I exit manually getting 15 to 20 percent or less profit on call?
Many strategies are coded here, do check
2. Stocks EMA closing for the 5 mins.
Do check the post above and also these 3 which has example. Once you have written a strategy, you will have to decide on which stocks you would run them.
Thank you very much for your quick reply. But the link you sent ” Many strategies are coded here, do check ” does not work. Please provide solution.
It is working, check this: http://zerodha.com/z-connect/charting-coding-and-backtesting/code-your-strategy-tutorial/code-your-technical-analysis-strategy. All you have to do is browse through the charting, coding and backtesting category on your right.
When are you getting the new trading software zerodha pi
Hi Nithin,
I am waiting for my Demat account for more than a week now. I have submitted all my documents properly but still it is under processing . Please help me in getting this processed . My trading account ID is DR1974
hi nithin, thanks for reply
but i was not able to find any such strategy.. is it possible to write any such strategy?
hi,
i am new to zerodha, need help in coding.
buy: when rsi of period 7 crosses upward simple moving average period 10
sell: when SMA of period 10 crosses downward RSI of period 7
Check this post Saurav, most strategies are mentioned here.
hi,
i have a trading account with zerodha. i can write trading strategy and back-test it for a single stock at a time. But, for this, i have to right click on chart and then need to go through “my strategy” option. my questions are –
1) can i write scripts like “find stocks where…”? if so, how to prepare it and how to back-test it?
2) as i have only trading account, i can’t find spot prices of nifty as well as other stocks. is this due to “trading” account? if not, how to check spot prices of nifty as well as other stocks?
– anticipating your reply asap… thanks…
1. What you are asking for is called a scanner, not possible presently but we are working on having it in our new platform.
2. What you can do is map any of your demat account to the trading account, this way you will be able to see the spot prices of equity. Spot price for Nifty Index will not be possible, you will have to run the strategy on Nifty futures.
Nikhil
My strategy is based on price action. I want to enter the trade with the open price of the candle. And exit when the price is 5% greater than the open price or the stop loss price is 10% lower than the entered price, whichever happens earlier. How can I code this strategy?
Dilip
Open < (close *0.05) this is the code for buy exit. · Entry condition not mentioned. · SL is mentioned when going live. it works on the triggered buy/ sell price.
Hi, Please tell me whats is the code for yesterdays high, the Ref(high,1) checks the last high. I want yesterdays high
Dhigh(1) & Dlow(1) – today’s, Dhigh(2) & Dlow(2) – yesterday’s and so on ……
Hello,
ZERODHA,
I have just started backtesting my strategies and I want to know what script should I write if I want to make position as follows:
BUY when two EMAs (7 period EMA & 14 period EMA) goes ABOVE three other EMAs(50 EMA, 100 EMA and 200 EMA); AND Price close is above PSAR (.002,.02)
Exit Long when Either close price crosses (goes below) PSAR(.002,.02) ; OR two EMAs (7 period EMA & 14 period EMA) goes BELOW three other EMAs(50 EMA, 100 EMA and 200 EMA)
SELL when two EMAs (7 period EMA & 14 period EMA) goes BELOW three other EMAs(50 EMA, 100 EMA and 200 EMA); AND Price close is BELOW PSAR (.002,.02)
Exit Short when Either close price crosses (goes above) PSAR(.002,.02) ; OR two EMAs (7 period EMA & 14 period EMA) goes Above three other EMAs(50 EMA, 100 EMA and 200 EMA)
Thanks,
K R ANAND
Hello everybody.
I’m looking for a script for Bollinger Band that BUY if the price is BELOW the bottom 0,1%
or SELL if the price is ABOVE the TOP 0,1%.
How can I do this.. IS IT CORRECT??
BUY:
SET BOTTOM = BBB(CLOSE, 12, 2, SIMPLE)
CLOSE TOP * 1.001)
PLEASE ANY HELP IS WELCOME !
Thanks
SET BOTTOM = BBB(CLOSE, 12, 2, SIMPLE)
CLOSE < BOTTOM * 0.999).
Buy:
((BBB(CLOSE, 20, 2, EXPONENTIAL))*1.0010) > Close
Sell:
((BBT(CLOSE, 20, 2, EXPONENTIAL))*1.0010) < Close
Hanan,
After setting a template as default, every new chart opened using that temple as you suggested.
However
I uninstalled the 3.10 version and installed the latest 3.11 version. pls look at the following scenario
I have a temple with Borllinger bands, MACD & RSI – This is default one
I have another temple with two SMA bands & MACD.
When open a chart – it opens with the default one. However when I upload the second temple, it does but the borllinger band etc stays on the screen. (the screen is not refreshed with the new template).
This prob was not present in the 3.10 version.
why is it so?
(I hadn’t uninstalled Nest Plus. only installed the 3.11 Nest )
Could it be the reason or is it a bug?
A.G.Suresh Babu
Hanan,
1) Every time I load that chart of scrip, it goes back to the default chart style and I had to upload my template. Is it possible to make a particular template as default and any chart should open with that template. Similarly the “Normal View” (Ctrl + N) could be made default one.
2) There is feature to “add Custom Columns” on the marketwatch.
When we add a new column with say a formula to display “LTP” – “Open” it displays with only an integer number instead of double / float. For ex: 320.55 – 312 display as 9 instead of 8.45.
3) what are the advantages of subscribing to the following over the charting that is available now?
https://plus.omnesysindia.com/NestPlus/Plus/PlusPage.jsp?prd=web_charts
The charting utility shown in the above link is exactly similar to what bazartrend.com provides free.
The charts are good, but now as flexible as available on NestPlus. Then why charge it separately? Or is it for some other clients ?
thks
Suresh, my answers are given below:
1. You can save a default chart template and when you reopen it will open with the settings you’d left it with. However, there’s a small little bug in Nest Plus which sometimes makes that setting disappear suddenly. If that ever happens, you’ll have to redo it.
2. The feature to add Custom Columns seems to be working as far as I know because we create a couple of custom columns in the View Limits window. However, I’ll run this by with my developers.
3. We don’t believe there’s any big advantage of using the web charts facility unless you have a weak system. Also, the web charts are only for Equity which I don’t think is very useful. It hasn’t been marketed to us so I don’t think it’s intended for Zerodha clients. I’d advise you not to pick it up.
Nithin,
The top image shows two charts displayed side by side. However, Nest Trader, Only one chart window is available. It seems not possible to add more than one chart window. Is that right? or is there any way to do that?.
You can view multiple charts on Zerodha Trader by simply locking the first chart you open. To lock a chart right click and choose Lock Scrip from the menu options. Once you’ve locked one, you can open a chart for another scrip. You can resize the charts to view them as per your preference.
That’s great! and thanks, Hanan
Hi If we have to code for Bullish Engulfing pattern do we have any standard code for this like moving averages or we need to code this.
You will have to code this based on your logic.
Hello Nithin,
Can I place Buy/Sell order in “Market Price” using AMO…?..And any proirity to exicute the open price(first price)…?
Which is the best tool to find the trend in MCX crudeoil…?
Yes you can place market orders in AMO. Priority is usually based on First in First out.
Best tool to find the trend in MCX, hmmm.. haven’t really been tracking MCX as such.
Hello Nithin,
Congrats for winning CII Emerging Entrepreneur Award 2013.
I am trading only with NIFTY OPTIONS and making small profits without any technical analysis support.
I am also a registered user of NEST PLUS.
How does the “Nest Plus-Option Strategy” support option traders?
Is there any other system or method to be followed for Options Trade?
Thanks.
Kaiser,
Thanks,
The option strategy tool lets you figure out the payoff and possible high profitable strategies based on your view of the market. Check this blog
how to exicute the first market price in gap up or gap down
Rasi,
You just have to be lucky to get the best price when there is a gap up or down, no particular way to execute.
Dear sir,
I wish to develop a moving average cross over trading system for crude oil. can you help me for that? i am really fed up with the tips and advises. now i wish to do trading my own. i recently read your varsity lessons. i hope that you can guide me to make a trading system for crude which can provide a 20 points movement.
thank you
pradeep k
Post your strategy on tradingqna.com, we will get someone to code this for you. You can then use it as an expert advisor on Pi. Check this.
I am using the buy condition: CLOSE>EMA(CLOSE,50) AND REF(CLOSE,1)<EMA(CLOSE,50) AND REF(CLOSE,2)<EMA(CLOSE,50) AND REF(CLOSE,3)<EMA(CLOSE,50) AND REF(CLOSE,4)<EMA(CLOSE,50) and buy exit: CLOSE<EMA(CLOSE,20) vice versa for the short script.
Today I decided to take it live on Tata Steel Feb Future(1 min chart).The price of Tata SteelFut was beteen 387.15 and 393.7 but I was getting buy calls at 442.45 and exit long at 338.90. Go short at:453.30 and exit at 456.50.
These values are nowhere near the actual trading price of the scrip. It seems there is something terribly wrong with the data in the script or how the script is executing.
Yeah, this issue can come up whenever the DLL hasn’t been registered properly for Nest Plus. Linekar from Zerodha will call you and assist you with getting this done, after which you’ll see accurate backtest results.
Thanks for your quick reply. Got a call from Linekar. DLL has been updated.Will check if it works fine when I take the script live tomorrow.
I want to add 10 days and 50 days DMA in marketwatch column.please advise how to do it??
Hi,
I want to code this :Buy when MACD line crosses above Signal line and MACD above zero and RSI50
Hi Nithin,
I would like to write some program/script (not on NEST Plus) which would fetch data for Nifty futures every 1 min (High, low, close). The script would then do some calculations on the collected data every 30 min and generate signals.
My questions:
Using my Zerodha credentials Is it possible to get nifty future data (the programming/scripting part I would take care) from zerodha servers?
Kindly let me know if any clarification is required.
Regards,
pK
How do I place Exit code when profit is flat 20 points. what ever be the buy or sell signal.
Example if BUY signals at say
TREND(MACD(12,26,9,SIMPLE),3)=UP
then how to place SELL order when profit reaches flat 20 points.
Shama,
Exit also has to be a technical analysis condition, and cannot be a entry price + 20…
Hi Nitin,
Why is such a thing not possible, is it the limitation of the software, or it can lead to scenarios where the script might run into an infinite loop?
Rushil it is currently the limitation of the scripting language.
Hi Nithin,
I would like to write some program/script (not on NEST Plus) which would fetch data for Nifty futures every 1 min (High, low, close). The script would then do some calculations on the collected data every 30 min and generate some signals.
My questions:
Is it possible to get nifty data (using some kind of programming) from zerodha using my zerodha credentials?
Kindly let me know if any clarification is required.
Regards,
Prakash
Hello Zerodha,
This code is giving me error “Undefined Variable ‘Buy’.. Please help.
Buy: MACD (26, 13, 9, EXPONENTIAL) > MACDSIGNAL (26, 13, 9, EXPONENTIAL) AND REF (MACD (26, 13, 9, EXPONENTIAL), 1) > 0 AND REF (MACDSIGNAL (26, 13, 9, EXPONENTIAL), 1) > 0
Sell: MACD (26, 13, 9, EXPONENTIAL) < MACDSIGNAL (26, 13, 9, EXPONENTIAL) AND REF (MACD (26, 13, 9, EXPONENTIAL), 1) < 0 AND REF (MACDSIGNAL (26, 13, 9, EXPONENTIAL), 1) < 0
Please give code for MACD HISTOGRAM.
Here you go. Here’s one code. You can try modifying it based on your requirements.
For BUY:
SET MACDHIST = MACD(26, 13, 9, EXPONENTIAL) – MACDSIGNAL(26, 13, 9, EXPONENTIAL)
MACDHIST<0
For SELL:
SET MACDHIST = MACD(26, 13, 9, EXPONENTIAL) - MACDSIGNAL(26, 13, 9, EXPONENTIAL)
MACDHIST>0
Thank you so much.
Can you provide me code for following strategy.
I need a buy signal if price closes above previous lows compare with past 20 bars and for sell signal if price close below previous high compare with past 20 bars.
Please do the needful.
Hi Kasi,
We’ve got the idea behind the code below for you. We’ve set it up for 10 candles. If you’d like to make it for 20 candles, you just have to continue the sequence. 🙂
BUY:
(CLOSE > (MINOF(REF(LOW, 1), REF(LOW, 2), REF(LOW, 3), REF(LOW, 4), REF(LOW, 5), REF(LOW, 6), REF(LOW, 7), REF(LOW, 8), REF(LOW, 9), REF(LOW, 10)) > CLOSE))
SELL:
(CLOSE < (MAXOF(REF (HIGH, 1), REF (HIGH, 2), REF (HIGH,3), REF(HIGH, 4), REF(HIGH, 5), REF(HIGH, 6), REF(HIGH, 7), REF(HIGH, 8), REF(HIGH, 9), REF(HIGH, 10)) < CLOSE))
Hi Mr. Hanan, Did you back test that code, because for me it did not give any trades.
Yes, Kasi. This has been backtested by our developers. As suggested by them, try it on 10 candles for a very liquid scrip like Nifty.
zerodha, i need code for the following condition:
buy = 5 period EMA of average of open, high, low & close ((Open+High+Low+Close)/4) crosses 10 period EMA of average of open, high, low & close from below
sell = 5 period EMA of average of open, high, low & close crosses 10 period EMA of average of open, high, low & close from above
thanks in advance.
Hi Nehal… Here’s your strategy.
Sell:SET A = ((Open+High+Low+Close)/4) REF(EMA(A, 5), 1) > REF(EMA(A, 10), 1) AND EMA(A, 5) > EMA(A, 10)
Please backtest the strategies to assess before going live.
zerodha, i need code for the following condition.
first need to calculate a pivot point=(Previous Close+Open+ATP)/3
buy = ATP crosses pivot point (calculated with above formula) from below
sell = ATP crosses pivot point (calculated with above formula) from above
thanks in advance.
are you people sure that ATP is not available at NEST Pulse? it is available at columns. please check snap below.
Yes, Nehal, unfortunately there is no ATP in the coding jargon for algoZ even though it shows up on the market watch column profile. We’ve cross-checked this with our experts and hope to have this feature available in the future releases.
How ATP can cross Pivot calculated on the said formula i,e, (Previous close + Open + ATP)/3. Because ATP and Pivot varies directly and other two factors remain constant.
I need a code for the following condition.
Buy: when MACD line crosses Signal line from below and previous records for both were already above ZERO.
Sell: when MACD line crosses Signal line from above and previous records for both were already below ZERO.
Thanks in advance.
Nehal Suthar
Hi Nehal… Here’s the strategy in code. Try it and let us know.
Buy: MACD (26, 13, 9, EXPONENTIAL) > MACDSIGNAL (26, 13, 9, EXPONENTIAL) AND REF (MACD (26, 13, 9, EXPONENTIAL), 1) > 0 AND REF (MACDSIGNAL (26, 13, 9, EXPONENTIAL), 1) > 0
Sell: MACD (26, 13, 9, EXPONENTIAL) < MACDSIGNAL (26, 13, 9, EXPONENTIAL) AND REF (MACD (26, 13, 9, EXPONENTIAL), 1) < 0 AND REF (MACDSIGNAL (26, 13, 9, EXPONENTIAL), 1) < 0
it actually shows little strange results than my expectations but the most interesting thing is that back testing shows following impressive results.
for bank nifty future, time frame to use 35 minutes, only 4 calls generated so far with ZERO loss and profit of 653.35 points in bank nifty since 9/27
for nifty future, time frame 25 minutes, just 5 trades since 9/25, ZERO loss so far & profit of 410.35 points
Hi Zerodha,
I used Zerodha Trade web to trade today after my Id got migrated to Zerodha trade from NSENOW however what I see that I can only add max 4 groups in Market watch and that to limited for certain number of scrips.
When I contacted to Zerodha customer care I have been told that this is an issue and will be fixed soon but not given any confirm date. Could you please let me know when this can be fixed to add more goups.
I am yet to check on Zerodha trade software how good it is.
This issue should be fixed, do check it tomorrow..
Cheers..
Can you send this query with your client id to [email protected]
i try to add more scripts in NEST trader and it says ” Subscription Failed for MARUTI-EQ from autotextilepharma-MarketWatchView. Reason:No of Subscription Exceed 30″
So how to add more scripts in the NEST trader bcoz scripts added more than that is getting refresh. to know each an everytime i need to click the script.. Suggestion please.
Send a request to [email protected] asking to increase the marketwatch limit for Zerodha Trader(NEST).
Cheers,
You need to send us a request at [email protected] for increasing your scrip list. By default you get only 30 scrips.
# Define a 2% trading range over 50 days
FIND STOCKS WHERE
MAX(CLOSE, 50) < CLOSE * 1.01 AND
MIN(CLOSE, 50) > CLOSE * 0.98 AND
1-Where do i write this expression ,in buy,sell,exit
2-if i take this live, will it find me stocks which meets this condition from the entire MARKET WATCH ,or it will give me signal only when that perticular stock(on which i have taken it live) meets the above condition
Sybrant,
You cannot run filters like what you have mentioned above on the marketwatch.
On algoZ, you can write a technical analysis strategy and backtest it for 1 stock at a time and then take it live again 1 stock at a time..
Zerodha,
One more request, while you go back to drawing boards.
Presently, we use strategy by first opening the charts and then select the option edit/backtest / live etc, I would suggest user must have an option to access the strategy directly from the ticker symbol instead of going thru the charts . Once a strategy has been tested there is no need for charts (as we use the charts from other sources) and also with couple of charts open the ZT terminal becomes unmanageable.
If possible Ztrader terminal should be re-laid such that each open window (orderbook/tradebook/adminposition and multiple charts etc) when minimised is available on a tab and grouped nicely on a toolbar.
Thanks Rainmaker,
we are in touch with the technology team to make a lot more changes including what you have discussed.
Zerodha,
I agree with want Nehal has pointed out above, There is some issue/bug. I have been observing on charts some strange signals, I had doubts in my coding. But a simple PARSAR returned the following result. Backtest on 5 min.
You need to check.
We’ll have this checked by sharing it with the developers and checking why there were inconsistent signals.
Guess what? Our developers have confirmed that there’s an issue with the indicator and have said that they’ll have it fixed ASAP.
seems that its not yet fixed I feel. please confirm, Zerodha.
Rainmaker,
There is an issue with PSAR indicator, which we are working on. Will try to fix it in the upcoming release.
Even there are some issues related to signal generates in back testing and actual signal on chart as per technical indicator. I’m referring to EMA set up. There are still inconsistency in it. How much time it would take to resolve this issue? Please let me know if you need more information.
Nehal, if you’re using 1.6.0.0, we would like to presume that this issue has already been resolved. To know which version of Plus you’re using, please go to Tools < Nest Auto Plugins. If your version is already 1.6.0.0 and you’re still having problems with EMA, we can work with you on this by coordinating with the team from Omnesys.
A little birdie told me that there’ll be a new version of Nest Plus out soooon.
yes i’ve been using 1.6.0.0 and still facing the same issue of discrepancies. please resolve that if possible.
I’m still waiting for your reply here Zerodha or at least have some one from technical team to reach to me for live demo of this problem. Thanks!
Nehal,
We have identified this problem and the tech team is working on this bug. At the same time we are also working on a new front end just for TA based traders. Should be interesting, will keep you posted.
Cheers,
what is code for buy find stock preivus vallu was bilwo medium bollinger bands& now above the medium bollnger band
Zerodha,
Can you please help me to develop code for following criteria?
1. buy = average of 15 period highest price & 15 period lowest price is greater than average of 30 period highest price & 30 period lowest price
2. sell = average of 15 period highest price & 15 period lowest price is lower than average of 30 period highest price & 30 period lowest price
Thanks in advance.
Nehal
Buy:
SET H = MAXOF (MAX (HIGH, 14), REF (HIGH, 15))
SET L = MINOF (MIN (LOW, 14), REF (LOW, 15))
SET AVG = (H+L)/2
SET H1 = MAXOF (MAX (HIGH, 29), REF (HIGH, 30))
SET L1 = MINOF (MIN (LOW, 29), REF (LOW, 30))
SET AVG1 = (H1 + L1)/ 2
AVG > AVG1
Sell:
SET H = MAXOF (MAX (HIGH, 14), REF (HIGH, 15))
SET L = MINOF (MIN (LOW, 14), REF (LOW, 15))
SET AVG = (H+L)/2
SET H1 = MAXOF (MAX (HIGH, 29), REF (HIGH, 30))
SET L1 = MINOF (MIN (LOW, 29), REF (LOW, 30))
SET AVG1 = (H1 + L1)/ 2
AVG < AVG1
Thanks a lot for the code. I’ve also sent another query through email. Please check and see if there is any possibility to resolve that. Thanks again.
Zerodha,
I clearly understand that I cannot take EOD charts live and that’s not my question is. My question/problem is that while back testing, why does it show differences between lines plotted for EMA 15 & EMA 60 cross over and signal generated through back testing. If you can check images I sent earlier, it clearly shows such differences. At couple of points, there is no signal even after crossover happened on EMA 15 & EMA 60 lines plotted on chart and in some cases, there is a signal but there is no cross over on EMA 15 & EMA 60 lines plotted on chart.
What is the reason for such a huge differences? I hope my question is clear now. Thanks!
Nehal,
Can you email me those snapshots once again, will have ti double checked. Send it to [email protected]
Cheers,
Zerodha, I understand concept of candle size while back testing and whenever it goes live. Here in my case for BUY = EMA(CLOSE,15)>EMA(CLOSE,60) and SELL = EMA(CLOSE,15)<EMA(CLOSE,60), I was looking at EOD chart of SBIN and I don’t think we need to specific any candle size/time frame for EOD charts. Please clarify.
NEHAL,
You cannot take an EOD/Daily chart live, you are allowed to take live only intraday strategies.
While backtesting, you would open a historical daily chart. When you do this, it will show buy/sell indicators.
In a daily chart, any buy/sell indicator would be generated only after the day’s closing. So what you will have to do is in the evening when you are doing your research and see an indicator, you will have to manually place the order the next day.
So in Jest, if you are looking at strategies on EOD or daily chart
1. At the end of everyday, run a backtest.
2. if you see a signal generated after today’s closing, executed it manually tomorrow.
Hope this clarifies.
I DON’T UNDERSTAND WHY IT HAPPENS BUT FOR EMA(CLOSE,15)>EMA(CLOSE,60) AND VICE A VERSA CRITERIA, THERE IS HUGE DIFFERENCE BETWEEN RESULTS OF BACK TESTING AND REAL TIME CHART. PLEASE CHECK SNAP BELOW AND PLEASE LET ME KNOW WHAT’S WRONG THERE. ALSO FOR SOME OF THE CROSSOVERS, NO SIGNAL WAS GENERATED.
Nehal,
Had to delete the images, too many images at one time, if you have multiple images to post, put it one by one and under reply.
As far as your query goes, it is very important to choose the same candle size while backtesting and when you take it live. Check this blog
When you backtest on the chart, whatever is the candle size on the blog, it will backtest according to ti. If you are looking at 1 min candle, it will backtest based on 1 min candle.
If you want to go live on 1 min candle itself, make sure in the alert preference window as show in the blog, the interval is set to 1 min.
Also, when you go live, if you get a buy indicator and you get a buy indicator again, it will ignore that as you have already bought. The second buy indicator will come only once the sell has come after the buy.
hope this clarifies.