I using DrwText in a signal.
When running in a LastBarOnChart if clause, this text disappears after less than a second, or does not display at all.
This happens both with and without [IOGMode(IOGMode.Enabled)]
I attach a simple signal that reproduces the problem. The signal creates long and short entry limit orders, which are charted on screen using my OrderEx class.
When the order's price is set it should print additional information to the chart (see png). However this does not happen when using LastBarOnChart check. Only the order line is charted, and the output to the debug.
if you comment the LastBarOnChart the DrwText works correctly.
Signal, OrderEx Class, and screen capture are attached.
DrwText problem when using if (Bars.LastBarOnChart)
DrwText problem when using if (Bars.LastBarOnChart)
- Attachments
-
- PTTCapture.zip
- (14.57 KiB) Downloaded 266 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: DrwText problem when using if (Bars.LastBarOnChart)
Have you added the `RecoverDrawings` attribute to the top of your class, like this?I using DrwText in a signal.
When running in a LastBarOnChart if clause, this text disappears after less than a second, or does not display at all.
This happens both with and without [IOGMode(IOGMode.Enabled)]
Code: Select all
[RecoverDrawings(false)]
public class Example : IndicatorObject
{
// Code here
}
Re: DrwText problem when using if (Bars.LastBarOnChart)
I just tried it and it didn't help.
So I added a bool to my OrderEx class to remember re-printing on each intra-CalcBar, and close the flag at the close of the bar.
I attach the working and improved OrderEx class.
So I added a bool to my OrderEx class to remember re-printing on each intra-CalcBar, and close the flag at the close of the bar.
I attach the working and improved OrderEx class.
- Attachments
-
- TestLimitOrder.pln
- (6.13 KiB) Downloaded 357 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: DrwText problem when using if (Bars.LastBarOnChart)
Sorry, I couldn't make sense of why the drawings aren't persistent, nor could I easily replicate order entries (since it depends on other variables) or find the `Bars.LastBarOnChart` check that would cause the error.
I did notice that, on historical data, plotting text and lines is done correctly (for ES). but for forex instruments there were lines with negative values.
Hopefully someone with a better insight (or more time) can locate the issue.
I did notice that, on historical data, plotting text and lines is done correctly (for ES). but for forex instruments there were lines with negative values.
Hopefully someone with a better insight (or more time) can locate the issue.
Re: DrwText problem when using if (Bars.LastBarOnChart)
BTestOrderProtection is the signal that reproduces this error. It's part of the pln in the original zip.
The other file inside the the solution contains the OrderEx class that handles the order line drawing and DrwText. Each limit order that is created in the signal is enclosed in an OrderEx class instance.
The second study (TestLimitOrders) with the solution contains an updated OrderEx class with the fix. Thanks for your help.
The other file inside the the solution contains the OrderEx class that handles the order line drawing and DrwText. Each limit order that is created in the signal is enclosed in an OrderEx class instance.
The second study (TestLimitOrders) with the solution contains an updated OrderEx class with the fix. Thanks for your help.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: DrwText problem when using if (Bars.LastBarOnChart)
3strategy,
What is the exact version and build of MultiCharts .NET where you have this issue?
What is the exact version and build of MultiCharts .NET where you have this issue?