I'm new to writing strategies and have a couple of questions.
1) Let's say I need to access the range of the previous day to set my targets. So I want to enter the order based on some condition intraday with my target set based on previous day's range. So how do I access the previous day's information for my intraday strategy ?
2) Let's say I entered a position today, didn't reach my target and didn't get stopped out. So the next day - do I have to enable the strategy again on the same chart and will it continue from where it left off ? I assume so, but wanted to confirm.
1.) You could use HighD(1) and LowD(1) for example. Or track the extremes yourself with a variable that you reset on the new day.
2.) If you leave the strategy running, this is not a problem at all. Otherwise it should be able to pick up where it left.
Thanks for the reply. I tried that. but here is my problem - I need to access the daily ATR on an intraday chart. So I have a 2 day 1 min chart and if I need to use 10 day daily ATR, I would need to have 10 days worth of 1 min data on there so that I can use HighD, LowD and compute the ATR. Is that correct ? Or some other easier way to do it ?
Using 10 days of 1 min data and HighD, LowD is an easy way. You will have to deal with the ATR calculation, as you need to make sure it uses the correct values for every day. This will need an array or a loop for sure.
Another approach could be to use a second data stream of daily bars on your chart. Then you can calculate the ATR on Data2. This might even be a little easier.