Here is the code function that will return the chart period in the nicely formation text line.
Example: (if EA is running on 1hour chart)
chartperiod = periodToString(Period()) // will return 1 Hour
Code:string periodToString(int tf) { string tfString; switch (tf) { case 1: tfString = "1 Min"; break; case 5: tfString = "5 Min"; break; case 15: tfString = "15 Min"; break; case 30: tfString = "30 Min"; break; case 60: tfString = "1 Hour"; break; case 240: tfString = "4 Hour"; break; case 1440: tfString = "Daily"; break; case 10080: tfString = "Weekly"; break; case 40320: tfString = "Monthly"; break; default: tfString = "Unknown"; } return (tfString); }
Programming - editing - modification EA, Script or Indicator for MT4 OR MT5 ---- Trading on the Forex market involves substantial risks, including complete possible loss of funds and other losses and is not suitable for all members. Client should make an independent judgments as to whether trading is appropriate for him/her in light of his/her financial condition, investment experience, risk tolerance and other factors.
Tuesday, 27 November 2012
Numeric Chart Period to Text String Format
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment