Bug in \Mql_MT4_BarOpen\Main.tpl
0 replies
kleva
8 years ago #114611
Hi Mark,
I know it’s too late to “tinker” around 3.8.1., because v 4. will be ready shortly. So I’m reporting this bug for completeness … .
The exact formulations there should be (otherwise setting of all pending orders with SL/TP will fail!):
//***
double getSpecialSL(double value) {
if(value == 0) return(0);
switch (OrderType())
{
case OP_BUY:
case OP_BUYSTOP:
case OP_BUYLIMIT:
return(value – 1000 * gPointCoef);
case OP_SELL:
case OP_SELLSTOP:
case OP_SELLLIMIT:
return(value + 1000 * gPointCoef);
default:
return(0);
}
}
double getSpecialPT(double value) {
if(value == 0) return(0);
switch (OrderType())
{
case OP_BUY:
case OP_BUYSTOP:
case OP_BUYLIMIT:
return(value + 1000 * gPointCoef);
case OP_SELL:
case OP_SELLSTOP:
case OP_SELLLIMIT:
return(value – 1000 * gPointCoef);
default:
return(0);
}
}
double getNormalSL(double value) {
if(value == 0) return(0);
switch (OrderType())
{
case OP_BUY:
case OP_BUYSTOP:
case OP_BUYLIMIT:
return(value + 1000 * gPointCoef);
case OP_SELL:
case OP_SELLSTOP:
case OP_SELLLIMIT:
return(value – 1000 * gPointCoef);
default:
return(0);
}
}
double getNormalPT(double value) {
if(value == 0) return(0);
switch (OrderType())
{
case OP_BUY:
case OP_BUYSTOP:
case OP_BUYLIMIT:
return(value – 1000 * gPointCoef);
case OP_SELL:
case OP_SELLSTOP:
case OP_SELLLIMIT:
return(value + 1000 * gPointCoef);
default:
return(0);
}
}
//***