HOW to Update Plotting

Questions about MultiCharts and user contributed studies.
User avatar
CrazyNasdaq
Posts: 262
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 80 times

HOW to Update Plotting

Postby CrazyNasdaq » 20 Apr 2017

I'm searching a way to update the TLines and texts of my code without RECALCULATE all the code.
I have a code which identifies some levels at certain conditions and when it finds that level, it plots an orizontal trendline with some text at the end of the trend line. This way the code claculate the level only one time (when it happens ) and plots the trend line instantly.
The problem comes out when the market moves on without finding new levels. the price overcomes the TLines and the text.
I was wondering if there is a way to re-plot/Refresh only the trend lines and text without recalculate all the code. For now I've set a condition to recalculate all the code with the script "RECALCULATE" on certain conditions, but it's not the best and quick .
Attachments
2017-04-20_10-02-20.png
2017-04-20_10-02-20.png (11.57 KiB) Viewed 347 times

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: HOW to Update Plotting

Postby TJ » 20 Apr 2017

CrazyNasdaq wrote:I'm searching a way to update the TLines and texts of my code without RECALCULATE all the code.
I have a code which identifies some levels at certain conditions and when it finds that level, it plots an orizontal trendline with some text at the end of the trend line. This way the code claculate the level only one time (when it happens ) and plots the trend line instantly.
The problem comes out when the market moves on without finding new levels. the price overcomes the TLines and the text.
I was wondering if there is a way to re-plot/Refresh only the trend lines and text without recalculate all the code. For now I've set a condition to recalculate all the code with the script "RECALCULATE" on certain conditions, but it's not the best and quick .



you can use these keywords:

TEXT_SETLOCATION
TL_SETBEGIN
TL_SETEND

User avatar
CrazyNasdaq
Posts: 262
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 80 times

Re: HOW to Update Plotting

Postby CrazyNasdaq » 20 Apr 2017

Hi TJ thanks for the answer, but those scripts don't solve the problem because they set the location only once (on the time when the condition is met), but if the market moves forward, the location don't because it was set in the time when the condition was met. I've set the text on LastcalcDateTime, but the LastCalcDateTime of the condition is not the LastCalcDatetime after the condition with new bars entered the market, so the scripts : Text_SetLocation, TL_setBegin, TL_setEnd don't solve the problem to refresh only the TL and Text. Thanks anyway

User avatar
CrazyNasdaq
Posts: 262
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 80 times

Re: HOW to Update Plotting

Postby CrazyNasdaq » 21 Apr 2017

So there is NO SOLUTION to do what I'm trying to achieve ?
IT CAN'T BE DONE ?
The Topic has been tagged as "SOLVED", but it's not solved at all !!!!

User avatar
JoshM
Posts: 2089
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1485 times
Contact:

Re: HOW to Update Plotting

Postby JoshM » 13 May 2017

CrazyNasdaq wrote:those scripts don't solve the problem because they set the location only once (on the time when the condition is met), but if the market moves forward, the location don't because it was set in the time when the condition was met. I've set the text on LastcalcDateTime, but the LastCalcDateTime of the condition is not the LastCalcDatetime after the condition with new bars entered the market, so the scripts : Text_SetLocation, TL_setBegin, TL_setEnd don't solve the problem to refresh only the TL and Text. Thanks anyway

It's true that the `Text_SetLocation()`, `TL_SetBegin()` and `TL_SetEnd()` keywords can set the location only once, but their use is not limited to that. After you've made a text box or trend line, you can use those keywords to update the location of the drawings.

Looking at the image and the description of the indicator, I'd store the numerical IDs of the text boxes and trend lines in two arrays (one for text boxes and one for trend lines). Then at the close of each price bar, I'd loop through those arrays and update the drawing locations with those three keywords.

That would give an efficient script since only one calculation per price bar would be needed to update the locations of the drawings.

Hope this helps. (If it doesn't, let us know. :) )
These users thanked the author JoshM for the post:
CrazyNasdaq

User avatar
CrazyNasdaq
Posts: 262
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 80 times

Re: HOW to Update Plotting

Postby CrazyNasdaq » 13 May 2017

Great Suggestion JoshM !!!!
Thank you very much .


Return to “MultiCharts”