DONCHIAN + SUPER TREND CODED IN 1 INDICATOR

 

Hi team, I'm experimenting with the coding of the Donchian Channel (Defaulf setup) + Super Trend indicator (Default setup) in one indicator, but I can't find how to have them together, is even the beginning right?

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   4
//--- plot Upper Channel
#property indicator_label1  "Upper"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot Lower Channel
#property indicator_label2  "Lower"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- plot Trend Up
#property indicator_label3  "TrendUp"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrDeepPink
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1
//--- plot Trend Down
#property indicator_label4  "TrendDown"
#property indicator_type4   DRAW_LINE
#property indicator_color4  clrRoyalBlue
#property indicator_style4  STYLE_SOLID
#property indicator_width4  1
//--- input parameters
input int      NoOfBars=8;                                  // D
//--- indicator buffers
double         UBuffer[];
double         LBuffer[];    
//---
double TrendUp[];
double TrendDown[];
double NonTrend[];
//---
int st=0;
//---
int UpDownShift;
//---
extern int TrendCCI_Period=14;
extern bool Automatic_Timeframe_setting;
extern int M1_CCI_Period = 14;
extern int M5_CCI_Period = 14;
extern int M15_CCI_Period = 14;
extern int M30_CCI_Period = 14;
extern int H1_CCI_Period = 14;
extern int H4_CCI_Period = 14;
extern int D1_CCI_Period = 14;
extern int W1_CCI_Period = 14;
extern int MN_CCI_Period = 14;
 
  1. Please edit your existing post and use the "</>" icon from the toolbar (or use Alt-S) to insert the code properly. It is very difficult to read code when you just past it as normal text.
  2. The real "SuperTrend" does not use CCI. For some reason someone created a CCI variant in the past and called it SuperTrend too, but that is not the original developed by Olivier Seban, which only uses ATR and the median price and nothing else.
 
Fernando Carreiro:
  1. Please edit your existing post and use the "</>" icon from the toolbar (or use Alt-S) to insert the code properly. It is very difficult to read code when you just past it as normal text.
  2. The real "SuperTrend" does not use CCI. For some reason someone created a CCI variant in the past and called it SuperTrend too, but that is not the original developed by Olivier Seban, which only uses ATR and the median price and nothing else.

1. Done.

2. I have 9 Super Trend indicators from vaious websites, all of them are based on CCI, I'll look up for one ATR-based ST, but in this case, the CCI-based ST works for me.

 
P Ter Almeida Granados:

Hi team, I'm experimenting with the coding of the Donchian Channel (Defaulf setup) + Super Trend indicator (Default setup) in one indicator, but I can't find how to have them together, is even the beginning right?

You can use it with iCustom 

example

 NewindBuffer01[i]=iCustom(NULL,0,"ind1",0,1,i);
 NewindBuffer02[i]=iCustom(NULL,0,"ind1",0,2,i);

 NewindBuffer03[i]=iCustom(NULL,0,"ind2",0,1,i);
 NewindBuffer04[i]=iCustom(NULL,0,"ind2",0,2,i);
 NewindBuffer05[i]=iCustom(NULL,0,"ind2",0,3,i);
 .
 .
 
P Ter Almeida Granados: 2. I have 9 Super Trend indicators from vaious websites, all of them are based on CCI, I'll look up for one ATR-based ST, but in this case, the CCI-based ST works for me.
Reason: