In my strategy I am generating SL/TP orders manually after placing initial order i.e. placing limit/stop order at particular price. I am facing two issues in Strategy execution.
1.While back testing every time back testing ends at 66% and it doesn't display any Portfolio performance result window.
2.When I add limit order statement to place TP for Long position,I gets an "Floating points invalid" exception.
Following are lines of code that I am using to place SL/TP orders for Long
Code: Select all
Buy _tradeAmount shares next bar at _entryPrice stop;
SetStopPosition;
_temp = GetTempValue(High, STPa, atr, _riskPrice);
_buyStopLossPrice = GetStopValue(_entryPrice, "LONG", _riskPrice, _tradeAmount, STPa, PCTRP/100, _minimumTick); // Calculate StopPrice
_buyTakeProfitPrice= GetTakeProfitValue(_entryPrice, "LONG", atr, _tradeAmount, PTLim, _minimumTick); // Calculate TakeProfit Price
_stopLossPrice=_buyStopLossPrice ;
_takeProfitPrice=_buyTakeProfitPrice;
sell _buyStopLossAmount shares next bar at _stopLossPrice stop;
print("Buy Stoploss order placed.Stoploss Price = ", NumToStr(_stopLossPrice,6));
sell _buyTakeProfitAmount shares next bar at _takeProfitPrice limit; //Floating point invalid exception
print("Buy Take Price order placed.Take Profit Price = " , NumToStr(_takeProfitPrice,6));
Thanks