Kite 3 Plugin for auto trading

That’s a very good workaround to force all algos to exit at 3:15pm on Streak +TR

3 Likes

I think Krishnendu of Zerodha wrote the exit strategy here. We owe him thanks, and a lot.

BTW, Nishant, good to see you here after a long time!! As you can see, I’m still struggling with algos. It’s 7 years now. I hope I can run a full and legal auto system before I die. Kudos SEBI for denying this pleasure so far!!

Thank you Sir @TradeRocket, your efforts are great to human ingenuity…:partying_face: :smiling_face_with_three_hearts:
Excited for your upcoming update that fullfil all the requirements…:sunglasses::sunglasses::sunglasses:

1 Like

I’m using TradeRocket in Amazon AWS and working fine… Huge fan of TR. @TradeRocket @Indrajit_Mukherjee : Thanks a lot, thank you so much for making small Retail traders like us profitable :kissing_heart: :smiling_face_with_three_hearts:
@TradeRocket Man you are awesom :partying_face:
How you have done the same? In which programming language? :slight_smile: just asking because of curiosity :slight_smile:

1 Like

This is a Genius solution :clap: , I never thought of it, now all square off can be automated. I have added it to my strategies , will give it a try tomorrow. Thanks you @Sandip_Chatterjee for sharing it, thank you @Krishnendu as-well.

Yes it should, any queries we are hear, just try to take screenshots if anything rare weird thing happens, will help to address it.

1 Like

Hi @Austin_Devasia,
Anything that runs in browser is mostly built with HTML, CSS and Javascript. For coding in Chrome/Mozilla, little more experience with understanding how browser are built and work is needed, along with a lot of patience.

3 Likes

And a BIG ‘YES’, you have done it :partying_face:

Is it safe to run on cloud everything. I feel anyone can sneak into your session or ?

CORRECTION:

Regarding the exit code, I said for 15 mins tf candles=48. No,it should be 47. 48= exit at 3.30pm, 47=exit at 3.15 pm.

Sorry for the inconvenience if any.

1 Like

After the AWS - TR algo trading today, I have so many things to report.

No, last night I thought it would work but it didn’t and in the process some things/doubts have come to my notice/mind.

a) My steps last night: at about 1.30am,I logged into Kite, followed by Streak (TR was seen active) and made my strategies alive. Then I logged in to AWS by clicking EC2 and checked if the live trading section mirrored my PC. It did.TR was active here too. I closed EC2 by the “X” button, closed both KITE and STREAK in PC (but didn’t “log off”) and shut down.

b) What I found at about 1pm today: I checked with my phone and found many alerts waiting but no trade taken. I now logged in to PC and KIte-Streak and immediately all waiting trades took entry without my doing anything (TR worked I think).

c) Then why didn’t they trigger so long? I logged in to EC2-Kite-Streak under AWS. Yes, I had to log in. So it means the login that I took early this morning was not active anymore. But why???

Now experts,please come up with a solution, or at least let’s get started. I have more posts to follow but they will be related more to Zerodha-Streak.

The exit code (Krishnendu) worked perfectly the last couple of days and even today all exits were taken at 3.15 pm except that of GAIL. I still waited another candle (3.20pm) and it didn’t exit. I now wanted to do this manually but no, it was rejected. I hope I am not deducted Rs. 70/0 for not squaring.

The big question, why won’t the exit code work on a stock while it did on others?

Few experience from my side, it may be helpful.

I experienced that Kite logs you out between 7 AM and 8 AM on every market day. So better to log in kite within AWS after 8 AM so that you remain logged in rest of the day. @siva or others from Zerodha may enlighten on the conditions when kite logged in state across different browsers/machines are made null.

Another is when I logged in streak after 9:15 AM with some live strategy with trade rocket on, it gives erroneous result. For example, I logged in kite & streak + traderocket at 11 AM with live strategy on Reliance. For the given strategy, an entry trade signal was generated at 10 AM and at 11:15 AM stoplosss trade was triggered. Since I logged in at 11AM, my entry trade was left out but streak will generate that stoploss trigger and traderocket will fire trade request. @streak and @TradeRocket is requested to look into this.

Regarding exit condition in streak, I have experienced that putting any condition which calculates MIS trade exit at 3:15 PM or afterwards it will not be executed and the trade will go to zerodha square off mode. It may be because earlier zerodha square off timing was 3:15 PM although now it is 3:20 PM. The relevant code in the streak may not have been updated in this regard. I had raised this issue @streak earlier however no update is available till now. What I do is to put exit condition such that it is fulfilled before 3:15 PM.

If you read my related post above, you’ll agree it was different in my case. I logged in at about 1 am and closed S-K. But the trades were taken all right. Today there was no problem with TR because it did fire though one exit by Streak did not follow code.

For traders who are using the Krisnendu code in exit, it may be necessary to exit one candle earlier first (3.10) and then write a second code to exit on the next candle (3.20 pm) if something is still left out. Crude solution, but I’ll have to use this on Monday if nothing better comes up.

Let me take this opportunity to ask you a question. In algo, are you getting any leverage like that stated in the margin file? I’m getting zero. Same as CNS. In that case trading algo in CNS intra week may be less hazardous or even more profitable.

Isn’t this a crazy idea, algo trading for carry over trades? :slight_smile:

I have not examined it surgically but observed that after entry trade, used margin is not increasing to the extent of trade value. In the order and position window also, it is showing as MIS trade. Can be concluded safely that Zerodha is calculating intraday margin only.

Plz don’t be offended but algo is method of placing order and profit/loss emerges from your strategy. So backtest and deploy any strategy you like. Only limitation with CNC order is that you can’t short sell as entry. You can make entry as CNC Sell only when you have holding and qty can be upto holding. Yes, I do that also but if I am getting profit on the same day, I choose to exit the trade. In this case I keep stoploss very high like 10%. It is kind of trading in holding shares from short side using indicator. Added advantage is automation.

There were lag of 26 seconds for execution for the alerts received at 9:30:22. What happened @TradeRocket :cry:

You have misunderstood my question. No issues, because it silently raises another question which I was planning to ask at some later stage.

But I am extremely satisfied with my strategies. In backtests they show very good profits; in fact too good, but more of it later. In live market also 60-70% of trades return profits. I am in the field for about 7 years now and spent most of the time “eyeballing” the profitability of strategies, if you know what I mean. It has given me some sense of the real - as opposed to unreal - profits. The reason I left MT8 of Mastertrust was because their backtests were showing astronomically high profits and I pointed out one big mistake in logic which they didn’t care to correct. I don’t know if MT8 is still around.

I asked you if you were getting leverages in MIS, which should be automatically added by the broker. If it’s more than 1X, you are at least getting something but the amount should be equal to their margin table published. So a simple Yes or No was appropriate as an answer to my question.

After doing 10s of thousands of backtests in the last 3 months I have now started suspecting the accuracy of Streak’s backtest engine. It may sound preposterous but I do anyway. I would be happy if I’m wrong. Too bad I can’t prove my point by using another backtesting software!

But an experienced Intraday trader will get this:

Does a profit target of 2% a day on an average on all stocks look practical? I don’t think it does. One % is closer to being real. But Streak backtests swear 2% is the best for my strategy. I have watched a number of trades where I could exit with 1% but I ended up in loss. Just too many of them to ignore.

I am drawing attention of the Streak managers in this regard.

In this, login should be done early in the morning I login at 8:45am, I think kite logs out everyone at 7 or 8am.
So in AWS , the kite and streak the session would have expired, so even if notification would have come, order would not have gotten placed.

But Kite didn’t. My trades were all running and waiting for confirmation, as I said, at about 1 pm when I first watched on phone. When I opened computer, trades were fired in TR mode, perfectly.

This I have seen before, this happens when the order is sent, but it took more time to get confirmed by Kite, this is my guess.
Other scenario could something to do with PC on getting the notification fast due to internet.

Hope you still had profitable trades :slight_smile:

1 Like

In AWS, it should have, I am very sure about it.

By this if you mean your strategies were running and waiting for confirmation, then yes, session expiring doesn’t mean your strategy will get stopped, they will keep running.

So when you logged into YOUR computer/PC the new session was put and the trades would have triggered.
But not in AWS.
Just on Monday try login after 8am once and see.