Good morning, I have a problem and need help please.
I recover ...
open = iOpen (Symbol (), PERIOD_M1, 1);
close = iClose (Symbol (), PERIOD_M1, 1);
I need open and close with 5 decimal places, but I come with 4 decimal places and if the string step puiedo not operate with them, and I need you to put the result subtract without decimal numbers:
open = 1.61256
close = 1.61154
result = 0.00102 (NO)
I need result = 102
Can anyone help me to make it easy?
thanks
need open and close with 5 decimal places, but I come with 4 decimal places and
I need result = 102
- iOpen/iClose return a double, INFINITE decimal places. RTFM Print/Comment/Alert and then the link to DoubleToStr.
string PriceToStr(double p){ return( DoubleToStr(p, Digits) ); } string DeltaToPips(double d){ if (d > 0) string sign = "+"; else sign = ""; double pips = d / pips2dbl; return( sign + DoubleToStr(pips, Digits.pips) ); }
int result = (close-open) / pips2dbl;
Your EA must adjust for 4/5 digit brokers. Pips (tp, sl) and Points (Slippage) EA's must adjust for ECN brokers//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(..., 0,0,...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_TICKET)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)) Alert("OrderModify failed: ", GetLastError()); */
many thanks for where these instructions on iOpen/Close are leading to with the since my broker is asking for the SL and TP in POINTS on the EA settings with the Trailing Stop Loss and Trailing Take Profit . to finalise my EA includes the "threshold close (0 ..100)" , "threshold open (0 ..100)" in points .my estimation is measuring the pips upward or downward on the linear scale of the H1 S&P500 GRAPH .should it mean that if i open a BUY at 3463.5 and close the SL at 3475 , the difference of 7 are 7 pips ? is that true ? is S&P500 a four digit broker ?
i have some questions on setting the "threshold open " and "threshold close " including the swap BUY and SELL . can i continue ?
thanks William i value your explanations very much ,
paul macques
- Your broker isn't asking for anything.
- SL and TP is a price not POINTS.
- S&P500 is a symbol (a chart) it isn't a broker.
- Don't resurrect eight (8) old threads without a very good reason. A lot has changed since Build 600 and Higher. 2014.02.03
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I recover ...
open = iOpen (Symbol (), PERIOD_M1, 1);
close = iClose (Symbol (), PERIOD_M1, 1);
I need open and close with 5 decimal places, but I come with 4 decimal places and if the string step puiedo not operate with them, and I need you to put the result subtract without decimal numbers:
open = 1.61256
close = 1.61154
result = 0.00102 (NO)
I need result = 102
Can anyone help me to make it easy?
thanks