Home » Posts » General » algoZ- a simple example

algoZ- a simple example

April 9, 2013

Traders

Here’s a quote from Isaac Newton – “What we know is a drop, what we don’t know is an ocean.”

A lot of you might know how to write strategies, but for all of you who don’t and think it is rocket science, Z-Connect will simplify it for you. But as mentioned in the intro blog, I am assuming that you understand at least basic Technical Analysis, if you don’t, I guess this topic would be premature for you.

Example

The strategy is to trade using a 14-candle Exponential Moving Average. The idea is to buy/sell when the price crosses over the moving average on either side. This is something really basic, just to give you an idea on how the tool would work.

Step 1: Launch ZT (Zerodha Trader)

Step 2: Add the scrip that you’d like to trade on the market watch. In our case it’s Nifty Futures.

Step 3. Right click on the market watch and invoke the chart. Shortcut key : Shift + P, if you need help invoking the chart click here. Check out the pic below:

Step 4: Adjust the chart to your preference (double click on the blue panel at the extreme left of the chart and resize it), if you need help click here.

Our strategy is based on EMA (Exponential Moving Average); select EMA from the drop-down menu on the left and double click on it. See the pic below:

Step 5: Here’s how the chart with the indicator is gonna look like. See the pic below:

Step 6: A smart trader would not bet based on just 5 hours’ data, he will backtest it first. He will analyze if this strategy had made money over the last year and only if convinced would he start trading on this strategy. How do you backtest? Can you manually sit down and look at the intraday chart for the last one year and see how many times the strategy made profits/losses? It is a waste of time and this is where “algoZ” our new product on Zerodha Trader would come into play. On algoZ, you would write a small program instead of looking at the chart and then run a backtest.

The first step would be to write a strategy, so right click inside the chart, click on My Strategy and click Add New Script as shown below:

Step 7: Writing the strategy

You get an expression box like the one below where you can write your strategy using the four boxes: Buy, Buy Exit, Sell and Sell Exit. If you don’t want to write an expression for something, write 0 (zero). Don’t keep it blank. In this blog, the idea is to give you an overview, so don’t really worry too much on what the code is for your favorite strategy. See the pic below:

Step 8: Backtesting the strategy. Now that you have written the strategy you would want to know if this would have made profits in the past if applied. To backtest follow the steps in the pic below:

When clicked, the backtest details window opens up.

Presently, in the beta version, to backtest you will have intraday data for 22 days and daily data for over 1 year.

In the next version we will have:

1 minute data for 1 month, 5 minute data for 5 months and 10 minute data for 10 months. The next version will be launched as soon as the development process is complete. Note that backtesting might slow down the performance of ZT during peak trading hours, so it’s advisable to backtest before markets open or after trading hours.

Step 9: Going Live. Assuming you did want to take your strategy live, click on the Live option instead of the backtest option.

By going live, what I mean is that every time a buy or a sell trade is initiated based on your strategy, you get an alert to take the trade. If you decide to act on this, you can have a preset order which will be placed by just the click of a button (semi-automated trading). If you have access to a Zerodha dealer terminal, this process can be completely automated. What this would mean is that every time a buy/sell trade is initiated based on your strategy, trades are automatically executed with your preset quantity and stop loss.

See below to check out how it would work in case of semi-automated trading.

a. Putting up a preset order:

b. A Live strategy:

*presently you can take your strategy live only for Equity, F&O and Currency segments. MCX should be available in the next release.

In the above pic, if you had access to a dealer terminal you could make it such a way that you would not even get that script alert window to “act on alert”, orders would be placed automatically with the stop loss. A dealer terminal is given only to Authorized Persons/Sub-brokers as per exchange regulations and would require the person to comply in terms of NISM certifications and other exchange mandates. Once an individual has the NISM certification, Zerodha would initiate the process of making the client an Authorized Person at a nominal cost so he can execute his own trades automatically.

Like the way we have a script for EMA, we can have multiple such scripts running at the same time on multiple trading symbols.

As you would have probably realized by now, the odds of winning go up considerably by following the above process. This will let you know if a strategy is profitable or not before taking a trade, and if profitable, it’ll give you a fair idea of how much money you can risk trading such a strategy.

The tricky bit would be to write your own strategy but don’t worry about it, we will help you with writing strategies if you post them on the blog.

Time to start trading smarter!!!

Happy Trading,

Tags:


Simple and secure, no nonsense investing and trading.


Post a comment




286 comments
  1. Jay says:

    Is AlgoZ still available? If yes, how do we access it?

  2. Dipak Dhakane says:

    Dear all,

    Is algoz available today also?

  3. Raju says:

    Hi, doing a great things to the trading community. Hats off to you. Could you get me code for SUPERTREND 10 PERIOD AND 2 STANDARD DEVIATION,(10,3), for buying and selling of shares ( based on super trend indicator)?

    Thank you,
    Raju.

  4. Muthu Nagarajan says:

    Hi,
    Can I code in a way such that positions are entered on a different script/s based on an event in another script. For example entering long positions on different bank stocks, when there is a bullish crossover in bank nifty.

    is this possible in PI or Kite?

  5. R Chandrashekar says:

    Hi Kamath,
    I need a script for 1st one minute breakout….can you please help me out

  6. mahesh says:

    hi
    I am not able to see above described steps 3 onward in zerodha trader software.

    Am I missing something?

  7. Tapan Desai says:

    HI Someone please help,
    I want to buy a stock at open (9.15) when it is higher then previous days’s open and exit at the end of day (3.30)

  8. Bhushan says:

    How do I get Active positions for a stock in my logic?

  9. NIlesh Samant says:

    Sir
    i have trading account with zeroda

    can we now use multiple time frames in stratergy criteria ?

    if not ( as i understand by comments above) can i use one stratergy in 15 minute to generate bye signal and while its on ( in trade before sell signal or close trade signal generated ) in 1 minute i can run my stratergy so that

    my purpose is solved

    i want to take a buy in 1 minute when perticular condition satisfied at 1 min also 15 min (and may be 5 min)

  10. Bhushan says:

    Can I access previous Buy order with date in my logic script?
    If yes please give sample script.

  11. jitendra rathore says:

    i want to code a strategy ,if nifty make 3 successive higher high candles and rsi>50 then buy above top candle high and sl will be low of lowest candle, similarily if nifty make 3 successive lower lows candles and rsi<45 then sell below low of the lowest candle and sl will be high of the highest candle, plz write the code asap , thanks

  12. Bhushan says:

    Can I use Java Programming language in Kite.

  13. Bhushan says:

    Is there for-loop function in trade scripting just like any other programming language?
    Please give sample script for placing BUY/SELL order.

  14. Devendra singh says:

    Hi i am new trader i am trading with help of ichimoku cloud and macd indicator . Pls let me script in script in pi softwere.

  15. raja jhunjhunwala says:

    i wanna work for you

  16. JITESH says:

    Hellow,
    I am new to alogo world and I have simple process which works on two different trading account and I want to know is my statergies are codable and if yes then I want to backtest this please help.
    Let us assume stock name is ‘xyz’ and its initial cmp is Rs.1000 and total quantity of stock is 500.
    STATERGY ‘A’ at 1st account:-(Profit when stock moves up)
    1-Buy 250 quantity of xyz at CMP(Initially it Rs.1000 as process continues it would be different).
    2-Put trailing stoploss of Rs. 1.
    3-If stoploss hits at a price lower than Buy price i.e.Rs. 999 and then after if stock moves up from stoploss hit price by Rs 1 i.e. stock price is now Rs. 1000 then again repeat step 1,2,3 and 4 same as above to continue this process.
    4-If stoploss hits at a price higher than Buy price i.e. Rs. 1001 or 1002 or 1003etc. ,then as stoploss order executes again repeat step 1,2,3 and 4 to continue the process.

    STATERGY ‘B’ at 2nd account:-(profit when stock moves down)
    1-Shortsell 250 quantity of xyz at CMP (Initial Rs. 1000 as process continues it would be different).
    2-Put trailing stoploss of Rs.1
    3-If stoploss hits at a price higher than shortsell price i.e.Rs. 1001 and then after stock moves down from stoploss hit price by Rs 1 i.e. stock price is now Rs. 1000 then again repeat step 1,2,3 and 4 same as above and continue this process.
    4-If stoploss hits at a price lower than shortsell price i.e. Rs. 999 or 998 or 997etc. ,then as stoploss order executes again repeat step 1,2,3 and 4 to continue the process.

  17. Aravind says:

    Hi.
    I have a set of calculated values for several shares in an excel format. eg. share 1 buy above | target | sl | Sell below |target |. These values are for futures and equity. can i implement them automatically, provided i have sufficient limit ?

  18. anup says:

    how to log in into algo z

  19. Raja says:

    Hi Nithin,

    I want to know a couple of questions regarding this:

    1. My employee trades for me and I do not want to expose the formula to him. Can I lock the strategy in Pi? Or is there any alternative?

    2. All my signals are “buy above” and “short below” kind of trades which come at the start of every hour (as the time frame is hourly). So, If I get a signal at 11:00 AM to buy above 100 and now stock LTP is 99, can I place the order at 11 Only or will the alert window for confirmation appear only at the time of call activation (say 11:20 AM) ?

    3. Even if I have the option to place an order at 11 AM, at the time of activation (say 11:20 AM at 100 rs.) – will that be a “limit”, “SL” or “SL-M” order? Do I have the choice to choose?

    4. I want to trade only in the first 4 calls of my strategy (though it gives me many in a day). Is this option available?

    5. I’m preferring to use Pi only but in case, if I use Pi bridge to automate from Amibroker, will there be a delay in trading? I’m using data from “GlobalDataFeeds” which is a real tick live data.

    6. Lastly, for fully automated access, you said that Zerodha needs “Authorised person” and NISM certificate. I’m already a Zerodha partner. Will that work? And I have NISM “research Analyst” certification, will that be enough?

    Regards,
    Raj

  20. Viswnaath says:

    I dont see “my strategy” on my intraday chart as mentioned in step 6 of this web page.

  21. Amarjeet Singh says:

    Please code this strategy for me:
    Buy when RSI is below 20, and Parabolic Sar (Min AF 0.02, Max AF 0.2) buy crossover, Sell: when Parabolic Sar 0.02, 0.2 gives sell signal

  22. Rachit Jain says:

    i do not get my strategy option when i right click the chart
    its a silly question but i m starting to learn coding and stuck in the very first step itself
    what to do ????
    please help

  23. danish hakim says:

    hi just want to know that zerodha pi and zt provide trailing stop loss automatic order execution also ?

  24. sreespg says:

    is it possible to give a strategy by comparing RSI values and KDJ values and exit buy SL value

  25. sunil says:

    good work

  26. sunil says:

    Hai sir,

    which would be a better platform ( AMI BROKER or YOUR ZERODHA TRADER ) for full time trading

    i already have a nism certification and looking to by amibroker …. so kindly help me..

  27. Nithin says:

    Hi Nithin,

    How will you code the following intraday strategy:

    If a stock’s prv close is +2% or more, then sell the stock if it crosses yesterday’s high, SL=Target=1%

    If a stock’s prv close is -2% or less, then buy the stock if it goes below yesterday’s low, SL=Target=1%

  28. Nikhil Zelawat says:

    Hi,
    When I right click on chart in nest trader I am not able to see the “add script ” option ?

  29. ambalal says:

    Sir
    I am use Amibroker I want if buy arrow candle high break second ya third candle buy order place in market
    If sell arrow candle low break second ya third candle sell order place in marker
    Plz give code for Amibroker
    Thankd

  30. Bhupendra Dubey says:

    I there an alternate way to write strategies on web or mobile based interface or zeroda trade software is a must? Also is there any charges associated for this service including the data for back testing?

  31. suresh says:

    nithin sir still waiting….any progress regarding my request pertaining to alert on closing basis?

  32. Ashish says:

    Hi,

    Had requested for coding the following EA in tradingqna,

    Strategy 1 : Give signal when,

    (a) Ehler Fisher transform reverses from top ie Trigger value becomes greater than signal value, AND

    (b) Elder bear power > 0, AND

    (c) Elder bear power > Elder Bull power

    Strategy 2 : Give signal when,

    (a) Ehler Fisher transform reverses from bottom ie Trigger value becomes less than signal value, AND

    (b) Elder Bull power > 0, AND

    (c) Elder Bull power > Elder Bear power

    Also, how to use the above strategies for scanning the selected scripts for a particular timeframe in Pi

    The reply posted was that it cannot be coded as the indicators were not available in tradescript.

    Query is — as these indicators are part of Pi, so there would be an option as to how an EA can be formed for Pi.
    Infact, wanted to also try the above strategy with just conditions (a) & (b) listed above in both the cases & check the results.

    • Ashish, you will have to figure out what goes into Ehler or Elder, and then code that first.(As pre coded like EMA etc is not available for these two). Once you have this code, you can run this in the scanner.

  33. suresh says:

    thank u nithin sir..will be waiting for ur reply

  34. suresh says:

    sir, with all due respect i asked for help as u said in tradingqna, but no help forthcoming and i got a reply via email from sreeni that he is not proficient enough in this. can u plz some to call me bcoz i am looking for a very simple thing. the code which u gave me doesnt wait fro the bar to close and keeps signal in between. my is MHRS4826. thanx

    • Suresh, we cannot taking coding queries on email, and currently providing only on open forums like Tradingqna. Let me speak to Sreeni once. Yes, currently, the code right now triggers alerts during the formation of the candle. We are working on seeing if there is anyway we can give you an option to select if you want it at end of candle, or during the candle. Will take us some time, will keep you posted.

  35. suresh says:

    thank u nithin sir…..only one problem the script u told me is giving alerts without waiting for bar to close. suppose i check it one min time frame and price is going up and down the EMA it is giving signals everytime. i want it only on closing basis. thank u sir in advance.

  36. suresh says:

    Sir, plz help me write a code in which if price closes above or below a certain value EMA, i get a pop-up and sound alert. plz give me step by step instructions. i wrote to Mr sreeni and got a reply that he could get through me and emailed me abt activating sound alerts from user settings. he probably didnt get abt the coding aspect. thank u sir

  37. ambalal says:

    hi sir i am buy amibroker afl code
    i am trading mcx
    i want to set this afl algo server so who is parson ya company provide this
    sir plz guide me
    sir plz reply
    email [email protected]

  38. KANWAL says:

    Sir, Do u have a strategy when these conditions are met.
    TIME FRAME 15 MIN
    FOR BUY
    1) RSI (9), rsi value should be between 10 to 60
    2) RSI (14) and ema (6) crossover value less than 50
    3) price crosses above Bands- BBTOP, BBBOT ( value= 20, 0.22 )
    4) SMA(50)= price should be above this.
    5) SL should be 1.2% and target price should be 0.75%

    FOR SELL==
    1) RSI (9) value between 40-90
    2) RSI (14) and ema(6) crossover value greater than 50
    3) price crosses below bands ( band value= 20, 0.22)
    4) SMA(50) – price should be below this
    5) SL 1.2% from entry and target 0.75% from entry

    regards

  39. Shailesh says:

    Hi,
    I need info on below points?
    1) Do you charge for Charting software?
    2) Does your software provide all time frame charts ( Intra,EOD,Weekly,Monthly)?
    3) How far back we can check chart on intra?

    It will be great if you provide any demo as me using sharekhan’s trade tiger( free of cost) right now and wanted to shift to Zerodha but want to check about charting software

    Thanks,
    Shailesh

    • Hanan says:

      Here are your answers, Shailesh.

      1. Nope. We do not charge you for providing charts on your trading software.

      2. Yes, our software provides charts for all time frames that you mention.

      3. Intraday data is available for 15 trading days on Zerodha Trader. Our new offering Pi will have intraday charts for over 30 trading days.

      Sure, we’d love to provide a demo for our trading software and our new back office software. Share your mobile number here or send a request over to [email protected] with your details.

  40. sandeep das says:

    can i do do this in algoz?

    if ltp= x
    buy(x+.05) with stop loss z
    sell at y
    start time 9.30

    and it will trade only once.

  41. Rahul says:

    Hello Nithin sir,

    I want to know few things about auto trading:

    -> Can we program a strategy for simple range breakouts like pivots ? e.g. Buy/Sell Nifty if it crosses certain pivot levels and exit based on certain target of stoploss?

    -> When will this feature will be enabled for MCX?

    -> Can we place a bracket intraday order using this programming feature?

    -> When will bracket order feature be available for MCX?

    Thanks in advance,
    Regards,
    Rahul Sane

    • 1. yes. our new trading platform Pi which is in beta has advanced charting/coding.
      2. Still no approvals for this.
      3. we have separate bracket order available, presently can’t be combined with this.
      4. No approvals yet from MCX.

  42. Ajeet Singh says:

    “Do not buy at resistance, sell at support”. Is there a way to code this?

  43. surya_talkin says:

    How to code

    current candle in within the range of previous candle

    (REF(LOW,1) HIGH )
    // present formed candle’s low is greater then previous candle’s low and present high is lower then previous high //

    what I’ve written above is not working

    • Low > Ref(low, 1) and high < ref(high, 1)

      • surya_talkin says:

        i want a to
        BUY : when previous candle’s low is below the lower bollinger band and current candle is within the previous candle ( Low > Ref(low, 1) and high < ref(high, 1) )

        SELL : when previous candle's high is above the upper bollinger band and current candle is within the previous candle range

        I've tried this

        BUY: (REF(LOW,1) Ref(low, 1)) and (high BBT(CLOSE,20,2,EXPONENTIAL)) AND (Low > Ref(low, 1) and high < ref(high, 1))
        SELL EXIT:0

        not giving the correct signal ( I've checked the time interval also )

        • surya_talkin says:

          BUY: (REF(LOW,1) Ref(low, 1)) and (high BBT(CLOSE,20,2,EXPONENTIAL)) AND (Low > Ref(low, 1) and high BBT(CLOSE,20,2,EXPONENTIAL)) AND (Low > Ref(low, 1) and high < ref(high, 1))
          SELL EXIT:0

          • Buy:

            ((Ref(Low, 1)) < (BBB(CLOSE, 20, 2, EXPONENTIAL))) and (Low > Ref(low, 1) and high < ref(high, 1)) · (Low > Ref(low, 1) and high < ref(high, 1)) – can be used if you are getting the logic right. Sell: ((Ref(high, 1)) > (BBT(CLOSE, 20, 2, EXPONENTIAL))) and (Low > Ref(low, 1) and high < ref(high, 1))

  44. Harshit_Kumar says:

    Dear Nithin,

    Please help me in coding for below

    SELL

    Last 3 candle closing price is lower than its predecessor
    and curent price =1 or MACD(5,35,5)<=-0.75
    and Stochastic(35,5)<=70
    and ADX(14)=0.5
    • Rising stochastic Stochastic(35,5)>=50
    • ADX(14)>25

    Buy Exit=0

    Thanks for your help in advance!
    harshit

    • · (Close < ref(close, 30)) and (Ref(close, 1) < ref(close, 3)) and (ref(close, 2) < ref(close, 3)) - including the current one. · (Close = 1) or (MACD(5,35,5, EXPONENTIAL) <= -0.75) - MA type is exponential. · SOPK(9, 3, 9, SIMPLE) > 80 OR SOPD(9, 3, 9, SIMPLE) > 80

      · ADX(14)>25

  45. Sartaj Khan says:

    I’ve just installed ZT ver 3.11.2 and now while after doing the coding while i’m looking for backtesting it is not showing me the live and backtest option. It is just showing me the edit option. Is it because it is an off today or i need to send mail to someone for activation purpose?

  46. John says:

    Hi Nithin,

    It would be nice if you could write a few articles on this algo platform. I think this is an amazing product but more clarity is needed for amateurs like me.

    Thanks
    John

  47. agsuresh says:

    Nithin,

    You may have answered this question, but I did not get it right, hence asking again.

    Is it possible to enter a trade like this

    {
    But @ LIMIT price (or even market price will do)

    Sell @ High price or @ Low price (stop loss).

    }

    A more complex scenario would be

    But @ LIMIT price (or even market price will do)

    Set initial stop loss at X% from the Buy price

    Sell @ High price

    If the price goes up the stop loss also goes up by X% from the last price (like a trailing stop loss).

    This would be similar to scalping algo in metatrader.

    I do understand from your various posts, that also needs to be registered and verified etc.

    but pls clarify if either of the above is possible or not. I am not very keen on fully automated trading like that is available for forex.

    The above will help immensely.

    Suresh..

    • We allow Bracket orders and Trailing SL, Check this post. Most of what you are asking for will be possible through this. Entering using a SL is something that is not presently available.

  48. kalyan says:

    I have been using nest plus since about one and half years. Its awesome. recently (about 3-4 months back the version has been updated. the updated version is highly unpredictable. I have noticed the following errors :

    1. “or ” is not recognised in any strategy.” And” was also not being recognised. After updating some dll files by zerodha ” and” is being recognised
    2. Back testing gives “imaginary” values.
    3. If there is a transient disconnection of internet.. say for 1 or 2 sec nest plus fails to reconnect although market watch continues to work.
    4. backtesting on the same data gives different results with version 7 and version 8. version 7 follows the strategy/programming well.

    i have tried on different laptops, with different operating systems (windows 7 and windows 8) with different internet connections ( 8mbps, 15 mbps, 25 mbps of bsnl and beam). the problem persists on all ccomputers with nearly all the strategies.

    I have been bringing this to your notice since last 4-5 months. unless nest plus becomes predictable i will not be able to trade as i depend on algoz for most of analysis and trading.
    Kindly look in to the matter.

  49. shashi joshi says:

    Hi,

    Can we use mathematical functions like Average,sum,Percentages in writing a strategy.

    Actually i want to buy when Average buying price is < 10% of current price.Here average price is trhe average of my stocks on hourly basis is the criteria is met

    • Akshay says:

      Hi

      It is possible to use Average,sum in writing a strategy.But when you use average, you need to decide whether you want average of open,high,low,close or combination of them. And you can do your analysis on single timeframe only.

  50. Shivendra Singh Rajawat says:

    Dear Nithin,

    I am desirous of going for full auto trading, I have been searching over this on Internet and figured this AlgoZ.
    Right now I am bit confused whether I should go with Amibroker with Zerodha and dataplugin from GDFL or AlgoZ.

    I plan to invest my further two years in learning autotrading; so I need guidance over this matter.

    I know Amibroker’s proficiency but AlgoZ (Nest Plus) I have not explored fully.

    I am desirous of writing full strategy covering risk management and position sizing. I have programs in Amibroker thoroughly backtested and optimized.

    So does I move with Algoz (As it will be a less costly option) or to go with Amibroker (As abundant formula library is available on the net)

    • Shivendra, it depends on what kind of strategy that you intend to learn, if it is something complex I’d suggest Amibroker. We are also working on a new trading platform, which will give you much advanced coding/backtesting/going live options.

      If your view is for 2 years, you can probably start off with Amibroker and switch as and when we are out with the new platform.

  51. Praveen.E says:

    Hi all,
    I’m new to algoz and zerodha platform.
    I wrote a strategy but there is no option for live and backtest option.
    Could anyone please tell me how to enable backtest option in Zerodha NEST 3.10.57.97.7

    Thanks
    Praveen.E

  52. velappan periasamy says:

    some lines are missing no editor provided
    then how to correct the typing mistakes

  53. Naren says:

    Hi,
    I need help for coding this strategy.
    Buy

    When MACD(12,26,2)signal cross above zero line

    Buy Exit

    When 3 ema cross below 41 ema

    Sell

    When MACD(12,26,2)signal cross below zero line

    Sell Exit

    When 3 ema cross above 41 ema

    • Buy
      crossover(macdsignal(12,26,2,simple),0)
      Buy exit
      crossover(ema(close,41),ema(close,3))

      Sell
      crossover(0,macdsignal(12,26,2,simple))
      sell exit
      crossover(ema(close,3),ema(close,41))

      • Naren says:

        Hi Nithin,

        Now i am testing inverted code Buy-Buy exit and for Buy exit -Buy and same for sell.it seems to be good.I need additional code for buy like if macd signal cross below zero the buy will exit but the ema continues so again when macd sinal cross above zero it should generate buy signal or long again.

        • Naren,

          Can you explain the complete strategy once again, Buy, Sell, SL and exit?

          • Naren says:

            Hi Nithin,

            Buy Expression:
            crossover(ema(close,30),ema(close,75))
            Buy Exit:
            crossover(0,macdsignal(3,10,16,simple))
            Sell Expression
            crossover(ema(close,75),ema(close,30))
            Sell exit
            crossover(macdsignal(3,10,16,simple),0)

            When MACD signal crosses below zero buy exit triggers but crossover not crossing each other.After MACD signal Cross above zero again Buy expression should generate Long Signal again.Same for Sell.

          • Naren says:

            Hi Nithin i am waiting for your reply…

          • Naren says:

            I am facing some issues,i don’t know whether the issues is only from my side or for everyone.

            Issues
            1)When Backtesting wrong long or short price data.
            Example-When backtesting stock futures for some long or short calls it
            is showing Nifty price data.(6569 instead of 172.10)
            2)I cant save live running scripts when i logout.When i login again i need
            to set them again and again.
            3)When i set price offset when the call alert triggers it is showing
            only offset price not the stock or index price.

            • Naren,

              I guess someone has already called you for the strategy, we are working on our new trading platform presently which will give you a lot more options for the same.
              1. Not sure how that is happening, you are running the script with the stock chart opened in the background right?
              2. Yes, it is a limitation right now.
              3. Will have this checked.

          • Naren says:

            Nithin,
            One of your person contacted me for the strategy.Now the problem is not with the strategy but different price data issue.Still i am in mail conversation
            with your person.I have two issues.
            1)Different Price data in Back testing.This happens even after
            closing the previous chart(Screenshot mailed ).
            2)In Live script Buy sell Alert for Long and Short some times i get Offset price instead of current signal price (Example 0.00 instead of 172.4).

  54. Tanmay says:

    1st disappointment that it can’t be used in VSAT,
    I reside in a town area where Internet connectivity is a major issue, the services by bsnl is very improper.
    Please let me know if connectivity by VSAT will be available later.

    2nd disappointment is that we can’t write a code for position size that is against the rule of Proper Money management and position sizing. My strategy is based on value, say i want to risk 5000 per trade, in that case it is not possible by prefixing size/qty

  55. Tanmay says:

    I have following queries:

    1) Can I use NEST Plus on VSAT ?

    2) I want AUTO Squareoff of the open positions created by the Algo at Market Close or 3:15 PM

    3) Can I use NEST Pulse script for placing Orders. I want BuyAbove/SellBelow orders on completion of candle
    (suppose I want to Buy above the Highs of n periods, ex. if High is 100, I want my orders to be placed at 100.05 on completion of candle. The order needs to be placed as soon as the current bar closes.

    4) can i run the same strategy on multiple scripts?

    5) Suppose I want to take a risk of 5000 per trade, is it possible to write a code for deciding position size based on per lot risk
    for ex. if per lot risk is between 800-1300 then do 5 Lots

    • 1. No you can’t use NEST plus on VSAT.

      2. What you can do is use order type as MIS for all the orders, they all get squared from our side anyways at 3.20 pm.

      3. yes, you can, as a retail client, you get a semi automated version where you will have to click yes/no before the order is sent to the exchange. If you want to automate, you will need to become an authorized person on NSE, be NCFM certified, get your strategy approved, one time cost of Rs 3000/segment/exchange and monthly running cost of minimum around 4k, and can go up based on how many strategies you are running.

      4. Yes, you can

      5. You can’t presently write a code for deciding position size, but you can prefix the order size before taking a strategy live.

      • Tanmay says:

        one more query, as my strategy is time based High-Low range breakout system,
        During trading after selecting any strategy to go live with and if my net connection gets disconnect say for a minute or two (which usually happens 10times in a day where i reside,very irritating),
        then what will happen to that live strategies?
        will it resume and backfill after reconnecting or I need to run the strategies again

  56. Vasant says:

    I am a zerodha trader. I want to know whether I can install a simple picot levels sytem algorithm on algoz. It is different than usual pivots. And whether can I backtest on daily chart and if successful can I sell it on zerodha?

    • Vasant, yes we can try coding the strategy if you can let us know. We are working on our new platform which comes with advanced coding and backtesting capability. We are also looking at building a marketplace where traders can buy/sell strategy.

      cheers,

      • Yogesh Kulkarni says:

        Dear sir
        Can we place orders on price action basis and can we backtest these strategies.for example
        buy a option at current price and keep a trailing stop loss at 4 Rs below the high with double quantity.same procedure fo the executed order.
        I would be happy if you email me back.

        • Venu says:

          You can backtest, but it may give you continuous signals. Placing a trailing stop loss is only possible if you place a bracket order, which you have to place manually.

  57. Rahul Patil says:

    Hi, I was wondering , if you work on franchisee model? I reside in nasik and have been your client since 2 years. I see good potential in it.

    • Yes Rahul,

      We do run our partnership programs, not the traditional sub-brokerage model though. Will get one of our sales managers to shoot you an email with his contacts, you can call him for more on this.

      Cheers,

  58. Satish Prabhakar says:

    Hi Nithin,

    I want a strategy to be written for CCI. The CCI period should be 20 with the overbought and oversold lines be 100 and -100.

    Buy Alert when CCI crosses 0 line upwards and exit once profit of 20 paise is attained.
    Sell Alert when CCI crosses 0 line downwards and exit once profit of 20 paise is attained.

    For both the cases the stoploss will be decided by me from time to time and entered manually if required.

    Can you help me with this strategy so that I can back test it.

    • Satish Prabhakar says:

      Hi Nithin,

      I have been waiting for 4 days for an answer. Can u or someone please help me in coding the strategy?

      • Satish prabhakar says:

        Why is it no reply for how to code my strategy?

        • Satish sorry about the delay, just saw your email, trying to figure out why I was not getting notification from your post here…

          Anyways, in algoZ, we can’t capture the actual buying price or selling price, so what this means is that you can’t really code an exit strategy that says buying price + 0.2 points.. Exit can’t be coded the way you want, but your entry strategies are:

          Buy:
          (REF(CCI(20, SIMPLE), 1) > CCI(20, SIMPLE)) and (CCI(20, SIMPLE) > 0)

          Sell:
          (REF(CCI(20, SIMPLE), 1) < CCI(20, SIMPLE)) and (CCI(20, SIMPLE) < 0) Please backtest the strategies to assess the performance before you go live.

  59. satheesh mukundan says:

    sir,
    when will algoz for mcx will be launched? or is it already launched?

    • Hanan says:

      Please note that algoZ is not enabled for MCX as the exchange approval is still pending. We’ll keep you updated on when algoZ becomes available for MCX.

  60. Joseph says:

    Nithin Sir,
    I am new in Zerodha,just send mail to activate algoZ account. I would like to know whether this stretegy is possible in algoZ. If you have any manual link of algoZ. Please share it.

    How can write following conditions code in algoZ
    1) Buy if stock open > yesterdays close
    2) sell if stock break yesterdays low

    stretegy2

    Is it possible to findout high volume stocks (first one hrs) from my watchlist compare to yesterdays volume

    • Joseph,

      Check this blog for any questions on strategies.

      In the present version of algoZ, you can’t code previous day’s close.

      There is no scanner also to compare yesterday’s volume..

  61. currencyandnifty.com says:

    Backtest results are not correct,as per date ,you have mentioned,on backtest result window,as per crossover strategies ,And not getting the result for 1 or 2 trades as per strategy in 5 min,?

  62. currencyandnifty.com says:

    Pls provide the information for an Automated dealer terminal?
    what are documents required? All algo strategies can be approved? or approval cost for each strategy? etc,
    can a trader authorise other person and his certificate as his dealer? pls clarify

    • You would firstly need to be registered as an Authorized person on the exchange, have NISM certification on Derivatives module, the strategies would then need to be approved at the exchange.

      At Zerodha, we don’t let anyone trade on behalf of another, so it would not be possible to authorize your ID to be traded by someone else.

      If you send an email to [email protected], he will help you with all the details.

      Cheers,

  63. Sameer_Trader says:

    In algoZ trading, Suppose the system puts a long order on exchange along with a stoploss and the stoploss gets triggered for below stratergy .So the long position is closed because of stoploss and not due to buy exit condition. Now when the sell condition becomes true at some point, will the system first execute buy exit and then opens short position? or does the system knows that the long is closed due to stoploss and only opens a short position?

    Buy: EMA(Close,7)>EMA(Close,14) Sell: EMA(Close,7)<EMA(Close,14)

    Buy exit: 0 Sell exit: 0

  64. Umesh23 says:

    Am not gettin the option of “Back Testing” and “Live” for script
    is there any charges for that?

    • Hanan says:

      Hi Umesh:

      To get the option of Backtest and Live, please make sure you have the following:
      1. Make sure you’re using version 1.6.0.0 of Nest Plus. To check your version, please press Ctrl + Shift + P on your trading terminal. If you don’t have 1.6.0.0, you can download it from here and install it on C:\Program FilesOmnesysNest3
      2. If you have the right version, cross check and see if you are viewing it for Commodity. Please note that algoZ doesn’t work on commodities.
      3. Do make sure that your login name on Nest Plus is the same as your client ID. To know the name you’ve logged in on Nest Plus with, go to Nest Plus > My Nest Plus Account > Plus Dashboard. In this new window, check if the name shown on top is your client ID. If yes, everything is fine. If no, please log out of plus and then log out of the terminal and log back in using the “Launch Plus” button. This should fix your issue.

      If you’re still having problems, please call our support center on 080-40402020

    • pvr says:

      Hi team,

      I tried all options that you suggested and it never worked. I also raised a request for more than a week now and no solution provided till date. Can you please help.
      my id is dp0718.

    • Hanan says:

      We’re gonna have a look at this and get back to you at the earliest. As far as we can see, your account (and every other Zerodha client) is enabled on algoZ automatically.

    • pvr says:

      Thanks Zerodha for your quick action and resolution. Its all working now.

  65. myram says:

    Is there a place where i can lookup/browse all the keywords that I can use? Is there an official manual or like for Algoz ?Say for example I want to know how to refer to the last traded price (LTP does not work).

    Also can i use intermediate variables that link the four expressions (buy alert, buy exit, sell alert and sell exit), i.e. how do I do something this :
    buy when ltp = v1 and set c = ltp
    stop buying when ltp < function_1_of_c

    start selling when ltp > function_2_of_c
    stop selling when ltp < function_3_of_c

    here function_*_of_c are mathematical functions of c

    • Hanan says:

      Ram, we have a manual which can give you answers for all these questions. Check out the manual here. This has information on what are the common expressions that can be used and also gives you sample calculations. To understand the manual, though, you need to have some knowledge about basic coding.

    • myram says:

      @user-manual Thanks

      @creating intermediate expressions: (whoever who come here looking for it)
      SET A=1
      SET B=2

  66. TKumar says:

    Hi,

    To get the dealer terminal, please confirm the following certification is enough.

    NISM-Series-VIII: Equity Derivatives Certification Examination

    The following line is answered by zerodha

    Once you are an AP, you would also need to give us 1 certificate on NISM(derivative markets, dealers module and capital market dealers module).

    I am not able to find the certification on dealers module and capital market dealers module.

    Thanks
    Kumar

    • Hanan says:

      Kumar, there are certifications on all segments of the markets. You should get your certification based on the segment you wish to trade in. If you’d like to trade only F&O, then get yourself only a derivatives certificate. If you wish to trade in the EQ, Derivatives, and Currency segments, then you have to get certificates in all of these segments to be enabled for automatic trading.

  67. Novice says:

    Dear Sir,

    Please give me a simple strategy for the below.

    Stock “A” trades at Rs.50
    I need to purchase “N” numbers of that stock at 51.1 when it crosses Rs.51( like SL-Limit order, NOT Market price)
    Then I have to sell “N” nos of stock “A” at Rs 52.( Like Limit Sell order) IF AND ONLY IF the first order is executed.

    It is important that the Sell order should not execute IF the first BUY order is not executed.( For eg:like the price shoots upto 51.5 by not touching Rs.51.1).

    Pls provide a code for the above.

    • Hanan says:

      This kind of strategy cannot be coded in on algoZ since most or all strategies that are applied on algoZ are in relation to Technical Analysis.
      For your strategy, it would be best for you to simply place a SL-L order to buy above 51.1.
      You can place your Sell order only after your buy order has been executed.

    • Novice says:

      Almost always the price gets shoot up when crossing a resistance level and SL-L order just above the resistance will not get executed.Thats why I wanted to sell at a pre determined price fully automatically depending only on the execution of buy order. Anyway no problem. Thanks.

    • Novice says:

      Almost always the price gets shoot up when crossing a resistance level and SL-L order just above the resistance will not get executed.Thats why I wanted to sell at a pre determined price fully automatically depending only on the execution of buy order. Anyway no problem. Thanks.

  68. GIREESHBABU says:

    SIR ,

    I WANT TO CODE THE BELOW SYSTEM :-

    INTRADAY SYSTEM – 1

    TURNING POINT = (Previous Close+Open+ATP)/3

    BUY – IF 5 MINUTE TIME FRAME CANDLE CLOSE ABOVE TURNING POINT , THEN PLACE BUY ORDER JUST ABOVE THE LAST 5 MINUTE CANDLE HIGH .

    EXIT – JUST BELOW LAST 30 MINUTES LOW .

    SELL – IF 5 MINUTE TIME FRAME CANDLE CLOSE BELOW TURNING POINT , THEN PLACE SELL ORDER JUST BELOW THE LAST 5 MINUTE CANDLE LOW.

    EXIT – JUST ABOVE LAST 30 MINUTES HIGH .

    INTRADAY SYSTEM – 2

    BUY – IF 5 MINUTE TIME FRAME CANDLE CLOSE ABOVE PIVOT POINT . THEN PLACE BUY ORDER JUST ABOVE THE LAST 5 MINUTES CANDLE HIGH .

    EXIT – IF 5 MINUTE CANDLE CLOSE BELOW LAST SUPPORT LEVEL.

    SELL – IF 5 MINUTE TIME FRAME CANDLE CLOSE BELOW PIVOT POINT . HEN PLACE SELL ORDER JUST BELOW THE LAST 5 MINUTE CANDLE LOW.

    EXIT – IF 5 MINUTE CANDLE CLOSE ABOVE LAST RESISTANCE LEVEL.

    THANKS IN ADVANCE

    • Hanan says:

      We don’t have ATP as a vector in our system so this won’t be possible.

      SELL – IF 5 MINUTE TIME FRAME CANDLE CLOSE BELOW TURNING POINT , THEN PLACE SELL ORDER JUST BELOW THE LAST 5 MINUTE CANDLE LOW.

      We don’t have ATP as a vector in our system so this won’t be possible.
      EXIT – JUST ABOVE LAST 30 MINUTES HIGH .Does not support multiple time frames, so if buy is on 5 minute, exit will also work on 5 minutes. For exit to work on 30 minutes, buy/ sell should also be 30 minutes.

      INTRADAY SYSTEM – 2

      BUY – IF 5 MINUTE TIME FRAME CANDLE CLOSE ABOVE PIVOT POINT . THEN PLACE BUY ORDER JUST ABOVE THE LAST 5 MINUTES CANDLE HIGH

      EXIT – IF 5 MINUTE CANDLE CLOSE BELOW LAST SUPPORT LEVEL.

      SELL – IF 5 MINUTE TIME FRAME CANDLE CLOSE BELOW PIVOT POINT . HEN PLACE SELL ORDER JUST BELOW THE LAST 5 MINUTE CANDLE LOW.

      EXIT – IF 5 MINUTE CANDLE CLOSE ABOVE LAST RESISTANCE LEVEL.

      Pivot/ support/ resistance are usually calculated based on daily data, whereas the strategy will be applied on 5 minutes, so this is not possible currently.

  69. Varesh says:

    Hi Zerodha,

    I am getting below error while trying to back test the strategy as mentioned below. Could you please help me on this quickly.

    I have NIFTY30OCT5800CE chart for 30 mins interval where I have added Directional Movement System for 14 period and MACD (26,13,9) to back test this strategy.

    Buy Expression:

    CLOSE > REF(HIGH,1) AND ADX(14) > 25 AND REF(ADX(14),1) < 25 AND MACD(26,12,9,EXPONENTIAL) > 0 AND CLOSE < REF(CLOSE,-1) AND REF(CLOSE,-1) < REF(CLOSE,-2)
    AND REF(CLOSE,-2) < REF(CLOSE,-3)
    Buy exit: 0
    Sell Expression:
    CLOSE < REF(LOW,1) AND ADX(14) > 25 AND REF(ADX(14),1) < 25 AND MACD(26,12,9,EXPONENTIAL) < 0 AND CLOSE > REF(CLOSE,-1) AND REF(CLOSE,-1) > REF(CLOSE,-2)
    AND REF(CLOSE,-2) > REF(CLOSE,-3)
    Sell exit: 0

    Error:

    Backtest ScriptError : Error: Scripts Generated No Trades.
    Please look in above error and advise me accordingly.

    Thanks.

    • Hanan says:

      Varesh, what we’d like to know is was the condition getting satisfied anytime in the backtest data? Could you pleas reduce your time frame from 30 minutes to just 1 minute or 5 minutes and check and let us know?

    • Varesh says:

      Hi,

      I have tried this strategy in all the time frames however giving the same error. Could you please let me if there is anything wrong in the strategy coded ?

    • Hanan says:

      As far as we can tell, there’s nothing wrong with the strategy. Why don’t you try this strategy on Nifty Futures with 1-minute time frames? Nifty is the most traded scrip in India, and any good strategy will definitely produce results in a decent time frame. If you’re still not getting any results there could be something wrong with your strategy.

    • Varesh says:

      Hi,

      I have tried this strategy to Nifty Oct Future with 1 min time frame however still getting the same error, could you please help on this.

    • Hanan says:

      If you’ve tried this on a 1-minute time frame and you’re still not getting a signal even for Nifty, then there’s something definitely wrong with your strategy.
      Please call our office and ask for Sumanth/Hari so they can help you out.

  70. siddesh93 says:

    hi zerodha
    is it possible to see cnx nifty chart live in my nest terminal software

  71. Harshvardhan says:

    Hello,
    I have amibroker and afl in it which generates buy and sell signals.
    I want to automatically place buy/sell orders when every they are generated in amibroker afl.
    I want this to be fully automated.
    Also I want to cancel order if it wasn’t executed for some time.
    Can you share your API so that I can do this? and how much will it cost ?

    • Nithin Kamath says:

      Harsh,

      For this to be fully automated you will need to have NISM certification, be an authorized person at NSE and also get exchange approvals for your strategy.

      Semi automation is already available, check this blog

  72. Dk0046 says:

    Hi Zerodha,
    Do I have to go live a script/strategy every time I invoke ZT? Why can’t it be just there till canceled?
    Thx

  73. Asifta says:

    Pls Tell the code for below

    Buy : if 5min candle closes above 13SMA(high) and RSI > 60.
    Buy Exit: when 5EMA(close) crosses 8EMA(close) and RSI <40.
    StopLoss: Or if Candle closes below 7EMA(close)
    (Also pls tell if we want to exit on 2 points automatically after buy entry )

    • Nithin Kamath says:

      Buy : if 5min candle closes above 13SMA(high) and RSI > 60.

      Close>SMA(High,13) AND RSI(Close,14)>60

      Buy Exit: when 5EMA(close) crosses 8EMA(close) and RSI <40.

      EMA(Close,5)>EMA(Close,8) AND RSI(Close,14)<40

      StopLoss: Or if Candle closes below 7EMA(close)
      (Also pls tell if we want to exit on 2 points automatically after buy entry )

      Stop loss cannot be entered as a strategy, you can enter the trigger in terms of % as shown above.

      You cannot have a strategy like exit 2 points after buy entry, because the buy entry price is not captured.

  74. Dk0046 says:

    Hello,
    What’s the difference between the following expressions:
    1. (RSI(CLOSE,21) >60 AND EMA(CLOSE,3) > CLOSE)
    2. RSI(CLOSE,21) >60 AND EMA(CLOSE,3) > CLOSE

    2 is’t in parentheses but logically its the same, however I see different results in back testing when I use this in sell expression. Why?
    Regards

  75. Dk0046 says:

    Hello,
    What’s the difference between the following expressions:
    1. (RSI(CLOSE,21) >60 AND EMA(CLOSE,3) > CLOSE)
    2. RSI(CLOSE,21) >60 AND EMA(CLOSE,3) > CLOSE

    #2 is’t in parentheses but logically its the same, however I see different results in back testing when I use this in sell expression. Why?
    Regards

  76. Dk0046 says:

    Hello, I can see a few trades when I put the historical data for 1 yr..
    Also, I am just writing simple script for 20EMA.
    Buy expression is:
    (CLOSE > EMA(CLOSE,20))
    Buy Exit expression is:
    (CLOSE < EMA(CLOSE,20)) Sell expression is: (CLOSE < EMA(CLOSE,20)) Sell Exit expression is: (CLOSE > EMA(CLOSE,20))

    So I should see say buy entry and then buy exit and at the same price sell entry and so on.. However, I am seeing exit only on a couple of places.. what wrong.. I should have only one position at a time as per the coding which is buy when Price is > 20EMA and exit when < 20EMA and short at the same price.. but back test doesn't show this pattern..

    • Nithin Kamath says:

      DK,

      The reason you are not seeing any trades is because Your buy and sell exit is the same and sell and buy exit is the same. It has to be different, only then will a trade arise.

      Keep your buy exit and sell exit as 0, you would be then buying on crossover and selling on crossover..

      Many examples of crossovers given on this blog.

  77. Dk0046 says:

    I don’t see Live or Test button under my strategy, I only see Edit button. Let me know. Thanks

  78. NARAYAN says:

    Can A strategy be written based on divergence detection?

    • Nithin Kamath says:

      Can you give an example of what exactly you are talking about.

    • NARAYAN says:

      I want such a Trading setup which will enable me the following:

      When RSI > 60, if there is any single candle bearish divergence, go short below the lowest close of the two candles with a stoploss above the highest high of the two candles.

      and vice versa.

      if possible, please let me know.
      I’m having very less knowledge in this regard, so excuse me for my question.

  79. Tharun says:

    Hello,
    I’m having a AFL code, how can i use it in the NEST PLUS

    • Nithin Kamath says:

      You will have to write it down on algoZ, check out the code your strategy tutorial. algoZ can’t presently handle complex strategies.

  80. RAJMCX says:

    Sir I am using ADX (60) as my tool, I wish to have an algo for it
    when ” di + ” line crosses above ” di – ” BUY profit should be booked manually
    ” di – ” line crosses above ” di + ” SELL (short) profit should be booked manually

    And I wish to know is it possible to change the colours of Directional movement system
    di+ and di- line in nest plus chart.

    • Nithin Kamath says:

      Raj,

      Buy expression: DIP (14) > DIN (14)

      Sell expression: DIP (14) < DIN (14)

      The color of ADX line can be changed but not the di+ and di- for now.

      Cheers,

    • RAJMCX says:

      thank you, I am using ADX (60) as my tool. I should change the value of (14) as (60) am i correct….!

    • Nithin Kamath says:

      Sorry ! yes, change 14 to 60..

  81. HRMJRIO2011 says:

    Sir, waiting for algoZ mobile. version ……

  82. O.P.Vyas says:

    Sir,

    Can we use algoZ on Android based Phones/Tablets with 3G connection for our trading.

  83. dineshAI says:

    on mobile do you provide support for android? I have android 2.3.6 ( samsung duos) will that be sufficient?

  84. dineshAI says:

    HI
    Thanks for reply. Please find my detailed setup.
    Setup : I have developed a C application which process EOD and IEOD of past several years. Then it takes live OHLC data of same script
    say NIFTY Spot and once NIFTY spot reaches a certain prices application tells me to buy or sell.

    now i have below requirement. Please tell me which one you can provide, and in what shape and what will be the charges associated for each service.
    Requirements
    1. How can you provede OHLC data of at least 2 scripts (FNO) to my c application data all day long with out my internention.
    2. My application runs on Spot price but i can only trade in FUTURE. so can this be automated like when spot reaches at a price future is automatically
    executed at market price.
    3. suppose execution may not be fully automated as i am not a certified broker. but suppose i manually put a trade then can i change its stop loss automatically
    using some API, script or any other automated way.
    4. Do you provide any mobile plateform based solution ( android, Windows phone ) on which i can execute the trade.
    5. Do you provide normal web based trading portal ( not Nestplus or now as these wont work through my office proxy) for simple trading and putting order and later modifying or canceling them.
    6. Can you guys or any of your partner provide me IEOD for last 15 years for FUTRES ( not spot). what is the cost?

    My Limitation.
    1. I donot use Amibroker.
    2. My processing application runs form my home a proxy free environment but now one will be there to do any thing totally automated. but can send me signals via mails.
    but trades or any change in order i will have to do mostely from my office ( which has proxy)
    3. I am not certified broker so fully automated might not be a possiblity for me.

    Nice to have :
    1. If my application shoots a mail to you guys for a change in stop loss can you guys do it immediately.
    2. Do you guys provide sms alert if say nifty crosses at particular price.

    Please answer line by line.
    Thanks and Regards,
    Dinesh Kuamr Sen

    • Nithin Kamath says:

      Dinesh,

      We can share with you an API to fetch data to your c application.

      Automated trade execution will require dealer terminal and being registered as an AP, since you are not interested, it will not be possible to do any automation without it.

      Yes we provide, mobile and web along with our software based platform.

      You can speak to globaldatafeeds.com and ask them for this, you could refer that you are a Zerodha client. NSE also sends data directly, you can visit the NSE website for this.

      Executing a trade via an email won’t be possible and presently we don’t have the feature to provide an SMS alert when nifty crosses a particular price.

      Hopefully this helps,
      Cheers,

  85. dineshAI says:

    Hi I have my own c application which process the data and signal me to buy or sell.
    Now i have three querries

    1. How can i get the live tick by tick data in form of open, high, low and close format, or any other format from which i can write a small function to make it compatible to my application.

    2. I do not want to use ami broker i want to use my own application to trigger buy and sell is it possible? if yes then how.

    3. How zerodha can help me in above.

    Thanks in advance
    Dinesh

    • Nithin Kamath says:

      Dinesh,

      We can share API’s for this, we have an API for C application which you can use for this.

      But can you let me know if you want this for automating your trades from the C application or just triggering the orders onto the trading frontend?

  86. srinivas85 says:

    Hi,

    is The script writing code work till end of that particular stock(more than one day and it’s not for intraday) or within the same day?

    Do we need to place script code everyday ?

    • Nithin Kamath says:

      Srinivas,

      Once you write a script and save, you will have to every day run this script live( you actually will have to run it once again, everytime you logout and login).

    • srinivas85 says:

      How to write script for one strategy?

      Can you plz help me to write the script.

      Regards,
      S Srinivasa Rao.

    • Nithin Kamath says:

      Srinivas,

      Look at the blog above, it shows with a simple example. You just have to follow the same steps..

      You can also check this one: http://www.zerodha.com/z-connect/blog/view/managing-your-script

    • srinivas85 says:

      Initially I will buy 1lot at current trading price and if it is going up then it is fine else if it is going down below one point then sell 2lots(i.e.one is for covering and another one is fresh order).
      After sell order is executed,if it is going up one point then I will place buy 2 lots and this process will repeat till end of the day.

      How to mention the quantity of both buy and sell orders while placing the script.

      Buy Alert Expression: CLOSE > 5808(i.e. currently trading price at that time)
      Buy Exit Alert Expression: 0
      Sell Alert Expression: CLOSE < 5807(i.e. currently trading price at that time
      Sell Exit Alert Expression: 0
      As I am new to scripting,please tell me detailed steps including placing script,backtesting and live .

      Thanks in advance

    • Nithin Kamath says:

      Srinivas,

      You cannot really write a strategy this way. A strategy is typically a technical analysis strategy where if a condition is met you take a buy and sell..

      In your case, you have just mentioned a price and for what you are planning to do , algoZ will be of no help.

      How to take a strategy live, backtest and take live is shown in the blogs above. The most important thing is for you to have a strategy.

      Check this blog where we have explained how to write codes for various strategies, you will get an idea of what I am talking about.

    • srinivas85 says:

      When I placed strategy using scripting,It always asking ‘act on alert’.

      When I clicked act on alert button,the price is moving to high.

      is there any option to avoid act on alert and squarred off whenever that price is reached?

      When I placed stop loss order while placing the script and this script is still active but not triggered even though price is reached that point.

      Please give me the solution to above problem.

      Please explain the option of Evaluate as tick in the scripting order.

      If possible,plz explain all the options in scripting order

    • Nithin Kamath says:

      Srinivas, didn’t get your question completely,

      when you click, act on alert the order will be placed as you had desired.

      If you have placed a stop loss preference on alert preference, SL order will be placed. If it hasn’t placed, can you send that snapshot with your client id. We will double check this.

      Evaluate as tick is to define whether order placement should happen on candle completion (which will happen if evaluate as tick is ticked).

      The various options:

      1. 2. 3. 1. 2. 3. 4. 5.
      Pick
      This field is applicable if the checkbox for Place from Signal Price is ticked. The user must define whether the limit price should be picked from the close, open, high or low price of that interval.
      Evaluate as Tick
      If the checkbox for Evaluate as Tick is ticked, the algo will evaluate the script at every tick, and place orders, whenever its condition is satisfied at that tick, instead of waiting for the interval to complete. The algo will place only one order, per interval, in either case, that is, either with evaluate as tick or without evaluate as tick.
      Price Offset
      The user can enter a price offset to make the orders more active.
      Stop Loss Order – Trigger Price %
      The user can enter a stop loss trigger percentage for the algorithm to place a stop loss order along with the buy (long) or sell (short) order.
      Submit
      When the user clicks on Submit, the algo will start evaluating the script, or pause its execution until the Start Time is breached.
      Cancel
      The Alert Preference window will get closed.

    • srinivas85 says:

      Thank you very much sir….

      I want to automate trading using scripts.
      Without my presence,it should triggered and executed.
      Every time I am getting alert signal,I do not want to get that alert signal and it should place automatically whenever that price is reached.

      Which option I need to set to trigger automatically..

      Awaiting your response…

    • Nithin Kamath says:

      Srinivas,

      To completely automate you will need a dealer terminal. Exchanges don’t allow completely automated platform on a retail terminal.

      To get a dealer terminal, you will need to become an authorized person with us and also clear the NISM certification exams. There will be a one time cost to register as an Authorized person and a rental for dealer terminal of Rs 250/segment/exchange

  87. basu says:

    hI zERODHA,

    pLEASE pROVIDE mE aN eXPRESSION, fOR tHE bELOW lOGIC,

    iF A sTOCK lOW fOR tHE dAY iS (101) aND iS aBOVE yESTERDAY’S hIGH(100) , bUY eXPRESSION hAS tO BE mADE wITH sTOP lOSS oF yESTERDAY’S hIGH.

    iF a sTOCK hIGH fOR tHE dAY iS (100) aND iS bELOW yESTERDAY’S lOW (101) , sELL eXPRESSION hAS tO bE mADE wITH sTOP lOSS oF yESTERDAYS lOW.

    tHANKS iN aDVANCE

    • Nithin Kamath says:

      Buy: DLOW (1) > DHIGH (2)

      Sell: DHIGH (1) < DLOW (2)

      Stop loss as yesterday’s day high or low is not possible but in alert preference window you can put a stoploss %.

  88. Sreejith says:

    sir,
    algoz is works on mcx????????

  89. chandeshwar says:

    Dear Sir,
    Whether “end of day” has ended or not ? Whenever I have asked zerodha office to enable my algoZ, they said it will be enabled today “end of day”. However, I am not criticising anyone, may be that there is some fault either in my computer or from the side of zerodha. I request the zerodha officials to enable the algo trading on my terminal DC0156.
    I am facing the same problem as said above by “thavva” on April 29 in this section. Same is the chart position with me. I have downloaded the latest version 1.5.1.0. I have written to “Omnesys” also, but of no use, kindly see and resolve my problem. I have sent the log message of one day to Zerodha office in which it has been shown that about …….algo that “error_No data. The slides sent on my mail shows that the “nest Pulse Dealer” must be unlocked, that is no unlocked on my terminal. If that is not an issue then ………..?…………………kindly resolve.
    Thanks.

  90. Devendra says:

    Dear Zerodha,

    Not getting Historical charts in Nest Plus Charts
    for algoZ

    ID : DD0314
    Devendra

    • Nithin Kamath says:

      You need to first open the plus chart , Shift + P and in this chart right click and say historical, should work. You will get a daily chart…

  91. Devendra says:

    I have a strategy
    of EMA 8 and 13 Crossover
    on 10 min chart
    which (on an avg) gives 1 OR 2 trades a day
    i.e. 2-3 buy AND sell signals
    When Backtested it plots arrows at right places

    But When I set it live,
    on 10 min interval
    and keep watching 10 min chart of nest plus

    unnecessary alerts are shown
    instead of 8-9 alerts 20-30 Alerts pop up

    How to avoid this ?
    Is it a Bug in algoZ

    This happens for any strategy !

    Pl. Guide

    Devendra

    • Nithin Kamath says:

      Devendra,

      This ideally shouldn’t be happening, Can you unregister and register the NESTPulse.dll file and and check. ?

      You can send us an email to [email protected] if you are facing issues..

      • Kunal says:

        Hi Nitin,

        I tried the processing of registering and unregistering a dll but it didnt work for me still. Also, Zerodha Support put me in touch with Omnesys – but not getting any reply from his end.

        Could you please assist as I would love to use algoZ ?

        Kunal

        • Kunal,

          We are launching our own front end which can do advanced backtesting, but until then we will have to rely on the Omnesys team. We might release our front end by end of April. I will get someone to get in touch and see what can be done for now.

          Cheers,

  92. suryakant says:

    On zerodha-Traders,

    1) Market watch of any script, Intraday chart of any candle not showing its position Keeping the cursor(e,g.Time,Open, High,Low, Close) except LTP.

    2)Trade Position is not showing, after Logout and then Logion, zerodha-Trader.

    3)At present on REPORT was active but now it was disabled. Please Make it Active. for details.

    • Nithin Kamath says:

      Surya,

      If you logout and log back you will have to rerun all the scripts, by trade position if you mean admin position, use CTrl+P and then go to general and click reconcile, should work.

      What do you mean by on Report?

  93. Faisal says:

    Zerodha,
    In backtest trade report it is saying net profit 500.
    so in case of nifty this will be 500 x 50 =25000 rupees right?

    • Nithin Kamath says:

      Yes Faisal, 500 would mean a gross profit of 25000 if you traded 1 lot o nifty futures.

  94. Faisal says:

    Zerodha,

    How do I know after clicking ‘My strategy’ live whether I am activated on that. Is there any indication saying your strategy are live now.

    Regards,
    Faisal

  95. Faisal says:

    Zerodha,

    In the step 9 – Going live, there is a dialogue box called “set interval”.
    As I would like to trade on daily time frame, what interval period I have to give there??

    Thanks in advance
    Faisal

    • Nithin Kamath says:

      If you are looking at trading on daily time frame, you cannot take it live. The reason for this is that the signal will be generated only end of the day and not during market hours.

      What you can do is, run a backtest at the end of the day and if a signal is generated execute the trade manually next day.

    • Dk0046 says:

      Hello Zerodha, can’t some one put the interval 375 minutes here which is equivalent to 1 day of trading and be still live and mirroring the day?

    • Nithin Kamath says:

      Yes you can!!

  96. Devendra says:

    Zerodha, I am waiting for 4 Days to
    get answer to my queries. Pl. Help !
    ———————————————–

    Thanks a lot to Zerodha for algoZ

    How can I write Buy Expression when :

    ADX (14) > 10 AND +DI > 20

    Sell When

    ADX (14) > 10 AND -DI > 20
    —————————————-
    My other Strategy is :

    Buy when Price closes above Bollinger Band middle or centre
    Buy Exit when when Price closes above Bollinger Band top

    Sell when Price closes below Bollinger Band middle or centre
    Sell Exit when when Price closes below Bollinger Band bottom

    Pl. provide Code for above 2 Strategies [ADX and BB]

    Thanks in Advance
    Devendra

    • Nithin Kamath says:

      Sorry Devendra for the delay,

      1st STrategy on ADX
      Your expression is almost correct 🙂 ,

      Buy: ADX(14) > 10 AND DIP(14) > 20

      Buy exit: 0

      Sell: ADX(14) > 10 AND DIN (14) > 20

      Sell exit: 0

      2nd Strategy on Bollinger bands:

      Buy: CLOSE > BBM (CLOSE, 20, 2, EXPONENTIAL)

      Buy exit: CLOSE > BBT (CLOSE, 20, 2, EXPONENTIAL)

      Sell: CLOSE < BBM (CLOSE, 20, 2, EXPONENTIAL)

      Sell exit: CLOSE < BBB (CLOSE, 20, 2, EXPONENTIAL)

  97. chandeshwar says:

    Till today Nest Pulse Dealer could not be unlocked.
    DC0156

    • Nithin Kamath says:

      Chandeshwar, PULSE dealer is allowed only for dealing terminals, which means you have to be an authorized person/sub-broker for us.

      algoZ is enabled for all our clients, guess you must be using an older version of our platform. Will get someone to call you back by monday morning.

  98. chandeshwar says:

    Dear Sir,
    Since the date of announcement of algoZ, I am in continuous contact with Zerodha office but till today the algoZ could not be activated on my terminal DC0156. On Plus dashboard the “Pulse Dealer” is locked. Only “Edit” option is showing, no option of “backtest”. Daily I am sending at least one mail to Zerodha office [email protected]. They are also trying their best but it could not be activated till date. Where I have to uninstall the Zerodha Trader and re-install again or there is other difficulty. I am using Window7 and Window Vista Business on two separate computers. Kindly help

    • Hanan says:

      We’ve just now coordinated with Omnesys and your account will be enabled on algoZ/Pulse by end of day if it isn’t already enabled. To know if you’re enabled or not, please go to Nest Plus < My Plus Account < Plus Dashboard. When this new page opens, please check if you are enabled on Nest Pulse Dealer.

  99. Devendra says:

    Thanks a lot for aloZ

    How can I write code for
    Buy = ADX (14) > 10 AND +DI > 20

    Pl. Guide

  100. Nidin says:

    Hi, I write and backtest the strategy. But on clicking Live menu, ZTrader hangs. Any sugestion. I use Windows 7.

    Thanks,
    Nidin

  101. thavva says:

    For back test i was not gettign an option on intraday chart for SBIN. My chat is For back test i was not getting an option on intraday chart for SBIN. My chart is on period 30 min. any reason?

  102. Arunjn30 says:

    Thank you for this initiative Zerodha,
    My question is I had set the Live stretergy thing in the morning but after 10AM i cant see any option next to My Stratrgey only EDIT option is available currently

    to set the alert do i have to open each script in Plus chart and manually set alert for each stock or script seperatly or is the same formula is set automatically for all the scripts or stocks in my market watch window

    for example i have 4 stock listed in Market watch for EMA crossover and set alert for only one stock using plus chart then the same alert is set for all the stocks automatically or do i need to open each 4 stocks seperatly and set alert for each stock

    Thank you once again for your initiative to make trading a good experience.

    regards
    Arun

    • Nithin Kamath says:

      Arjun,

      If you are enabled ideally it should give you a live option. If you logout and log back in to the trading platform, you will have to apply the strategy again. Live option is still not available for commodities.

      Once you write a script, you will have to individually open the chart for the stock and take live using the same script.

  103. sudarshanagni says:

    Hello zerodha.

    How can write strategy for different time frame . Suppose i want to write following strategy for 5 min candles.
    Also i want use Fibonacci retracement condition for ex buy IF close>38% level
    Buy;
    close>ema(close,110)&CCI(simple,14)>100

    Sell:
    close<ema(close,110)&CCI(simple,14)=-100<CCI(simple,14)<-500 (Is this CCI exp is correct. I want to only sell when CCI is greater than -100 for ex -110,-120)

    Where i can write Stop loss for buying and selling
    for buy close<EMA(Close,3)
    for sell close>EMA(close,3)
    Eagerly waiting for your valuable guidance.

    • Nithin Kamath says:

      Sudarshan, on algoZ we cannot write strategies for different time frames. Strategies are independent of time frame and can be applied on any time frame.

      Your expressions are pretty much correct, except for small things.

      Buy: CLOSE > EMA(CLOSE,110) AND CCI(14, SIMPLE) > 100

      Sell: CLOSE < EMA (CLOSE,110) AND CCI(14, SIMPLE) < -100

      Buy Exit: CLOSE<EMA(CLOSE,3)

      Sell Exit: CLOSE>EMA(CLOSE,3)

      Sorry about the delay in responding.

    • sudarshanagni says:

      Thanks for ur valuable advice Sir..
      1.Where i can apply this strategy on 5 min chart or diffrent timeframes.
      2.Also when i take any strategy on LIVE my software is crushed .Its happening from beggining only.
      3.How i can write that after i buy if price goes 10% it should be sold.same for sell.
      Eagerly waiting for ur reply as software is getting crushed when i am taking it on live mode

    • Nithin Kamath says:

      Sudarshan,

      Check this blog: http://www.zerodha.com/z-connect/blog/view/managing-your-script , you can apply a time frame just before you go live on alert preferences.

      If it is crashing, send an email to [email protected] with this query.

      By 10% if you mean a Stop loss it can be placed as explained in the blog above in alert preferences. But do note that all stop loss positions are removed from the system by the exchanges at the end of every day. You will have to manually place it if you are holding a position overnight on a daily basis.

      Cheers,

    • sudarshanagni says:

      Thanks..
      1.Sir by 10% means target .for ex i brought nifty call for 50Rs so i want to sell it 10% above means at 55Rs. 10% above of my actual buy price. means 10% profits.
      How i can write code for this.
      Regards

    • sudarshanagni says:

      Thanks..
      1.Sir by 10% means target .for ex i brought nifty call for 50Rs so i want to sell it 10% above means at 55Rs. 10% above of my actual buy price. means 10% profits.
      How i can write code for this.
      Regards

    • Nithin Kamath says:

      Sudarshan,

      You cannot have a strategy written presently saying sell above 10%, the sell also has to be a technical analysis strategy..

      Cheers.

  104. Sourabh says:

    Hi Zerodha,

    I want to activate fully automated trading.

    Please let me know the steps.

    Thanks,
    Sourabh.

    • Nithin Kamath says:

      Sourabh, for fully automated trading you would need a dealer terminal which would require you to get associated as an Authorized person with us.

      Once you are an AP, you would also need to give us 1 certificate on NISM(derivative markets, dealers module and capital market dealers module).

      Send an email to [email protected], someone will call you back on this.

  105. kasi says:

    Thank you for your new service. I would like to inform you that, Nifty Spot chart can not open in Nest plus. Please consider this issue and please update.

    • Nithin Kamath says:

      Kasi,

      This option is presently not available as Nifty can’t be added onto the marketwatch. But what you can do is add any NIFTY BEES onto the marketwatch and look at the chart, this will mirror the actual nifty performance.

  106. zerona says:

    Thanks Zerodha guys !
    Atlast we latest technolgies for trading that are available only in western countries. A few queries… what are the charges for coding our trading strategy into the Nest trader? Do you have any strategy where we can subscribe or use? Do you have separate plans for intraday and longterm trades?

    thanks

    Zerona

    • Nithin Kamath says:

      If you look at this blog, you will see that we are already coding strategies and for free. 🙂

      As long as it is not a complex strategy it will be done for you free of cost.

      We will soon share with you a database of strategies where the probability of success is pretty high based on the backtested results. We will eventually also have a marketplace for strategies where people can buy/sell backtested strategies from each other.

      Cheers,

    • atulshar946 says:

      Hi,
      can you help me to put StochRSI parameter as its not available in the drop down list

    • Nithin Kamath says:

      @Atul, if the parameter is not available in the dropdown, we cannot unfortunately add it. But I can check if the formulae is available for the same and let you know.

  107. Sandip_Chougale says:

    Congratulations… for this new initiative & all the Best for Beta release. Thank you too…
    I request you to add Customize time interval tool in charts. As I am using 3 minute charts for Entry & Exit. But 3 min. is not available in charts.
    Thanks in advance.

    • Nithin Kamath says:

      Sandip,

      It is possible to look at a 3 min chart, right click on the chart you get an option called interval, click on configure and choose the number of minutes and click on set interval, it becomes a 3 min chart.

      On algoZ, when you are taking the strategy live, you get an option to choose the interval in alert preference.

      Cheers

    • Sandip_Chougale says:

      Dear Sir,

      As per your msg. i have checked the “Configure” option in charts interval option. but there is no such option available for setting time interval as 3 min. Check below snap of the same.

    • Nithin Kamath says:

      Sandip, you are initiating the chart by right clicking, this is not the way to initiate a plus chart.

      Click on this Blog to know how to initiate the plus chart , you can use the shortcut key shift+p

  108. Sridhar says:

    I could not see backtesting and live options under MyStrategy –> EMA menu. I see only Edit.

  109. RainMaker says:

    Congrats ! for the new initiative.

    To start with, I would request you to post few intraday strategies which are time tested / are used by experienced traders, and are not complex, for the ppl who are not so well versed in coding.

    So that one can see the benifit of the coding and get some interest in learning the same, to tweak existing program or write a program as per his needs.

    • Nithin Kamath says:

      On the lines rainmaker, if you look at the other blog we are already doing this. The next job would be to index all of this, so even a person with 0 knowledge can become atleast an intermediate coder in a few months.

  110. rajesh says:

    when i try to backtesting option i dn’t see any option

  111. NEHAL says:

    I’m not able to make strategy for EMA(CLOSE,20)>EMA(OPEN,40). It gives me an error that make a valid expression. Please help me. Thanks in advance.

    • Nithin Kamath says:

      Nehal this should work, make sure all your expression windows have a figure.

      So ideally:

      Buy : EMA(CLOSE,20)>EMA(OPEN,40) Sell: EMA(Close,20)<EMA(OPEN,40)
      Buy exit: 0 Sell exit: 0

      In the exit expression you haven’t mentioned a 0, you will get an error called make a valid expression.

      Cheers,

  112. SURESH says:

    will it work with nest trader also

    • Nithin Kamath says:

      Zerodha Trader and NEST trader that we offer are the same. So yes it will be enabled for you.

      Cheers,

  113. Shrikant says:

    Hi,
    In Step 8, when I try for backtesting, I dont see any such option. All there is in my strategy is the Edit option. Neither is the Live option available.