Need help with coding

 

Hi seniors,

I am coding a script that will place buy/sell orders according to my risk rules. I need to develop the following:

If the pair is USDXXX, then use this formula... for calculation

If the pair is XXXUSD, then use this formula... for calculation

I have written 2 separate scripts for buy orders, 2 for sell orders. I wonder if there is some way to code as above so that I can reduce the scripts from 4 to 2 only (1 buy and 1 sell)?

Your help is very much appreciated,

best regards

 

int type = StringFind(Symbol(), "USD", 0);

if (thpe == 0) // USDXXX

if (type == 3) // XXXUSD

if (type == -1) // other

 

thanks a lot phy, as usual you are helpful all the time. I really appreciate it!

best regards

Reason: