The Coding problem.

Questions about MultiCharts .NET and user contributed studies.
MaRCHeW
Posts: 37
Joined: 16 Nov 2013
Has thanked: 21 times
Been thanked: 8 times

The Coding problem.

Postby MaRCHeW » 03 Mar 2014

Hi :)

I need your help with some coding problem.

I'd like to create indicator which do something like this:
1 step - calculate the Linear Regression for the 55 period value and plot it on the chart.
2 step - if LastBarOnChart has True value then recalculate the Linear Regression for the 10 period value and plot it on the chart.

I've tried use RecalcLastBarAfter method and recalculate the Linear Regression in the custom MyCalc() method but it doesn't work as I expected.

Could you give me a clue how can I do it in MC?
I've attached my source code.

Regards
Karol Marchewka
Attachments
TestReCalc.pln
(1.34 KiB) Downloaded 435 times

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

Re: The Coding problem.

Postby Henry MultiСharts » 04 Mar 2014

Hello MaRCHeW,

You need to create two LinearRegValue - one with length 55 plotted only on historical data, second one with length 10 plotted only in realtime.

MaRCHeW
Posts: 37
Joined: 16 Nov 2013
Has thanked: 21 times
Been thanked: 8 times

Re: The Coding problem.

Postby MaRCHeW » 04 Mar 2014

Hi :)
Hello MaRCHeW,

You need to create two LinearRegValue - one with length 55 plotted only on historical data, second one with length 10 plotted only in realtime.
No Henry, your solution doesn't solve my problem because my previous example is only part of bigger project.

I have to make the first calculation on history data because I need some informations to use them to the second calculation on history data.

Any clue how to do it?

Regards
Karol Marchewka

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

Re: The Coding problem.

Postby Henry MultiСharts » 17 Mar 2014

Hello MaRCHeW,

Please describe the particular difficulty you have.

MaRCHeW
Posts: 37
Joined: 16 Nov 2013
Has thanked: 21 times
Been thanked: 8 times

Re: The Coding problem.

Postby MaRCHeW » 17 Mar 2014

Hi Henry :)
Please describe the particular difficulty you have.
I'd like to use 2 indicators in my Study.
First calculation on history data should give me some parameters from first indicator. These parameters I'd like to use as a settings for the second indicator during second calculation on history data.
The second calculation should starts when the Bars.LastBarOnChart == true.

And the question is: Is is possible trigger recalculation the indicators on the history data? If yes, please give me a clue how can I do it?

Regards
Karol Marchewka

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

Re: The Coding problem.

Postby Henry MultiСharts » 20 Mar 2014

MaRCHeW, that is possible to deferintiate whether now is historical calculation or real-time calculation using IApplicationInfo.IsRealTimeCalc Property.

There is also a known issue with LastBarOnChart that you need to be aware of.


Return to “MultiCharts .NET”