The finest in trend trading

Wow I have had my knuckles rapped!

[B]Tymen[/B] below is the code for the slope meter and as I have arranged it in such a way also a function that goes with it. Obviously the two could be incorporated if you so wish.

The figures are obviously meaningless in that they were just used for testing. But you can see how you can add timeframes and the appropriate factor to go with them.

As usual just copy, paste and save into Chartstudio each on a new page.

I am now off out for the day, so will be unable to make any further contact for a few hours.

Regards
Ken

indicator AA_BB_slope_meter_kw ;

input pipdiff = 1.5;

draw zeroline(“zeroline”, solid_line, black,2),
entry_long(“long”, solid_line, green,2),
entry_short(“short”, solid_line, red,2),
res(“slopemeter”, solid_line, blue,2);

vars i(number), pip_fctr(number), avg(series),
tm_frm = timestamp, TF(number), lst(number);

begin
lst := back(close);
if close[lst] <10 then
pip_fctr := 0.0001
else
pip_fctr := 0.01;

TF := (tm_frm[lst] - tm_frm[lst - 1]) / 60;
pipdiff := BB_fn_lookup_TF(TF);

zeroline := makeseries (front(close), back(close), 0);
entry_long := makeseries (front(close), back(close), pip_fctr * pipdiff );
entry_short := makeseries (front(close), back(close), -1*pip_fctr * pipdiff );

avg := sma(close,20);
for i := front(close) + 20 + 1 to back(close) do
res[i] := avg[i] - avg[i-1];
end.

/////////////////////////////////////

function BB_fn_lookup_TF;

input TF(number);

result res(number);

begin

if TF = 15 then res := 1.5;
if TF = 20 then res := 1.8;
if TF = 25 then res := 2.0;
if TF = 30 then res := 2.4;
if TF = 35 then res := 2.8;
if TF = 40 then res := 3.5;
if TF = 45 then res := 4.0;

end.

Not at all [B]Ken DoubleU[/B] !!

It is I who made the silly error in not realising that you did not yet have 50 post. :o :o
So its my fault, not yours!! :wink:

When you get a chance to post again, could you explain to me 2 things so that I can learn further…?

  1. Regarding this statement…

    [B]tm_frm = timestamp, [/B]

Does the program know what timeframe you are using, by inputting the above formula?
What is “timestamp”?

  1. Can you explain this line…?

[B]lst := back(close);[/B]

I understand front to back but this one only has “back”.

This part below is a little mysterious but I will try to work it out…:slight_smile:

[B][B]TF := (tm_frm[lst] - tm_frm[lst - 1]) / 60;
pipdiff := BB_fn_lookup_TF(TF);[/B][/B]

Interesting that the number [i] has not been used for the DO LOOP here.

[B]Tymen[/B] I will be pleased to give an answer the the above points as I know how difficult it can be to learn the programming language that goes with ChartStudio. I have spend hours and hours over a single line of code that appears not to work. But with perseverance usually get there in the end.

As we have been out all day I will be on ‘domestic duties’ until later this evening and give a full reply then. May be after your bed time though!

Regards
Ken.

Have I ever said that I am Italian ?? :confused:
I dont know any italian word. :slight_smile:

Hi Ken and all :slight_smile:

When I login it takes some time to show anything. First I can see account number but all other information is stateds as “N/A”. Then later (it takes 1-3 min) window displays USD value and USD is my chosen currency.

Ken, can you explain little more how to add function to the indicator code and then how to install both indicator’s code and function BB_fn_lookup_TF together :confused:
thanks

[B]Tymen[/B]

I will try my best to answer to the questions that you have posed:

[B]tm_frm = timestamp[/B]

Here we are, in the section of the program that defines the variables, creating a new [U]series[/U] that is equal to the [B]timestamp[/B].

[B]timestamp[/B] is a [U]system global constant[/U] that is available as part of the description of a chart (when attaching an indicator or a strategy). The [B]timestamp[/B] is given in [I]seconds[/I] from a reference time (January 1, 1970) and each time a new time period starts (the start of a new candle) a new [B]timestamp[/B] is issued.

So from this one line of code we have now created a new series of [I]timestamps[/I] that match the start of each candle. [I will say more about timestamps and this series when I answer your third point]

[B]lst := back(close)[/B]

in this line of code we are setting a variable “lst” and this variable is traditionally used as an abbreviation for “last”. In other words it is the last item (or index) in a series.

[B]back[/B] is a function that will return the index of the [I]last[/I] element in a series. Often [B]close[/B] is used [I]as the series[/I] but it would work just as well if you used [B]high[/B]; [B]low[/B] or [B]open[/B]. What we are interested in is the i[I]ndex number[/I] that represents the [I]last candle[/I].

As you already have found out you can use “front” to represent the first candle in a series. And hence you can use both “front” and “back” (with the series – [B]close[/B]) to perform calculations on a series (in your case, the series [I]avg[/I]).

[B]TF := (tm_frm[lst] - tm_frm[lst - 1]) / 60;
pipdiff := BB_fn_lookup_TF(TF);[/B]

now going back to the first item that I was explaining – [B]timestamp[/B]. In the first line we are setting the variable TF to be the timeframe of the currency pair that we are using. As mentioned previously “lst” is used to represent the last element in a series – in this case the series tm_frm which has been produced from the [I]system global constant[/I] " [B]timestamp[/B]".

By subtracting the penultimate element from the last element, we have the time of a candle in seconds. And hence by dividing by 60 we get the number of minutes for a candle i.e. the [B]timeframe[/B].

the second line is to find the correct “pippdiff” for the particular timeframe that we are using. This uses a [I]function[/I] as a [I]lookup table[/I]. By examining the code in the function you can see a list of [B]if[/B] [I]statements[/I] that can then update “pippdiff” according to the timeframe used. Although the indicator has an [B]input[/B] “pippdiff” = 1.5, this initial value will be updated, unless we are actually on a 15 minute timeframe.

[B]Interesting that the number [i] has not been used for the DO LOOP here.[/B]

All elements of a series have an index enclosed in square brackets. that is one reason why often “i” is used. In this case we are not actually looping but we are addressing the last and penultimate elements directly hence [lst] and [lst-1] are used.

I hope that this is clear; if not let me know.

Regards
Ken.

[B]RenaLa[/B] after you originally raised this query with regard to currency display and a start-up time, I observed my own situation. Initially yes you are correct “N/A” is displayed. Then after a delay – about 30 seconds – the correct amount is shown in the currency (GBP in my case). If your computer is taking as long as you suggest, I feel that there must be some problem with either your Internet connection or the operating speed of your PC.

As [B]Tymen[/B] is currently developing his system I feel that the “official” issue of this new indicator, together with the accompanying function, should be up to him. As you may have gathered from the posts on the thread, I was unable to send this to him directly as I have insufficient postings to PM the indicator to him.

Therefore, I think that when he has prepared the relevant factors to match each timeframe, will be the time to officially replace the current indicator. As you are aware this has only been designed for the 15 M timeframe. The testing figures that I have included in the function for the new indicator are purely fictional (for testing purposes only). Therefore this new indicator offers nothing over the one that you are currently using.

So when [B]Tymen[/B] is ready to issue this, I am sure he will detail how it should be installed and used.

Ken.

As stated by Tymen, mid BB is critical to know if our trade have probabilities to end with a profit or we could face a retracement.

With so much work being put into this, could we extract some rules to make this indicator serve us as a visual aid to enter trades when in squeeze areas where the mid BB is not completely levelled?

That way, but only as an aid and not a deciding factor! :D, it could probably help to make more secure entries to those like me who don’t have enough experience at the moment to discern Price Action just by sight.

Any input? what others think?

A few observations I discussed with Tymen a while ago and I’ll restate them here as they apply to what you are saying Aserat:

Making CBL’s during a squeeze is the best chance to get the best cbl and entry before a BB walk of any type or to play a range. However, remember that the mid BB is essentially a 20 simple moving average which means once the PA moves in a particular direction, as indicated by the mid bb slope, you will no longer have the option for cbl entry.

Tymen’s ultimate BB walk method should be incorporated and used for entry once PA starts to move long or short. The sharper the mid BB slope the sharper the PA movement, you need to get in on this movement and traditional CBL will not provide you entry for the move. Once a trend short or long finishes you will see a PA start to move against the mid BB, however you cannot take these trades as they are No Trade Zones since you are taking a position counter to the prevailing trend as indicated by the mid bb.

Tymen’s rules for a bb walk have been great in entering the walks and opening op more opportunity. It will be interesting to see if Tymen agrees with Ken in regards to the values of other TF to measure slope differences.

Sorry about that. :o :o

I am not sure where I got that from.
So where are you located?

[B]ken doubleU[/B], you are a timely and extemely valuable asset to this thread. :slight_smile:

You have answered my questions beautifully!! :wink:
Thank you heaps for taking the time and trouble to do so!!

As a retired teacher of maths and physics, I understand your explanations perfectly!!
Each bit you explain adds more capability to my programming.
I hope to put it to good use!! :cool:

I wonder if you have had any extra help in your learning since the GFT chart studio manual does not explain these things very well at all?

There may yet be the odd time in the future when I need to ask you another programming question. :wink:

[B]Tymen[/B]

Purely self taught! I only have the ChartStudio help, but I have met problems that have taken me days to puzzle out. I just keep trying and trying until I get the eureka moment!

[B]Tymen[/B] do ask if you meet any other problem, as it may be something that I have met previously: there is no need for you to reinvent the wheel!

Regards
Ken

[B]Wow!!
Well done!! [/B] :slight_smile: :slight_smile: :slight_smile:

I only have the ChartStudio help, but I have met problems that have taken me days to puzzle out.

I don’t have the time to do that so it is great that you are here…as you say…

there is no need for you to reinvent the wheel!

You came on this thread at exactly the right time so I can’t help feeling that Divine intervention sent you here!! :smiley:

I have now worked out a stoploss line that gives excellent exits on the BB bubble/sausage profit grabber method. (I am thinking of renaming this to the [B]BB Expansion method[/B] - comments welcome.)

The exit line operates very simply - you draw an extension line from every completed candle.
Should the live price action cross the extension line you then exit.

There are 2 lines - Stoploss LONG and Stoploss SHORT.
Each is a separate program and you load the correct one on your chart according to whether you are going long or short.

Before I give the programs I will show how it works on some charts…

How about the [B]DNA Profit Walk[/B]? :smiley:

Here is the first example of how this method works.
We have a LONG example >>>

The signal candle = S.
At this point we see the outer BB expanding, the mid BB going up.
We are ready to enter.
So we load the Stoploss LONG indicator that I am going to publish next.

Entry candle = E.
We dispense with the 1.5 BB rule and enter at the OPEN.

If you are using more than one contract you can improve on the entry with a better one as the price action goes inwards.

As each candle closes, a stoploss extension line is drawn as shown.
The stoploss is placed at these extension lines and hence trails the price action.
The price action does not cross the extension lines until much later.

Exit Candle = X.
Here the stoploss extension line from the previous candle is crossed by the price action.
That is the signal to exit.

This method then, is a very SEXy method!! :smiley: :smiley: :smiley:

A great name, [B]Merchantprince[/B]!! :slight_smile: :slight_smile:

[B]I will adopt it immediately!![/B] :cool: :cool:

Another example - overall, this method give superior exits to the PSAR method. >>>

In this chart the signal candle is really too sudden - we are looking for a nice stepwise increase to the upper BB.
Nevertheless, the method works.

Signal = S.
Entry = E.
EXit = X.

Yes, its the SEX method. :stuck_out_tongue: :stuck_out_tongue: :smiley:

Another example - again the signal candle is really too sudden without a stepwise increase >>>

The same procedure as before.
The top wick of the exit candle is crossed by the stoploss extension line.

Another example >>>

In this case, candle A is not a signal candle because the lower BB is not showing any real signs of expansion.

Here we have the case going short >>>

Same rules as above.

I could post more of these examples but it gets laborious. :frowning:

I think it is simple enough to understand!! :slight_smile: