[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 299
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
people, is there a virtual dedicated server anywhere on the internet for free?
Guys who are friendly with Pyatra. Look at my Indy for the championship, please. I'm stuck - I can't decide...
Translating from 4 to 5 - there on the forum - silence. Put the code in the branch - on this page. Description - on the previous one.
Thanks.
bool isCloseLastPosByTake(string sy="", int op=-1, int mn=-1) {
datetime t;
double ocp, otp;
int dg, i, j=-1, k=OrdersHistoryTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol()==sy || sy==") {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderCloseTime()) {
t=OrderCloseTime();
j=i;
}
}
}
}
}
}
}
// !!!!!!!!?????? CAN ANYONE EXPLAIN THE MEANING OF THE LINES OF CODE THAT START IN THIS PLACE?
if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {// If the next order of the trading history is selected
dg=MarketInfo(sy, MODE_DIGITS);// the variable dg will accept the value of the digits by the currency pair whose name is in the variable sy
// hereinafter probably I have placed the brackets incorrectly but in fact it should be like this
if (dg==0){// if digits is zero, then
if(StringFind(OrderSymbol(), "JPY")<0){// if a substring is found in the order symbol name then (only it is not written correctly - the function can validate > 1)
dg=4;// digits takes value = 4
}
else{// else
dg=2;// digits takes value = 2
}
}
ocp=NormalizeDouble(OrderClosePrice(), dg);// normalize order close price
otp=NormalizeDouble(OrderTakeProfit(), dg);// normalize the order TakeProfit price
if (ocp==otp) return(True);
}
return(False);// command to return(false) from the subroutine
}
thank you, what is digits?
The digits of a trading instrument - how many digits after the decimal point it has.
Significance of a trade instrument - how many digits after the decimal point it has.
That is, if I know the digits are 4, then the code can be shortened like this?
int dg = 4;
............ code
if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {
ocp=NormalizeDouble(OrderClosePrice(), dg);// normalize order closing priceotp=NormalizeDouble(OrderTakeProfit(), dg);// normalize order TakeProfit price
if (ocp==otp) return(True);
}
return(False);
}
Can you please tell me if there is an indicator which calculates the total number of open orders for all pairs involved in the trading process?