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
priorities?
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
Try
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
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.