Problem with changing a value of variable

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

Problem with changing a value of variable

Postby MaRCHeW » 30 Mar 2014

Hi :)

I've used RSI function in my test indicator and I've set the length field on 1 value in StartCalc function.
Then I've changed this value in CalcBar function on 50.

When I put this indicator on the chart I received the RSI indicator with the length equal 1.
Could you tell me why the length variable has still 1 value?
Does it a problem with MC or normal behaviour?

Regards
Karol Marchewka
Attachments
Tester.pln
(1.15 KiB) Downloaded 463 times
screenshot2.png
(101.31 KiB) Downloaded 497 times
screenshot1.png
(21.06 KiB) Downloaded 500 times

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

Re: Problem with changing a value of variable

Postby Henry MultiСharts » 31 Mar 2014

Hello Karol,

That is expected behavior. As we have already discussed it in a different thread - you just need to have two calculations of the function with the length you need, then plot the results based on condition whether it is real-time calculation or historical calculation.

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

Re: Problem with changing a value of variable

Postby MaRCHeW » 01 Apr 2014

Hi Henry :)

Frankly speaking I'm still wondering how your clue with IApplicationInfo.IsRealTimeCalc property can help me solve my problem and I don't see solution :/

Regards
Karol Marchewka

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

Re: Problem with changing a value of variable

Postby Henry MultiСharts » 03 Apr 2014

That is not possible to change the RSI parameters during the calculation as there are variables dependent from the Length value that are calculated once in StartCalc method.

There are two ways to achieve the results you need:
1) create two RSI instances - one with length 55 plotted only on historical data, second one with length 10 plotted only in realtime. Check if current calculation is historical calculation or real-time calculation using IApplicationInfo.IsRealTimeCalc Property. Please find the example attached.
2) change the RSI indicator so that the variables dependent from the Length are recalculated after the Length is changed.
Attachments
RSI_ChangeLength.pln
(1.3 KiB) Downloaded 475 times


Return to “MultiCharts .NET”