How to use info from daily chart into my 1min system?
Forums › ProRealTime English forum › ProOrder support › How to use info from daily chart into my 1min system?
- This topic has 5 replies, 2 voices, and was last updated 6 years ago by Vonasi.
-
-
10/16/2018 at 7:10 PM #82920
Hi guys,
Hoping you can help me here…
I am building a very simple strategy for market open spikes. The theory of the system is VERY basic, but putting it into code form is not so basic!
Basically, I want to get in if the price spikes over X% of the 5 day ATR in either direction, and the take profit would be the same X% of the 5 day ATR.
Stop would be a break of the opening 1 min candle.
Now there are 2 problems here…
- The 5 day ATR is pulled from the daily chart, so how do I get this info into my 1 min system?
- The daily charts with my broker (IG) run from midnight to midnight, but I only want the ATR value to be from cash hours only (08:00 – 16:30 UK time). So how do I get round this? Would I have to create a custom indicator to ONLY take into account cash hours, when calculating the 5 day ATR?
I could always just input the 5 day ATR manually before running the system, but this would not be of any use for back testing.
Any help is greatly appreciated guys.
Thanks
10/17/2018 at 8:32 AM #82938For question 1 you need MTF which is in beta testing at the moment but can be used live upon request. Plenty of info on it here:
https://www.prorealcode.com/blog/learning/approach-multi-timeframe-trading-prorealtime/
For question 2 – yes you would need to write a custom indicator that uses market prices only during your required times and then calculates the ATR from these values. With MTF this code could be included in your strategy rather than calling a separate indicator.
10/18/2018 at 11:33 AM #8307410/18/2018 at 12:33 PM #83083As far as I am aware the calculation for ATR[5] is:
Current ATR = [(Prior ATR x 4) + Current TR] / 5
Multiply the previous 5-day ATR by 4.
Add the most recent day’s TR value.
Divide the total by 5
So you would need to store the values at your chosen start and finish times for the last five start and finish times to get your starting values to calculate ATR. Then at each new update of the values you would need to forget the oldest set and add the newest set by using something like:
12345a = bb = cc = dd = ee = new atr valueI’m a bit too busy at the moment to write the full code – maybe someone else could help if they have the time.
10/18/2018 at 7:26 PM #8314110/18/2018 at 9:06 PM #83145I kind of just picked it up but then I did used to mess around with programming about 30 years ago!
Try here to start on your learning path:
https://www.prorealcode.com/programming-with-prorealtime/
…or just create codes with the PRT tool and spend a lot of time hanging around on these forums and you will learn a lot.
-
AuthorPosts