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 .
HOW to Update Plotting
- CrazyNasdaq
- Posts: 321
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 89 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: HOW to Update Plotting
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
- CrazyNasdaq
- Posts: 321
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 89 times
Re: HOW to Update Plotting
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
- CrazyNasdaq
- Posts: 321
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 89 times
Re: HOW to Update Plotting
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 !!!!
IT CAN'T BE DONE ?
The Topic has been tagged as "SOLVED", but it's not solved at all !!!!
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: HOW to Update Plotting
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.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
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. )
- CrazyNasdaq
- Posts: 321
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 89 times