Stop/Limit order execution

Questions about MultiCharts and user contributed studies.
Bugs
Posts: 6
Joined: 20 Jul 2013

Stop/Limit order execution

Postby Bugs » 02 Sep 2013

Hello Support,

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));
I have also attached the exception snapshot.

Thanks
Attachments
Error.png
(42.94 KiB) Downloaded 319 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Stop/Limit order execution

Postby JoshM » 02 Sep 2013

That exception, as far as I know, is caused by a division by zero. I don't see it in the code, but could it be that one of the variables you send to the function is zero, and then gets divided in that function?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Stop/Limit order execution

Postby Henry MultiСharts » 24 Sep 2013

Bugs, if you still have this behavior please send me (support@multicharts.com) the following information for further investigation:
1) What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)
2) workspace you are using;
3) in QuoteManager select the symbol you are using, make a right click on it->Export data->Export instrument (with data). Send me the Qmd export file for analysis;
4) in PowerLanguage editor->File->Export->export with dependent functions the studies you are using in the workspaces you are providing. Send me the study export file.


Return to “MultiCharts”