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
The Coding problem.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: The Coding problem.
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.
You need to create two LinearRegValue - one with length 55 plotted only on historical data, second one with length 10 plotted only in realtime.
Re: The Coding problem.
Hi
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
No Henry, your solution doesn't solve my problem because my previous example is only part of bigger project.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.
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
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: The Coding problem.
Hi Henry
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
I'd like to use 2 indicators in my Study.Please describe the particular difficulty you have.
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
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: The Coding problem.
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.
There is also a known issue with LastBarOnChart that you need to be aware of.