shrtsirkit:
What specifically are you having problems with ?
Hi all.
I need some help in writing the code for an EA I am testing to be able to determine lot size based on account balance an the number of pairs being traded.
RaptorUK:
What specifically are you having problems with ?
What specifically are you having problems with ?
Thanks for your reply.
I haven't a clue as to how begin to code this operation. I have been using/modifying an exiting EA to make trades on a Global Variable input. I would like to have this EA be able to calculate the lot size based on the account Balance and the # of Pairs been traded. The EA now takes the trades.
You start with defining how you want to calculate lotsize given AB/nPairs.
string active.market, active.prefix; void init(){ active.prefix = WindowExpertName() + "_"; #define CS_VISUAL 1 active.market = active.prefix + Symbol(); if(!GlobalVariableSet(active.market, 0)) DisableTrading( "GlobalVariableSet(" + active.market + ")[2] Failed: " + GetLastError() ); } int deinit(){ OptComplete(); if(!GlobalVariableDel(active.market)) Alert( "GlobalVariableDel(" + active.market + ") Failed: " + GetLastError() ); } int nPairs(){ int nWaiting = 1; // Me and how many others CURRENTLY want to open. for(int iPos=GlobalVariablesTotal(); iPos >=0; iPos--){ string gvn = GlobalVariableName(iPos); if(StringFind(gvn, active.prefix) != 0) continue; // Wrong prefix. if(gvn == active.market) continue; // Myself counted // datetime active = GlobalVariableGet(gvn); if(active == 0.){ Alert( // "GlobalVariableGet(",gvn,") Failed: ", GetLastError()); continue; } // if(timeCur.srv - active > 30) continue; // Expired. nWaiting++; } return(nWaiting); }
WHRoeder:
You start with defining how you want to calculate lotsize given AB/nPairs.
You start with defining how you want to calculate lotsize given AB/nPairs.
Thanks for your reply. I am unable to see where to patch this code into the code for the EA I am using. Is it possible to for you to help me with this if I send you the code?
Thanks,
Kit
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 need some help in writing the code for an EA I am testing to be able to determine lot size based on account balance an the number of pairs being traded.
Thanks