Older spot price

Hello folks,

Since I am new to coding, I am looking, how to store older spot vaule say 9:30 (nifty price 18320) and I can use that spot value in the second half of the day for reference to execute my another trade.

for the time being I am creating a far otm buy order and storing this value as runtime variable (at 9:30), but this unnecessary order draning profit amount each day and increasing trade counters as well.

I am wodering if there is another way to do the same thing without creating a dummy order.

  1. May Buy and exit immediately at a moment of your choice, say 930.
  2. Set values of the required momentary data in runtime variable(s)
  3. Don’t reset the runtime variables at Exit condition.as their set values are to be recalled at a later time before unversal exit.

Thanks for that, I will try closing at the same instance buy is opened. However, I was wondering if there is posibility of getting a candle refrence like at 9:30, 5 minutes candle OPEN value is taken and I can use this in second half. I understand I can take refernce of -10 or -15 candles but it is not time sepecific. Can you throw some light if candle value is posible on time basis?

Are you taking any entries before 9:30?
If NOT then this may work for you.

  1. In advance settings of the strategy select “start checking conditions after exchange opens” select 15 min.
  2. Assign the spot value to a runtime variable under “Initialise Variables”.
    Initialise variables will executive at 9:30 if setting as mentioned in 1. above is 15 min.

May use the same trick as suggested above. Store the Open value of the candle when time is 930. Later recall the value of the runtime variable in your strategy for second half.