samjesse:
Hi
I wrote this code after reading online, not sure how to do the "JPY" part of the code, please help and correct me if there is something wrong with it.
Thanks
Hi sanjesse
follow my code for you
//+------------------------------------------------------------------+ // //+------------------------------------------------------------------+ int SymbolsListGet(string &pSymbolsRef[], bool pOnlyOnMarketWatch = false) { int iSymbolNumber = SymbolsTotal(false); for ( int i = 0; i < iSymbolNumber; i++ ) { string iSymbolName = SymbolName(i, false); int x = ArrayResize(pSymbolsRef, ArraySize(pSymbolsRef) + 1) - 1; if ( pOnlyOnMarketWatch ) { if ( SymbolInfoInteger(iSymbolName, SYMBOL_VISIBLE) ) pSymbolsRef[x] = iSymbolName; } else pSymbolsRef[x] = iSymbolName; } return ArraySize(pSymbolsRef); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double SymbolPointValue(string pSymbol = NULL, datetime pDt = 0) { pSymbol = pSymbol == NULL || pSymbol == "" ? Symbol() : pSymbol; if ( MQLInfoInteger(MQL_TESTER) ) return SymbolInfoDouble(pSymbol, SYMBOL_TRADE_TICK_VALUE) * 10.0; double iPoint = SymbolInfoDouble(pSymbol, SYMBOL_POINT); switch( (int) SymbolInfoInteger(pSymbol, SYMBOL_TRADE_CALC_MODE) ) { case 0: //Forex if ( Digits == 3 || Digits == 5 ) iPoint *= 10; break; case 1: //Cfd if ( (1.0 / SymbolInfoDouble(pSymbol, SYMBOL_TRADE_TICK_SIZE)) != 100.0 ) iPoint = 1; break; } double iPipValue = SymbolInfoDouble(pSymbol, SYMBOL_TRADE_CONTRACT_SIZE) * iPoint; string iAccountCurrency = AccountInfoString(ACCOUNT_CURRENCY); string iProfitCurrency = SymbolInfoString(pSymbol, SYMBOL_CURRENCY_PROFIT); if ( iAccountCurrency != iProfitCurrency ) { string iAccountAndProfitSymbol = iAccountCurrency + iProfitCurrency; string iMarketSymbol = ""; string iaSymbol[]; SymbolsListGet(iaSymbol); for ( int i = 0; i < ArraySize(iaSymbol); i++ ) { if ( StringFind(iaSymbol[i], iAccountCurrency, 0) >= 0 && StringFind(iaSymbol[i], iProfitCurrency, 0) >= 0 ) iMarketSymbol = iaSymbol[i]; } double iBid = SymbolInfoDouble(iMarketSymbol, SYMBOL_BID); if ( pDt != 0 ) { int iShift = iBarShift(iMarketSymbol, PERIOD_M1, pDt, false); iBid = iClose(iMarketSymbol, PERIOD_M1, iShift); } if ( iAccountAndProfitSymbol != iMarketSymbol ) { iAccountAndProfitSymbol = iMarketSymbol; iBid = SymbolInfoDouble(iAccountAndProfitSymbol, SYMBOL_BID) != 0.0 ? 1.0 / SymbolInfoDouble(iAccountAndProfitSymbol, SYMBOL_BID) : 0.0; if ( pDt != 0 ) { int iShift = iBarShift(iAccountAndProfitSymbol, PERIOD_M1, pDt, false); iBid = iClose(iAccountAndProfitSymbol, PERIOD_M1, iShift) != 0.0 ? 1.0 / iClose(iAccountAndProfitSymbol, PERIOD_M1, iShift) : 0.0; } } iPipValue = iBid == 0 ? 0 : iPipValue / iBid; } return iPipValue; }
Eugenio

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
I wrote this code after reading online, not sure how to do the "JPY" part of the code, please help and correct me if there is something wrong with it.
Thanks