MTF conversion
Forums › ProRealTime English forum › ProOrder support › MTF conversion
- This topic has 5 replies, 2 voices, and was last updated 6 years ago by
robertogozzi.
-
-
04/08/2019 at 1:53 PM #95708
Hi everyone,
Since MTF is not working in real trading, I am trying to replace part of the code with a different non-default timeframe.
The default timeframe is 15 min, and I would like to adapt the 1 hour timeframe part of the code to 15′. I wonder if any of you guys have a solution for this:
12345678timeframe (1 hour, updateonclose)IF BARINDEX>1 THENhaopen60=(haopen60[1]+haclose60[1])/2haclose60=(open+close+low+high)/4ENDIFgreen60=haopen60<haclose60red60=haopen60>haclose60uturnbullish60=red60[3] AND red60[2] AND red60[1] AND green60I would like to convert this into 15′. I would start by multiplying the ratio by 4 and recreating the candles (open and close) and their periods, but in case anyone has solved or has a quick formula, I would greatly appreciate it.
Thanks in advance,
Juan
04/08/2019 at 2:51 PM #95714You could define a 1-hour bar on a 15-minute TF by combining the last 4 bars:
12345678910111213DEFPARAM CalculateOnLastBars = 1000MaxOC = max(open,close)MinOC = min(open,close)MyH1high = highest[4](high)MyH1low = lowest[4](low)MyH1MaxOC = highest[4](MaxOC)MyH1MinOC = lowest[4](MinOC)MyH1Open = max(MyH1MaxOC,MyH1MinOC)MyH1Close = min(MyH1MaxOC,MyH1MinOC)IF hour <> hour[1] THENDRAWCANDLE(MyH1open,MyH1high,MyH1low,MyH1close) coloured(0,128,0,16) BORDERCOLOR(0,128,0,128)ENDIFRETURNThis indicator shows, on a 15-minute TF, the whole 1-h candle, but it should be refined to show doji’s when 1-hour is a dojy and so forth….
If this can be what you are looking for, then I may further work on it.
04/08/2019 at 3:18 PM #95724This is much better:
1234567891011121314151617181920DEFPARAM CalculateOnLastBars = 1000//MaxOC = max(open,close)//MinOC = min(open,close)//MyH1high = highest[4](high)//MyH1low = lowest[4](low)//MyH1MaxOC = highest[4](MaxOC)//MyH1MinOC = lowest[4](MinOC)//MyH1Open = max(MyH1MaxOC,MyH1MinOC)//MyH1Close = min(MyH1MaxOC,MyH1MinOC)//IF hour <> hour[1] THEN//DRAWCANDLE(MyH1open,MyH1high,MyH1low,MyH1close) coloured(0,128,0,16) BORDERCOLOR(0,128,0,128)//ENDIFH1high = highest[4](high)H1low = lowest[4](low)H1Open = open[3]H1close = closeIF hour <> hour[1] THENDRAWCANDLE(H1open,H1high,H1low,H1close) coloured(0,0,0,255) BORDERCOLOR(0,128,0,128)ENDIFRETURNYou will define HA candles for the 15-minute TF as usual, while for the 1-h TF you’ll need to write:
12345678910111213IF hour <> hour[1] THENxH1Close = (H1open+H1close+H1low+H1high)/4 //TotalPricexH1Open = (xH1Open[1]+xH1Close[1])/2haH1High = Max(xH1Open, xH1Close)haH1Low = Min(xH1Open, xH1Close)xH1High = Max(H1High,haH1High)xH1Low = Min(H1Low,haH1Low)elsexH1Close = xH1Close[1]xH1Open = xH1Open[1]xH1High = xH1High[1]xH1Low = xH1Low[1]endif04/08/2019 at 3:24 PM #95726When you refer to a previous 15-minute HA candle you will use [1], [2],… while for 1-hour candles you’ll need to multiply the number in brackets by 4.
1 user thanked author for this post.
04/08/2019 at 3:50 PM #95730Thanks so much Roberto,
It is perfect. I was working on something but nothing compared to your idea..
Muchas gracias,
Juan
04/09/2019 at 8:30 AM #95784The code to access 1-hour bars should be:
1H1period = (Period - (Period mod 4)) / 41 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on