What is wrong here ????

 

if (OrdersTotal() < 1)

{

if (Bid > ret0 + 15 * Point && Ask < retp18)

{

stoplevel = ret0 - 2 * Point;

OrderSend(Symbol(), OP_BUY, lotused, Ask, 3, stoplevel, 0, 0, 0, Green);

}

}

ret0 is a price value given as an extern variable

retp18 is also an extern variable

the code does not work, does not open any trades.

 
junglelion:
if (OrdersTotal() < 1)

{

if (Bid > ret0 + 15 * Point && Ask < retp18)

{

stoplevel = ret0 - 2 * Point;

OrderSend(Symbol(), OP_BUY, lotused, Ask, 3, stoplevel, 0, 0, 0, Green);

}

}

ret0 is a price value given as an extern variable

retp18 is also an extern variable

the code does not work, does not open any trades.

Try

OrderSend(Symbol(), OP_BUY, lotused, Ask, 3, stoplevel, 0, "", 0, Green);
 

priorities?

junglelion:
if (OrdersTotal() < 1)

{

if (Bid > ret0 + 15 * Point && Ask < retp18)

{

stoplevel = ret0 - 2 * Point;

OrderSend(Symbol(), OP_BUY, lotused, Ask, 3, stoplevel, 0, 0, 0, Green);

}

}

ret0 is a price value given as an extern variable

retp18 is also an extern variable

the code does not work, does not open any trades.

Maybe the couse is priorities in C language.

When u write

"Bid > ret0 + 15 * Point && Ask < retp18"

so u mean Parentheses around of expression

Unfortunately we have not a debugger.

ANY problems can be solved, believe me

 
Michel:
Try
OrderSend(Symbol(), OP_BUY, lotused, Ask, 3, stoplevel, 0, "", 0, Green);

good its the comments which is the problem as i see it, no wonder it was not working on the strategy tester even with 100% modelling quality.

 

The problem above was that pair spread was not taken into consideration

whats wrong with this condition

if (OrderSelect(1, SELECT_BY_POS, MODE_TRADES))

 

Assuming you have 2 open trades it looks all dandy to me

 
junglelion:
The problem above was that pair spread was not taken into consideration

whats wrong with this condition

if (OrderSelect(1, SELECT_BY_POS, MODE_TRADES))

Sorry, it's not possible to debug your stuff line by line without understanding the global logic.

Reason: