Set firstbar for Owner-draw indicator

Moderator: admin

Set firstbar for Owner-draw indicator

Postby Gidien » Tue Feb 21, 2017 5:38 am

Hi,

Is it possible to initialize the firstbar which is drawn in a owner-draw indicator?

Explanation:
I wrote a point and figure view indicator and set is as owner-draw indicator. After loading the history and calculation the point and figure data, the indicator will have 1000 bars.
If the indicator is loaded the first time, then it will draw the whole data to the screen(1000 bars). This make the indicator unreadable. I have allways to zoom in to the chart to see only last 50 bars.

Is there a way to setup the owner-draw indicator,maybe in the Draw(stage,context) function, to show only the last 50 bars at the first time?

best Guido
Gidien
FXCodeBase: Confirmed User
 
Posts: 106
Joined: Mon Feb 08, 2010 7:39 am
Location: Hamburg

Re: Set firstbar for Owner-draw indicator

Postby Apprentice » Wed Feb 22, 2017 4:40 am

Sure.
However I should see the exact implementation.
U can use loop like this.
Code: Select all
for period=source:size()-1-Look_Back_Period,source:size()-1,1 do
end
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Set firstbar for Owner-draw indicator

Postby Gidien » Wed Feb 22, 2017 5:37 am

Sorry didn't understand the solution.

Lets take my point and figure indicator.
viewtopic.php?f=17&t=31328&hilit=point+and+figure

In this indicator i create a new candlegroup.
instance:createCandleGroup("pf,"..bs..","..rc, "pf", open, high, low, close, volume, "PF", false);
If the boxsize is small then the candlegroup can have more then 500 bars(candles).

If the view indicator is loaded the first time , then all created bars are drawn.
It looks like this.

firstload.png


I have to zoom into the chart after the first load.
Then it looks like this.

afterzoom.png


My intention is not to limit the available bars(candle) of the indicator. My intention is to draw only the last x bars of all available bars at the first load. It should look like the zoom picture at the first load.

best
Guido
Gidien
FXCodeBase: Confirmed User
 
Posts: 106
Joined: Mon Feb 08, 2010 7:39 am
Location: Hamburg

Re: Set firstbar for Owner-draw indicator

Postby Apprentice » Tue Feb 28, 2017 4:49 am

Can you share your code.
Will fix it for you.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Set firstbar for Owner-draw indicator

Postby Gidien » Wed Mar 01, 2017 3:26 am

Here it is.

PF_SOURCE.lua
(23.3 KiB) Downloaded 920 times
Gidien
FXCodeBase: Confirmed User
 
Posts: 106
Joined: Mon Feb 08, 2010 7:39 am
Location: Hamburg

Re: Set firstbar for Owner-draw indicator

Postby Apprentice » Fri Mar 03, 2017 6:06 am

PF_SOURCE.lua
(23.51 KiB) Downloaded 931 times

I introduced LookBack period.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Set firstbar for Owner-draw indicator

Postby Gidien » Fri Mar 03, 2017 7:57 am

Sorry, but this is not a solution. This is not what i was looking for. You can do the same thing with my indicator by changing the "Date From" parameters. Its the same thing. Maybe my english is to bad to explain what i want.

Your solution or changing the "date from" parameter will only reduce the size of the source data bars from which the point and figure bars are calculation. At the end we will have only some point and figure bars(columns). BUT you cannot go back in the time to see what happens earlier in the point and figure chart.

best

Guido
Gidien
FXCodeBase: Confirmed User
 
Posts: 106
Joined: Mon Feb 08, 2010 7:39 am
Location: Hamburg

Re: Set firstbar for Owner-draw indicator

Postby Apprentice » Mon Mar 06, 2017 6:59 am

U can introduce "to".
Use renco candles as a reference.
Or u can use Left/Rigth LookBack Period.
PF_SOURCE.lua
(23.92 KiB) Downloaded 876 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 11 guests