Posted By: tomna1993
ThisTrade crashes test - 05/19/21 14:36
Hi,
I would like to assign trade pointer to ThisTrade when I enter a trade in tick function, but it crashes the test. I tried it two ways:
and
I think now that I can't assign to ThisTrade the trade pointer in tick function, I did not try it in run function, but anyway it's no way I open trade in run (because of low timeframes I trade).
I use trade variables in run and in TMF functions and they work correctly but I read in manual I should set ThisTrade to be sure that trade variables have correct values. There is !TradeIsOpen which is checked before trade is open. What can I do in that situations? Create a global bool variable and use it till I open trade?
I would like to assign trade pointer to ThisTrade when I enter a trade in tick function, but it crashes the test. I tried it two ways:
Code
function tick() { if (LongSignal && (priceClose(0) >= LongSignalEntry) && !TradeIsOpen) { Lots = ceil(RISK / ((LongSignalEntry - GridTakeProfit[0]) * POINT_CURRENCY_VALUE)); TRADE* RunningLongTrade = enterLong(LongTradeManagement); }
and
Code
function tick() { if (LongSignal && (priceClose(0) >= LongSignalEntry) && !TradeIsOpen) { Lots = ceil(RISK / ((LongSignalEntry - GridTakeProfit[0]) * POINT_CURRENCY_VALUE)); ThisTrade = enterLong(LongTradeManagement); }
I think now that I can't assign to ThisTrade the trade pointer in tick function, I did not try it in run function, but anyway it's no way I open trade in run (because of low timeframes I trade).
I use trade variables in run and in TMF functions and they work correctly but I read in manual I should set ThisTrade to be sure that trade variables have correct values. There is !TradeIsOpen which is checked before trade is open. What can I do in that situations? Create a global bool variable and use it till I open trade?