Learn Algo Trading with Python | Codes | Youtube Series

Inline my answers on your Points:-

  1. No issues
  2. Yes
  3. Yes (historical intraday data received as 1 min and converted into 2 min tf)
  4. No issues (BUY/SELL, SL, Target Orders placed successfully)
  5. Trailing SL and Could deployment (New question)
  6. Yes… upgraded to latest codebase
  7. Thanks for your guidance… till now its fantastic journey. I have written my own algo with help of your videos… earlier i was using 3rd party platform to execute chartink alerts, hence reducing monthly expenses as well.

till now all the issues has been resolved and algo is working fine… but i am very enthusiast to know more about trailing SL and auto algo execution on cloud. Hope you will cover this in coming videos…

1 Like

@rahulcse56,

Are you placing orders at market price or limit price as I am facing issues while placing limit order. Is it possible for you to share your BUY/SELL codes only?

Hello @Tradehull_Imran sir

Thanks for tremendous efforts :pray:t2: :pray:t2: :pray:t2:

I had issue with dhanhq 2.0.1 now I uninstall and installed again

DhanHQ-py : v2.0.0

then DhanHQ 2 version update working fine for every file

I will try now

Master Algo Trading with Python | Episode 8: Build Your Second Live Algo

1 Like

Hi @Aijaz_Ahmad
Do check this thread : Learn Algo Trading with Python | Codes | Youtube Series - #847 by Tradehull_Imran

Hi @avinashkumar07412
In case you draw levels manually, below code can be applied for the levels

levels = {
    "level1": 50882.45,
    "level2": 50657.50,
    "level3": 50531.00,
    "level4": 50361.85,
    "level5": 50358.00,
    "level6": 50355.05,
    "level7": 50225.40,
    "level8": 50113.00,
    "level9": 50082.50,
    "level10": 50070.85,
    "level11": 49915.80
}

1 Like

Hello sir,
While getting data I am getting the following error. What is the limit that we can fetch the data.
@Tradehull_Imran

Hi @Kalpeshh_Patel

  1. to change 20ma to 9ma , just change the timeperiod
chart_15 = tsl.get_historical_data(tradingsymbol='NIFTY NOV FUT', exchange='NFO', timeframe="15")
chart_15['ma'] = talib.MA(chart_15['close'], timeperiod=9, matype=0)
  1. get_intraday_data gives data from today 9:15 till current time
    get_historical_data gives data from from 3rd last working day till current time

FYI… all below three orders placed successfully.
image

2 Likes

Hi @Scooby_Doo

It seems the code has breached rate limits
see : Learn Algo Trading with Python | Codes | Youtube Series - #860 by Tradehull_Imran

Hi @Tradehull_Imran,

  1. No issues in Python
  2. Yes, I have seen all your videos
  3. Yes, I am able to extract historical data and also convert it to weekly or monthly
  4. No issues in fetching LTP and not yet tried order placement
  5. Yes, I would like to understand on Backtesting of strategy, can we plot fib retracement, Elliot waves, trend lines, etc using TA-Lib.
  6. I created my own setup for MAC using postgres database.
  7. There is lot more we can do with Algo trading and reduce screen time.
    Follow rules strictly, take the stop loss and many more.
    I am also planning to implement performance review based on my trade log.

Thank you so much for your assistance. With your guidance I am not able to start and think about automating my trading journey.

1 Like

Sir,
I am getting the for VWAP data .

But with below WORNING. Can you please let me know to fix this worning?

C:/Dhan/8. Session8- 2nd Live Algo/8. Session 8 Dhan_Tradehull_V2/vwap strategy.py:42: UserWarning: Converting to PeriodArray/Index representation will drop timezone information.
  ce_index_chart['vwap'] = pta.vwap(ce_index_chart['high'], ce_index_chart['low'], ce_index_chart['close'], ce_index_chart['volume'])

Thanks for sharing.

Hi @Minakshi_Kuila

use below code


import warnings
warnings.filterwarnings("ignore")


1 Like

Hello @Tradehull_Imran,

can we back test our algo on historical data (last 1 year data) ? if possible then please let me know how to do that.

Thanks in advance

@Tradehull_Imran

I don’t know what I am doing wrong,I am using the below code for order placement. I shows it’s a limit order but the order is placed at current market price and not on high of 9:15 candle.

# Check the condition and place the order accordingly
if current_market_price > high_9_15:
    print(f"Buying {first_stock['Ticker']} at market price.")
    buy_entry_orderid = tsl.order_placement(first_stock['Ticker'], 'NSE', 1, 0, 0, 'MARKET', 'BUY', 'MIS')
else:
    print(f"Placing a buy limit order for {first_stock['Ticker']} above the high of 9:15 candle.")
    buy_entry_orderid = tsl.order_placement(first_stock['Ticker'], 'NSE', 1, high_9_15 + 0.05, 0, 'LIMIT', 'BUY', 'MIS')  # Adjust the increment as needed

print(f"Order ID: {buy_entry_orderid}")

this is the output:

image

you can see from the image that order was placed on 682.95 and not on 719.

Request you to please help.

you can place the limit order once you have already placed BUY/SELL order… then only you can place LIMIT order… in your case i think you should place STOPMARKET order.

1 Like

oh okay, even when I am manually trying it to place limit order it is placing limit order but it places the limit order at current price and not at market price.

image

This order I placed was maually and it still got placed at current market price.

Sir, if I receive the LTP of a call and put once per second, does that count under the Order API or Data API? For one hour, this would total 60x60=3600 requests. Also, if I use LTP along with indicators, would that also count under the Data API?

Currently, I’m using a 30-second sleep, but the price moves significantly during that time.
Could you please guide me on how to fetch LTP smoothly without exceeding the rate limit?

Dear Imran Sir,

Thank you so much for teaching us non-coders how to trade in algo like professionals in just a few weeks. Your guidance has not only helped us understand the basics of Python but also empowered us to use tools like ChatGPT to build strategies we had only dreamed of before.

With the solid foundation you’ve provided, we can now confidently experiment and create strategies. However, we still need more of your guidance to transition seamlessly into the live market. Overcoming the emotional fear that has cost us a lot of money in the past is a significant step, and we’re counting on your expertise to help us navigate this.

Thank you once again for inspiring us and making algo trading achievable for everyone!

Best regards,
Zahid Bhatt
Love from Kashmir

2 Likes

@rahulcse56

Thanks man, your suggestion worked perfectly.

2 Likes