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
Problem with changing a value of variable
Problem with changing a value of variable
- Attachments
-
- Tester.pln
- (1.15 KiB) Downloaded 468 times
-
- screenshot2.png
- (101.31 KiB) Downloaded 497 times
-
- screenshot1.png
- (21.06 KiB) Downloaded 500 times
- 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
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.
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.
Re: Problem with changing a value of variable
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
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
- 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
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.
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 479 times