You will be glad to know that you were not being a dope.c1borg » Thu Dec 06, 2018 5:54 pm wrote:
I need help still failing to get pending trades to work even after the help kindly provided by Leon![]()
I am using the settings attached using V2i. I use this setup on other demos and everything is working as expected with send immediate trades set to true and the grid trading off. However when I turn the grid on and the immediate trades off nothing happens. I have set an indicator which is always going to send a signal and no pending trades appear? I must be doing something stupid![]()
Does anybody use pending trades if so can you kindly send me your setfile preferably for V2i, ive come to a deadend
Looking at the problem with fresh eyes, I spotted it immediately.
The variable 'result' is declared at the top of the function, and initialised to 'false'. It is only reset to 'true' if the immediate market trade is successful, as in:
Code: Select all
//Immediate market trade
if (SendImmediateMarketTrade)
result = LookForTradingOpportunities(symbol, pairIndex, OP_BUY);
Code: Select all
if (UseGridTrading)
if (result)
{
if (TypeOfGrid == Stop || TypeOfGrid == Both)
{
SendBuyGrid(symbol, OP_BUYSTOP, ask, Lot );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
if (TypeOfGrid == Limit || TypeOfGrid == Both)
{
SendBuyGrid(symbol, OP_BUYLIMIT, ask, Lot );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
}//if (result)
Code: Select all
if (!SendImmediateMarketTrade)
result = true;//To allow grid trading if SendImmediateMarketTrade is 'false'.