How to change chart time frame with code?
|
|||
|
When an Expert Advisor is attached to a chart, the time frame is manually applied by clicking M1, M5, H1, etc. This time frame controls how often the EA receives a market tick which then runs all the code in the start() method.
How can I programmatically change the time frame from D1 to H4 to H1 to M30 to M15 to M5 to M1? The underlying requirement is that the EA only wants to trade once a week at a particular time. As the weekday and clock time approaches, changing the time frame would allow waking up the start() method more and more often until the moment arrives. |
![]() |
|
|||
|
If the EA is attached on let say M5, it will received exactly the same amount of ticks than the D1 chart. The start() function will execute each tick regardless the TF where the EA is attached.
However, if you want to limit some part of your code, you may use something like this: First declare this: Quote:
Quote:
Hope that helps. FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! More info here Coding services: Experts Advisors, indicators, alerts, etc ... NEW: TripleXXX Expert Advisor developed by Spiritfriends and coded by FerruFx ... more info |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multiple time frame indicator | tinybolt10 | Indicators | 6 | 09-09-2008 08:39 AM |
| Indicators with All Time Frames on one chart | SteveG | Indicators | 1 | 08-23-2008 04:37 PM |
| Strategy Tester - virtual chart not active chart? | joc_06 | MetaTrader and ZeroCode | 0 | 08-11-2007 05:41 PM |
| MT4 Time frame - 10 M chart | bnf | Indicator Coding | 1 | 03-16-2007 05:58 AM |
| How Can I Change the Lot size to .10 | JohnnyQuad | MetaTrader and ZeroCode | 2 | 09-07-2005 07:42 AM |
All times are GMT. The time now is 08:02 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now








Linear Mode


