- IsConnected(): check when the status at the right site of the bottom line changes.
- Decimals: Try to understand the indicators you request! E.g. iStochastic varies between +100 and 0! 4 decimals simply do not make sense!
- Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 and MetaTrader 4 - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 and MetaTrader 4 - MQL4 programming forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 and MetaTrader 4 - MQL4 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 and MetaTrader 4 - MQL4 programming forum
- Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
- GrumpyDuckMan: I don't understand why all variables aren't debugging at four decimal places. I noticed some are only showing three decimal places, not the four decimal places expected.If you want to see 4 places, print them out to 4, not normalize them.
DoubleToString - Conversion Functions - MQL4 Reference
- docs.mql4.com
DoubleToString - Conversion Functions - MQL4 Reference
Hello everyone,
my first attempt at using DoubletoString. I am not sure this code is written correctly.
//+------------------------------------------------------------------+ int A(){ double StochMain=iStochastic(NULL,TIMEFRAME,SIGNAL,MAIN,Slowing,MODE_SMA,0,MODE_MAIN,0); string sm=DoubleToString(StochMain,0); return(SM);} //+------------------------------------------------------------------+ int B(){ double StochSignal=iStochastic(NULL,TIMEFRAME,SIGNAL,MAIN,Slowing,MODE_SMA,0,MODE_SIGNAL,0); string ss=DoubleToString(StochSignal,0); return(SS);} //+------------------------------------------------------------------+ int C(){ double READplus=iADX(NULL,TIMEFRAME,8,PRICE_OPEN,MODE_PLUSDI,0); string rp=DoubleToString(READplus,0); return(RP);} //+------------------------------------------------------------------+ int D(){ double READminus=iADX(NULL,TIMEFRAME,8,PRICE_OPEN,MODE_MINUSDI,0); string rm=DoubleToString(READminus,0); return(RM);} //+------------------------------------------------------------------+ int E(){ double CurrentADX=iADX(NULL,TIMEFRAME,8,PRICE_OPEN,MODE_MAIN,0); string ca=DoubleToString(CurrentADX,0); return(AM);} //+------------------------------------------------------------------+ int F(){ double CurrentRSI=iRSI(NULL,TIMEFRAME,8,PRICE_OPEN,0); string cr=DoubleToString(CurrentRSI,0); return(RSI);} //+------------------------------------------------------------------+ int G(){ double CurrentiMA=iMA(NULL,TIMEFRAME,8,3,MODE_EMA,PRICE_OPEN,0); string ci=DoubleToString(CurrentiMA,0); return (IMA);} //+------------------------------------------------------------------+ int H(){ double iMoneyFlow=iMFI(NULL,TIMEFRAME,8,0); string mf=DoubleToString(iMoneyFlow,0); return(MF);} //+------------------------------------------------------------------+
I was fairly sure it was incorrectly coded, on the other hand all returns equal closely to values I expected them to be.
I'm experiencing a problem with return values for (RSI) and (IMA). Both of these appear to be returning a true/false indication and not a true value.
//+------------------------------------------------------------------+ string A(){ double StochMain=iStochastic(NULL,TIMEFRAME,SIGNAL,MAIN,Slowing,MODE_SMA,0,MODE_MAIN,0); SM=DoubleToString(StochMain,0); return(SM);}//Main_Stoch_Return //+------------------------------------------------------------------+ string B(){ double StochSignal=iStochastic(NULL,TIMEFRAME,SIGNAL,MAIN,Slowing,MODE_SMA,0,MODE_SIGNAL,0); SS=DoubleToString(StochSignal,0); return(SS);}//Signal_Stoch_Return //+------------------------------------------------------------------+ string C(){ double READplus=iADX(NULL,TIMEFRAME,8,PRICE_OPEN,MODE_PLUSDI,0); RP=DoubleToString(READplus,0); return(RP);}//ADX_Plus_Return //+------------------------------------------------------------------+ string D(){ double READminus=iADX(NULL,TIMEFRAME,8,PRICE_OPEN,MODE_MINUSDI,0); RM=DoubleToString(READminus,0); return(RM);}//ADX_Minus_Return //+------------------------------------------------------------------+ string E(){ double CurrentADX=iADX(NULL,TIMEFRAME,8,PRICE_OPEN,MODE_MAIN,0); AM=DoubleToString(CurrentADX,0); return(AM);}//ADX_adx_Return //+------------------------------------------------------------------+ string F(){ double CurrentRSI=iRSI(NULL,TIMEFRAME,8,PRICE_OPEN,0); RSI=DoubleToString(CurrentRSI,0); return(RSI);}//RSI_Return //+------------------------------------------------------------------+ string G(){ double CurrentiMA=iMA(NULL,TIMEFRAME,8,0,MODE_SMMA,PRICE_OPEN,0); IMA=DoubleToString(CurrentiMA,0); return (IMA);}//MA_Return //+------------------------------------------------------------------+ string H(){ double iMoneyFlow=iMFI(NULL,TIMEFRAME,8,0); MF=DoubleToString(iMoneyFlow,0); return(MF); }//Money_flow_Return //+------------------------------------------------------------------+
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
Hello everyone,
I have internet connection problems in my area, so I am interested in IsConnected(). I was trying to test this today, but after disconnecting my WiFi and cables from internet and restarting my computer. MetaTrader was telling me it is still connected. Should I add a delay before EA starts again?
I don't understand why all variables aren't debugging at four decimal places. I noticed some are only showing three decimal places, not the four decimal places expected.