Created
June 21, 2022 15:16
-
-
Save ganigithub/020a313eb5e6af7607acc7c09db878a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######################### ENTRY CONDITION ########################## | |
| import datetime | |
| for i in range(10000000): | |
| try: | |
| t = datetime.datetime.now() | |
| ltp = kite.ltp(ticker_symbol)[ticker_symbol]['last_price'] | |
| print('ltp :', ltp) | |
| if ltp > int_high: | |
| order(trading_symbol, 'BUY', quantity, kite) | |
| print(f'High breached. TradeEntry : Long at Rs {ltp}') | |
| break | |
| elif ltp < int_low: | |
| order(trading_symbol, 'SELL', quantity, kite) | |
| print(f'Low breached. Trade Entry : Short at Rs.{ltp}') | |
| break | |
| except BaseException as error: | |
| print(f'{error} Exception occurred') | |
| #exit at 15:25 if neither int_high nor int_low breached | |
| if t.hour == 15 and t.minute == 25: | |
| print('Trade not entered today.') | |
| break | |
| sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment