mods to CTF View

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

mods to CTF View

Postby kaspo99 » Fri Dec 01, 2017 7:30 am

Hi Programmers Apprentice
I have a request for some coding help, which concerns the Custom time Frame View.
I keep coming back to modifying the Custom Time Frame View extension.
What I have already done is I have modified this, so that for example I create a separate view for time frame ranging from m5 to m50.
I have been using this for a while now but keep tweaking to get to my ideal configuration.
In this I have several drop down menus I have made, one which has 10 entries for changing the tf multiplier.
Then a second for changing the desired output tf, again with 10 entries.
And third, I have a dropdown for the tab label, again with 10 entries.
Then what I have done is all these dropdowns have been modified so that they all display one of 10 entries, because the code has been written so that by choosing the m5 on the base tf I automatically choose m5 time frame base.
Then on the second by choosing the m5 on the output tf dropdown, this again automatically chooses the correct multiplier, in this case 1 to make m5 (base tf) x 1 (Output TF multiplier) equals m5.
And last the corresponding label which also says m5 so that the tab displays the m5 text, again automatically.
So all 3 corresponding dropdowns say m5, and every different tf has a different set of dropdowns.
And so on for all the other entries.
For example if I choose the m30 tf then all 3 dropdowns have a selection of m30 on all 3 of these dropdowns.
This way I do not need to work out any changes mentally as I change tf's, as they are now presets.
When I use the version that has H6 as the base it gets tedious doing mental calculations while changing the parameters which is why I have done this, almost foolproof.
So here is the problem however, and this concerns changing the date range so that all tf's can display the same amount of bars on the chart.
Say I wish to view 500 bars across the chart, and this number on my charts compresses the x-hair double vertical lines until they just become one vertical line, then all the time frames I choose need to be set like this so that I do not need to constantly adjust the tf and then fiddle with the calendar range, as this gets tedious especially when I flick through a few tf's like this.
I am constantly adjusting the range value as the view defaults to showing all the available range, so changing from even the m5 to the m50 is a vast jump in the displayed number of bars.
So for each version I have limited the range in the code.
So the problem is I am unable to modify the range part of the code to produce a preset dropdown like I have for the other parameters.
The calendar dropdown is hit and miss whereas I would like to specify a certain number of bars for each tf, and not have to flick up or down.
The other 3 operations are relatively painless and super quick, so have been playing with the code for a while on and off to achieve this with the range parameters but with no luck yet.
I am not necessarily asking for this to be done but rather asking how to do this as this benefits my coding this way.
In fact the end goal is to be able to combine all these presets so that just by choosing the label value dropdown all the other parameters are auto selected.
I have enclosed the modded version of this as far as I have been able to get.
I use 5 of these ranging from m5 all the way up to D4, and all these versions use a different base tf for the calculations with their corresponding multipliers and labels, and the range is kind of chosen to minimise this jumping around with the displayed bar range.
regards
kaspo99
hey Apprentice hope you are keeping well
Attachments
ctf at moment.png
01 - ( m5 - m50 ) - 30.lua
(6.54 KiB) Downloaded 319 times
kaspo99
 
Posts: 29
Joined: Fri Mar 28, 2014 8:36 pm

Re: mods to CTF View

Postby kaspo99 » Sun Dec 03, 2017 3:33 pm

Hi Apprentice
here is an update so you know what I have already tried to do.
I have tried various ways to create add alternative date in Init but seems date is not one of the parameters that supports add alternative.
I have also tried blanking out date group in Init and instead using if then else if statement in
function Prepare(onlyName), and this alters the date range to minimal but cannot seem to effect any change, and these are combined with the multiplier and time frame base also.
So tf and multiplier change as desired and once I click the right label it loads nicely, but bars range stays the same, even when the tf changes and other conditions are met.
So seems it is locked to a default date range despite everything else functioning and changing as desired.
I keep looking at the code and I just know the solution is right in front of my eyes, maybe not concatenated properly or something.
Will see.
Any way thanks for any input you can provide on this issue.
regards
kaspo99
kaspo99
 
Posts: 29
Joined: Fri Mar 28, 2014 8:36 pm

Re: mods to CTF View

Postby Apprentice » Wed Dec 06, 2017 6:28 am

01 - %28 m5 - m50 %29 - 30.lua
(7.68 KiB) Downloaded 311 times

Something like this?
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36437
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: mods to CTF View

Postby kaspo99 » Wed Dec 06, 2017 8:25 am

Hi Apprentice
Yes, exactly like that.
It works and I can increase the bar count so now I will integrate the functions a little.
So thanks very much for that.
So 'step' was missing from core host execute line was it? line 114 or 115

instance.parameters.bars * Step,

what does that star symbol do to the parameter?
Will search lua documentation now and find out what you did.
I only managed to get function working with -1 and 1 integer, so will learn something from this I think.

regardless, will play with this now and get closer to one click mode, nice.
Much appreciated, thanks again.
regards
kaspo99
kaspo99
 
Posts: 29
Joined: Fri Mar 28, 2014 8:36 pm

Re: mods to CTF View

Postby kaspo99 » Wed Dec 06, 2017 10:29 am

Hi Apprentice
Here is the Custom Time Frame Candle view from the codebase, but modded with your new bit of code.
As far as I can see ( Checked side by side in Notepad++ ) this is correct and in my opinion makes a splendid mod to CTF view.
I am sending this so as to save you the time to update this yourself.
Much appreciated and thanks again.
regards
kaspo99
I hope it saves a bit of time, and I have also added the CTF version with the short tab-text visible in marketscope.
Attachments
Custom Time Frame Candle View.lua
(6.5 KiB) Downloaded 349 times
CTF.lua
(6.5 KiB) Downloaded 321 times
kaspo99
 
Posts: 29
Joined: Fri Mar 28, 2014 8:36 pm

Re: mods to CTF View

Postby kaspo99 » Thu Dec 07, 2017 11:07 am

Hi Apprentice
Here is a version with lots of presets, ranging from m1 right up to D20.
I have tried to be as logical with the time frames as possible and they use base tfs from m1 to m5, m15, m30, H1, H6 and D1.
This is how I use CTF so am comfortable with these, and not too many omissions.
I will try to get the tab text-profile id a bit shorter as I feel the ICTF letters could go, and then tab is as short as can be.
myself I show only the tf and nothing else but this is for the public so will leave like this as is, just lose the ICTF letters.
The letters ICTF stand for Integrated Custom Time Frames.
I have gone through the whole lot and they all work and I have compared them to CTF single tfs, if you know what I mean.
I am fairly sure the snippet of code I have used is okay as well but no guarantees, so maybe you could double check this please if you have a spare minute.
The tfs change-over averages about 5 or 6 seconds for the base m1 tfs, and quicker as the base increases.
2 to 3 seconds is pretty good for all the other bases I think.so am pleased with this.
H1 and upwards is almost instant change over and update.
Finally, there appear to be only 2 obstacles left now to being fully one click custom time frames and these are;
1) the gap from the edge of the chart to the first bar appears to be 10 to28 bars, depending on the number of bars being used in the settings, but I am still trying to get the chart shift feature up and running for this so as to be able to adjust the offset to suit myself.
This ended up being still born from last year if you remember, but maybe it could be revived.
ie I trade with the chart scrunched up at 500 bars and the gap-offset is more like 100 to 150 bars, so first bar is almost a third of the way in, leaving plenty room at right hand side.
2) again we spoke briefly about a feature that could place 2 buttons on the platform, to increase or decrease tf's, like the zoom in-out buttons from the tool bar.
Maybe now as it is several steps closer to being one click we could discuss these last 2 options again do you think?.
Anyway, if there were no further work done on this by you or me I am still more than happy with the end result so far now.
So will leave this with you for now, while I tinker away by myself.
All the best and thanks again.
regards
kaspo99
Attachments
ICTF.lua
(19.29 KiB) Downloaded 327 times
kaspo99
 
Posts: 29
Joined: Fri Mar 28, 2014 8:36 pm


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 25 guests