Risk warning

All articles, strategies and indicators are just reflecting a single traders opinion and should be viewed as that.
I advice everybody to trade with a DEMO account!

Thursday, May 19, 2011

How to make your own super indicator.

Why fill up the chart with so many indicator that are blocking your view on the chart? Why not combine them in an indicator. You write down the reasons why you prefer a short or a long and you put them all together. Lets give an example.

Assume that a trader likes to go long when:
  1. relative strength >50
  2. moving average is going up
  3. fast stochastic < 70
  4. the previous bar was bullish

That means he likes to go short when:
  1. relative strength <50
  2. moving average is going down
  3. fast stochastic >30
  4. the previous bar was bearish

Now lets provide a basic template you can use for this. Remember you can fill in you own rules. The rules above are just an example. How does this work? You just leave all the code as it is. The red part are the rules above. You can remove rules or you can add rules. As you see the part in red isn't hard to understand. The first red part is where the indicator is initialized. The second part is the logic for deciding to go long or short.

===============================
indicator super_indicator;
/*written by ctlprogrammer*/
/*you can freely copy the code but plz leave this header*/
/*http://ctltrading.blogspot.com*/
input smooth_period = 1;
draw line1("super_long"),line2("super_short");
begin
integer f := front(close);
integer b := back(close);
integer super_long,super_short;
series temp1,temp2;


Fast_Stochastics();
Relative_Strength();
Mov_Avg_Exponential(close,200);

for f:=1 to b do
begin
super_long:=0;
super_short:=0;


if Mov_Avg_Exponential.line[f-1]<Mov_Avg_Exponential.line[f] then super_long:=super_long+1;
if Mov_Avg_Exponential.line[f-1]>Mov_Avg_Exponential.line[f] then
super_short:=super_short+1;

if Relative_Strength.line[f]>50 then super_long:=super_long+1;
if Relative_Strength.line[f]<50 then super_short:=super_short+1;

if Fast_Stochastics.line_d[f]<30 then super_long:=super_long+1;
if Fast_Stochastics.line_d[f]>70 then super_short:=super_short+1;

if close[f]>open[f] then super_long:=super_long+1;
if close[f]<open[f] then super_short:=super_short+1;

temp1[f]:=super_long;
temp2[f]:=super_short;
line1 := ema(temp1,smooth_period);
line2 := ema(temp2,smooth_period);
end;
end.
===============================

If you want to remove a condition just delete it. The indicator will still work. You can add indicators or conditions too. An example will help understand.

In chart studio you can choose out of a list. If you double click on them the code appears. When you look at the input line of the indicator you can see how many inputs it has. For example the ADX:

indicator Directional_Movement_ADX;
input period = 14;
draw line("ADX");
begin
  line := mma(dirmov_DX(period), period);
end.


Has 1 input , the period. If you use this indicator without specifying what period you want the default for the period will be used. In this case 14.


So if we want to add the Directional_Movement_ADX to our super_indicator we add to the first red part the following line.

Directional_Movement_ADX();
or
Directional_Movement_ADX(20); 
(if we don't want to use the default but 20 as period instead)

In the second red part we add the condition.

if  Directional_Movement_ADX.line[f-1]<Directional_Movement_ADX.line[f] then super_long:=super_long+1;
if  Directional_Movement_ADX.line[f-1]>Directional_Movement_ADX.line[f] then super_short:=super_short+1;


You don't need to change anything else......READY TO USE

 If you added and removed all the indicators just click on the install button in chart studio. You can open dealbook now and you can add your super indicator to the chart. If you want to smooth the indicator just make the period bigger. The indicator you just made is advising to go long when the super_long line of your super indicator is above the super_short line. It advices to go short when the super_short line is above the super_long line of your indicator.

The only thing to do now is to back test. After that you can try it out on a demo account.

If you have made a SUPER indicator. Please be so kind to share with us. Thanks

No comments:

Post a Comment