4

my problem is that I cannot close my open position at the end of a day because I am using the ranko chart pattern. as you know in ranko candle time is not fixed so how can I use IST time in pine script to exit every day at a particular time.

in without Renko chart, i was using this code to exit poison

if (hour==15 and minute==29)
    strategy.close_all("Day Close")
vitruvius
  • 15,740
  • 3
  • 16
  • 26
Kick
  • 43
  • 3

1 Answers1

-2

Run your strategy on standard candlestick chart and request renko information from there. Then you can close positions as you normally would do.

Renko example:

//@version=5
indicator('Example 7', overlay=true)
renko_t = ticker.renko(syminfo.tickerid, 'ATR', 10)
renko_low = request.security(renko_t, timeframe.period, low)
plot(renko_low)
vitruvius
  • 15,740
  • 3
  • 16
  • 26
  • This answer does not answer the question of "close all position at the end of day" – JohnAllen Jan 30 '23 at 07:58
  • @JohnAllen It does in my opinion. You shouldn't be worried about the renko chart if you want to do actions in real time. You should run your strategy on standard candleticks where you will have real and correct time information. Then you close your position however you want to close it. Whether it is end of a session or end of the day. The code he shared is already correct but his mistake is to run this strategy on renko candlestick charts. – vitruvius Jan 30 '23 at 08:18