setting global allowance

 
Please help......if I want to assess the hourly chart and determine if trading condition is ok, but want to trade on the 15 min chart. Is there a way (either through global variable or script) to look and find my condition, then set something to "true" or "allowed", then have my EA find that condition and trade based on that? Any help would be greatly appreciated!!! Dan
 
forexman05 wrote >>
Please help......if I want to assess the hourly chart and determine if trading condition is ok, but want to trade on the 15 min chart. Is there a way (either through global variable or script) to look and find my condition, then set something to "true" or "allowed", then have my EA find that condition and trade based on that? Any help would be greatly appreciated!!! Dan

Hi Dan,

I'm guessing that you want to know what the price bars look like on a different timeframe? If that's the case then you have a few choices.

You will have to pick which timeframe you want to work in - I prefer to work in a lower timeframe and look at the higher timeframes from there since I tend to operate on bar openings. If you work on the 15 minute chart, for instance and want to know what price looks like on the 1 hour chart you have a couple of choices. You can either figure out where you are in the hour and calculate what an hourly bar would look like by adding up the 15 minute bars or you can use the built in functions that are described here:

https://docs.mql4.com/series

If you want to look at an indicator in a different timeframe then you just specify the timeframe of interest in the iCustom call.

Hope this helps.

- Tovan

 
tovan:

Hi Dan,

I'm guessing that you want to know what the price bars look like on a different timeframe? If that's the case then you have a few choices.

You will have to pick which timeframe you want to work in - I prefer to work in a lower timeframe and look at the higher timeframes from there since I tend to operate on bar openings. If you work on the 15 minute chart, for instance and want to know what price looks like on the 1 hour chart you have a couple of choices. You can either figure out where you are in the hour and calculate what an hourly bar would look like by adding up the 15 minute bars or you can use the built in functions that are described here:

https://docs.mql4.com/series

If you want to look at an indicator in a different timeframe then you just specify the timeframe of interest in the iCustom call.

Hope this helps.

- Tovan

Tovan,

Thank you for your continued support.....I am basically looking at the hourly bars and when a condition exists (i.e. high is higher than previous bar) then I want to do something on the 15 min chart once new conditions are met on the 15 min chart. I did write an EA using iHigh and iLow based on 60 min chart, but strategytester cannot backtest that-I received an error message when attempting to look at that. I suppose the only way to run this is on a demo going forward as I assume that if I write an EA predicated on the 15 min chart data, but gathers an indicator from the hour frame, the tester cannot handle that, yet the code can pull that info????!!!!!! Oh the joys of computer programming! :) thanks again..... Dan

 
forexman05 wrote >>

Tovan,

Thank you for your continued support.....I am basically looking at the hourly bars and when a condition exists (i.e. high is higher than previous bar) then I want to do something on the 15 min chart once new conditions are met on the 15 min chart. I did write an EA using iHigh and iLow based on 60 min chart, but strategytester cannot backtest that-I received an error message when attempting to look at that. I suppose the only way to run this is on a demo going forward as I assume that if I write an EA predicated on the 15 min chart data, but gathers an indicator from the hour frame, the tester cannot handle that, yet the code can pull that info????!!!!!! Oh the joys of computer programming! :) thanks again..... Dan

Hi Dan,

Happy to help.

What you describe about the backtest problems doesn't sound right based on what I read about the timeseries functions - though I have never used them. I have, however, used indicators in multiple timeframes in the strategy tester with sucess.

One problem that I have encountered in backtest is history data availability. First of all, I presume that you have set the "Model" menu on the strategy tester to "Every Tick" - this is necessary for this type of testing. Next, you have to go out and make sure you have data available. Odly enough, the tester won't do that for you. I do the following on the timeframe that my EA is testing on and each timeframe below - all the way down to 1 minute:

1) Open a chart with the currency you plan to test.

2) Select the first time frame - 1 hour in your case.

3) make sure you de-select the Auto Scroll button in your tool bar.

4) Repeatedly press the Home key on you keyboard until you a) get enough data to test with or b) stop making progress - that's all your broker has stored.

5) Select the next time frame down - 30 minutes, and repeate the above steps.....

6) keep doing this until you have collected lots of data - it takes a while

By the end of the exercise you will have a pretty good idea for how much data you have on all time frames - a measure for how good your modeling quality will be in the end. This will give you test date boundaries to work with.

Alternatively, you could go out to Alpari or some place like that, download history data, and re-direct your teminal to that data. I've never done that, but I see people discussing it regularly. If you did something like that then you would probably want a separate installation of MetaTrader for that purpose.

Hope this is helpful information.

Good luck,

Tovan

 

Repeatedly press the Home key on you keyboard until you a) get enough data to test with or b) stop making progress - that's all your broker has stored.


There is another way to do this if you are not keen to sit and press the key repeatedly - call the Win DLL to press the HOME or LEFT key for ya.

 

Basically, what I am looking to do is look at the hourly chart and if stochastics, I want to set something to true(like a globalvariable), then my EA(which may run on the 15 min chart) will getglobalvariable and if true, then trade....can someone help me with this code??? Thanks!!!!


Dan

 

forexman05 wrote >>

Basically, what I am looking to do is look at the hourly chart and if stochastics, I want to set something to true(like a globalvariable), then my EA(which may run on the 15 min chart) will getglobalvariable and if true, then trade....can someone help me with this code??? Thanks!!!!

Dan

If all you need is the value of an indicator from a different time frame then you can use the "i" functions: For example

double iStochastic(

string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)

setting the second parameter to 60, will return the value of the 60 minute chart. You can call different indicator values and do calcs with them

in the ea based opn the 15 min chart.

HTW

Keith

 
kminler:

If all you need is the value of an indicator from a different time frame then you can use the "i" functions: For example

double iStochastic(

string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)

setting the second parameter to 60, will return the value of the 60 minute chart. You can call different indicator values and do calcs with them

in the ea based opn the 15 min chart.

HTW

Keith

Thanks! I will give that a shot......