Anyone can tell me how to find the period to use as string - this I want to go to the comment
- Ask!
- Trying to calculate total profit for trades
- PANTHERea.....100% win ratio
Subgenius:
Anyone can tell me how to find the period to use as string - this I want to go to the comment
Anyone can tell me how to find the period to use as string - this I want to go to the comment
Hi Subgenius
I think you need to code it explicitly. This script works.
int start() { string PeriodStr; switch( Period() ) { case 1: PeriodStr = "M1"; break; case 5: PeriodStr = "M5"; break; case 15: PeriodStr = "M15"; break; case 30: PeriodStr = "M30"; break; case 60: PeriodStr = "H1"; break; case 240: PeriodStr = "H4"; break; case 1440: PeriodStr = "D1"; break; case 10080: PeriodStr = "W1"; break; case 43200: PeriodStr = "MN1"; break; default: PeriodStr = "Unknown"; break; } Comment( "Period is ", PeriodStr ); return(0); }
Cheers
Jellybean
Here's mine:
string PeriodToStr(int period) { if(period == PERIOD_M1) return("1 Minute"); else if(period == PERIOD_M5) return("5 Minutes"); else if(period == PERIOD_M15) return("15 Minutes"); else if(period == PERIOD_M30) return("30 Minutes"); else if(period == PERIOD_H1) return("1 Hour"); else if(period == PERIOD_H4) return("4 Hours"); else if(period == PERIOD_D1) return("Daily"); else if(period == PERIOD_W1) return("Weekly"); else if(period == PERIOD_MN1) return("Monthly"); else return("Unknown"); } PeriodToStr(Period());Jon

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register