I am just starting with prorealtime and starting with coding.
I have read the manual, but I am a little confused as to how to access the high and low of a particular bar.
Let’s say I want to trade the DAX and at 11:35am I want to find the high and low of the 5 minute bar and then trade LONG if the market breaks above the 5 minute bar at 11:35am, how can I do this?
My biggest question is how to access a particular 5 min bar at a particular time. How can I access this information?
1) wait the time you want (within th 5-minute timeframe) and save both high and low values in two separate variables; of course the day you launch your strategy it’ll wait the next 11:35:00 candle which might be the nest day.
2) being in a 5-minute timeframe you may access the required bar using brackets after high/low and computing the index based on the fact that an hour has 12 bars; you have to retrieve current time an then compute how many bars have elapsed since 11:35:00 and use that numer as an index (i.e. HIGH[32] and LOW[32] to access the values of the 32nd bar previous the current one). This calculation is not as straithforeward, but it allows not to have to wait the next day to retrieve desired data.
Here is an example for option 1:
1
2
3
4
5
6
7
8
9
10
11
12
ONCEHighestPrice=0
ONCELowestPrice=0
.
.//Place here any further variable or piece of code
.
IFtime=113500THEN//These values will be updated each day at
HighestPrice=high//11:35:00
LowestPrice=low
ENDIF
.
.//Place here any further piece of code or condition or Buy/Sell order
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue