- Array size has nothing to do with switch
- case values must be CONSTANTS
Your code Another int tf[] = {1, 5, 15}; double TakeProfit(int i) { switch(tf[i]) { case 1: TP= 5; break; case 5: TP= 6; break; case 15: TP= 10; break; } return(TP); }
int TF[] = {PERIOD_M1, PERIOD,M5, PERIOD_M15}, TP[] = { 5, 6, 10}; double TakeProfit(){ for(int i=0; TF[i] != Period(); i++){} return(TP[i]); }
Oh many thanks, you are so helpful.
Thanks again :)

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
Hi all,
i want to know if it's possible to get a ArraySize function on a Switch function?
Like that:
Is it possible?
Thanks all by advance :)