btw, i have the following also in my code, if anyone was wondering :)
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) if (Digits == 5 || Digits == 3) { // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } double minlot = MarketInfo(Symbol(),MODE_MINLOT); if (minlot == 0.01) lots = NormalizeDouble(lots,2); if (minlot == 0.1) lots = NormalizeDouble(lots,1); if (minlot == 1) lots = NormalizeDouble(lots,0);
try to put some TP & SL
if it's not working try to change to OP_BUYLIMIT
TP and SL are not necessary with FXPro, other EA's without also worked. OP_BUYLIMIT is different order, i need OP_BUYSTOP.
See this:
if u sure about this (ls & tp) the only thing left to say is try 0 instead of NULL for SL & TP
doesn't matter. i have this code (also with NULL) i different EA i created, which is working (where distance is an integer with a value of 10).
To me, i suppose i use the wrong command for : buytp1=NormalizeDouble((hh5*pips2dbl), Digits); I just can't get it right :)
buystop=OrderSend(Symbol(),OP_BUYSTOP,lots,Ask+distance*pips2dbl,50,NULL,NULL,NULL,MagicNumber,0,Blue);
i'm sorry i can't find in your code the value of distance
its not here, like i said: in a previous EA of mine i used that line of code to place the pending buy and sellstops, but it was using Ask+distance*pips2dbl as the open price, where the variable distance was declared as an integer with a default value of 10 back then... :) But the distance variable is not important - it was just to show a almost identical line of code which DID work :)
I'm pretty much a noob with MQL (just 2 months busy writing different EA's now). Am i right if i guess you're pretty new to MQL too, seeing your posts and questions? NOFI ofcourse :)
BTW u sure u want buy ask + hh5 or u want buy @ hh5 ?
BTW u sure u want buy ask + hh5 or u want buy @ hh5 ?
@hh5 good point indeed, looked over it to many times now :) it works! thanks for fixing
- ido370:
To me, i suppose i use the wrong command for : buytp1=NormalizeDouble((hh5*pips2dbl), Digits); I just can't get it right :)You don't have to normalize values, but you must have the buy stop at least MarketInfo(Symbol(), MODE_STOPLEVEL)*Point away from the Ask.
double minlot = MarketInfo(Symbol(),MODE_MINLOT); if (minlot == 0.01) lots = NormalizeDouble(lots,2); if (minlot == 0.1) lots = NormalizeDouble(lots,1); if (minlot == 1) lots = NormalizeDouble(lots,0);
These assume minlot is a power of 10 and that the step size is equal. Previously on IBFX minlot was 0.1 but step size was 0.01 (You could have 0.10, 0.11,....) No reason a broker couldn't have a minlot of 0.05. Do it right.double minLot = MarketInfo(Symbol(), MODE_MINLOT), lotStep = MarketInfo(Symbol(), MODE_LOTSTEP); lots = MathFloor(lots/lotStep)*lotStep; if (lots < minLot) ...
- And to answer your OP
buytp1=NormalizeDouble((hh5*pips2dbl), Digits);
hh5 is a price (E.G. 1.2345) times pips2dbl gives you (.000012345) zero. pips * pips2dbl gives relative points, you wanted relative points/pips2dblbuytp1=(hh5-Ask)/pips2dbl);
OR just open with hh5+spread. - Finally you must adjust TP, SL, and slippage
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
Note the dbl/pips2dbl and the Slippage.Pips*pips2points comments, that was originally in my code.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
got the following code. for the ordersend command i want to set the open price on the value of hh5 (highest price from last 5 bars), but i keep getting error 4107 or 130. Could someone show me what im doing wrong?