AFL of the week: Intraday Trading Strategy for Nifty
4 stars based on
This blog contains short examples that demonstrate how to perform common, basic tasks such as identifying krishna trading system afl within a specific price range, increase in volatility, crossing over of an indicator, and so forth. Also this blog contains a reference of functions, properties, and constants supported by the NEST Pulse language as well as hands-on trading system examples.
This method of organization allows the beginning programmer to see results immediately while learning at his or her own pace. NEST Pulse is the engine krishna trading system afl drives the scripting language in your trading software. It is a non-procedural scientific vector programming language that was designed specifically for developing trading systems. A script is simply a set of instructions that tells the NEST Pulse engine to krishna trading system afl something useful, such as provide an alert when the krishna trading system afl of one stock reaches a new high, crosses over a moving average, or drops by a certain percentage.
There are many uses. The language provides the framework required to build sophisticated trading programs piece by piece without extensive training or programming experience. The following script is a very simple krishna trading system afl that identifies markets that krishna trading system afl trading higher than the opening price:.
It almost goes without saying that the purpose of this script is to identify when the last price is trading higher than the open price. It is nearly as plain as English language. Just as a spoken language gives you many ways to express each idea, the NEST Pulse programming language provides a wide variety of ways to program a Trading System. Scripts can be very simple as just shown or extremely complex, consisting of many hundreds of lines of instructions.
But for most systems, scripts usually consist of just a few lines of code. The examples outlined in the first section of this blog are relatively short and simple but provide a foundation for the development of more complex scripts.
The scripts shown in this first section may be linked together using Boolean logic just by adding the AND or the OR keyword, for example:. You can aggregate scripts so that your script returns results for securities that are higher than the open and with the volume two times the previous volume:. Likewise, you can change the AND into an OR to find securities that are either trading higher than the open or have a volume two times the previous volume:. Once again, the instructions are nearly is plain as the English language.
It does not matter if your code is all on a single line or on multiple lines. It is often easier to read a script where the code is broken into multiple lines. The following script will work exactly as the previous example, krishna trading system afl is somewhat easier to read:. It is good practice to structure your scripts to make them as intuitive as possible for future reference. In some cases it may be useful to add comments to krishna trading system afl very complex script.
A comment is used to include explanatory remarks in a script. Whenever the pound sign is placed at the beginning of a line, the script will ignore the words that follow.
The words will only serve as a comment or note to make the script more understandable:. The script runs just as krishna trading system afl did before with the only difference being that you can more easily understand the design and purpose of the script. When functions are built into the core of a programming language they are referred to as primitives. In other words, user input errors will never cause NEST Pulse to break or return erroneous krishna trading system afl without first warning you about a potential problem.
Vector programming languages also known as array or multidimensional languages generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays.
Krishna trading system afl fundamental idea behind vector programming is that operations apply at once to an entire set of values a vector or field. This allows you to think and operate on whole aggregates of data, without krishna trading system afl to resort to explicit loops of individual scalar operations. As an example, to calculate a simple moving average based on the median price of a stock over 30 days, in a traditional programming language such as BASIC you would be required to write a program similar to this:.
And now MedianAverage is actually a new vector that contains the period simple moving average of the median price of the stock at each point. The REF function is used whenever you want to reference a value at any specific point in a vector.
Assume the MedianAverage vector contains the average median price of a stock. In order to access a particular element in the vector using a traditional programming language, you would write:. The main difference other than a variation in syntax is that traditional languages krishna trading system afl the points in a vector starting from the beginning, or 0 if the vectors are zero-based.
NEST Pulse on the other hand references values backwards, from the end. It is always the last, most recent value that is of most importance.
To get the most recent value in the MedianAverage vector we could write:. Which is the same as not using the REF function at all. Therefore the preferred way to get the last value the most recent value in a vector is to simply write:.
The typical investor or trader would avoid opening krishna trading system afl new long krishna trading system afl of a stock that has been in a downtrend for many months. Suppose we have a trading system that buys when the close price crosses above a day Simple Moving Average. The script may look similar to this:. It would be helpful in this case to narrow the script down to only krishna trading system afl securities that have been in a general downtrend for some time.
We can add the following line of code to achieve this:. TREND tells us if a vector has been trending upwards, downwards, or krishna trading system afl, but does not tell us the degree of which it has been trending.
We can use the REF function in order to determine the range in which the data has been trending. To find the change from the most current price and the price 40 bars ago, we could write:. Although the TREND function can be used for identifying trends and the REF function can be used for determining the degree in which a stock has moved, it is often very useful to identify gaps in prices and extreme volume changes, which may be early indications of a change in trend.
We can also measure volatility in price or volume by using any one of the built-in technical indicators such as the Volume Oscillator, Chaikin Volatility Index, Coefficient of Determination,Price Rate of Change, Historical Volatility Index, etc.
This blog is a user manual for algoZ and is continued here. Lot of thanks for your splendid initiative. Hope the blog continues to teach and help to develop trading system of the members.
Dear Nitin, Want to plot trend. Can you please give me the equation for krishna trading system afl following SEll if 2 renko red bars are formed ,exit when one green bar is formed BUY if 2 renko green bars are formed ,exit when krishna trading system afl red bar is formed.
Thank Nithin for your reply. Yes, saw the email, what I have mentioned above as a code, looks like what you are asking for. Do backtest and check the results. Ravi, could you please elaborate on your question? Can you help me for this. Hi, I want to code this: What could be the reason behind this?
Ashish, EMA is exponential moving average, so yes you can use that, it might have been missed in the above post. I had another query on backtesting. Is it possible to backtest the strategy including stop loss order. Currently backtesting result shows the overall profit and loss but I would like get the result by taking stoploss order consideration so that overall loss will get reduced.
In your exit script, have an OR condition separating your Target and your Stop. Thanks Nithin… Since it required more workaround, It would be much better if you can introduce trailing stop loss order. Is there krishna trading system afl plan for this? For Backtesting, I guess this will be the way out, but when you take a strategy live it gives you krishna trading system afl option to trail. How to enable those parameters? Bracket orders and trailing stop losses are not yet available on ZT.
This will be made available on the new release of ZT which we expect to come about within the next month or so. Could you please help me to do this. I krishna trading system afl find any function for Willams AD. The examples provided in the blogs are for the desktop trader application only. Check this postsupertrend currently not possible on algoZ. Fahad, can you ask your queries on coding on Tradingqna under the category algos, we will soon have some experts answering queries on that.
Ask all your coding queries here: But we have a bridge to pi that can directly connect Amibroker to Pi. I want to write a script that will alert me if the price of a stock touches a Trend Line.
If this is possible then plz krishna trading system afl me how to script it. U r giving too much but in difficult manner for a layman. U can convert it in a simple manner directly to understand. Now i want in intraday after one hour opening to SCAN nifty scripts in comparison with nifty for last five days then how to get result?
U have opened so many platform but no information we get. There has to be a systematic training on connecting teamviewer step by step manner so as to digest it practically. There are some things that can be simplified and some that krishna trading system afl you to have certain skillset. We have simplified things to the best of our capabilities and will continue to do so.
Dear sir, I am trading in nifty options. I am a layman and referring sharekhan graphs for taking decisions of buy and sell. I am trading from kite but unable to understand how to use graphs in kite to trade.
Is there anybody in mumbai whom i can approach to learn what you have been discussing in this blog or forum whatever you say to it. Kindly inform me on my email given or you can tell here in reply, Regards Sanjay V.
We do have a branches in Mumbai, you can find the details here: