TriggerLines

KelvinHand

Well-Known Member
#1
Hi,
Found from:
http://www.forex-tsd.com/metatrader-4/860-2-lsma-color-indicator.html

Code:
//+-------------------------------------------------------------------+
//|                                                     Trigger Line                  |
//|                             Copyright  2005 dwt5 and adoleh2000 |
//|                                        http://www.metaquotes.net        |
//| Modified by Kelvinhand                                                      |
//+-------------------------------------------------------------------+
#property  copyright "Copyright  2005 dwt5 and adoleh2000 "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window
#property  indicator_buffers 4            
#property indicator_color1 Red      
#property indicator_color2 Red
#property indicator_color3 DeepSkyBlue
#property indicator_color4 DeepSkyBlue

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double wt[];
double lsma_ma[];

extern int Rperiod = 55;
extern int LSMA_Period = 144;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- 7 additional buffers are used for counting.
   IndicatorBuffers(6);   
   
//---- drawing settings
   
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
   
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1);
     
   SetIndexBuffer(4,wt);         
   SetIndexBuffer(5,lsma_ma);
   
//---- initialization done
   return(0);
  }

int start()
{ 
  
  //***** Modified by Kelvinhand ***********************
   int counted_bars = IndicatorCounted();
   //---- check for possible errors
   if (counted_bars<0) return(-1);
   
   //---- last counted bar will be recounted
   if (counted_bars>0) counted_bars--;

   int i,j;
   double lengthvar;
   double sum ;
   
   int limit = Bars - counted_bars - Rperiod;
      

      for(i = limit; i >= 0; i--)  //  MAIN For Loop
      { 
         sum = 0;                                              
         for(j = Rperiod; j >= 1  ; j--)             //LSMA loop
         {
         lengthvar = (Rperiod + 1)/3.0;                               //lengthvar = 21  
         sum+= ( j - lengthvar)*Close[Rperiod-j+i];         //tmp = 20 - 7 * close[20-j+i]
         }
         wt[i] = sum*6/(Rperiod*(Rperiod+1));  
         lsma_ma[i] = wt[i+1] + (wt[i]-wt[i+1])* 2/(LSMA_Period+1);
  
            ExtMapBuffer1[i] = wt[i]; 
            ExtMapBuffer2[i] = lsma_ma[i]; 
            ExtMapBuffer3[i] = wt[i]; 
            ExtMapBuffer4[i] = lsma_ma[i]; 
            
            if (wt[i]  < lsma_ma[i])
            {
                ExtMapBuffer4[i] = EMPTY_VALUE;
                ExtMapBuffer3[i] = EMPTY_VALUE;
           }          
        
        }
  }
//+------------------------------------------------------------------+



I found this indicator for MT could not find it for amibroker howmuch ever searched, its named as FX Super CrossOver for MT.......if someone has this can u please share it here......posting the screenshots of the indicator.
 
Last edited:

KelvinHand

Well-Known Member
#5
Hi Kelvinhand,

Sorry.

What you mean? I did not get it.

Regards.

What i do in this public forum, there will be people copy and paste to somewhere.
it is ok since expected in the public.

But Ignore Coder's hardwork, and don't recognize Coder's effort.
So i drop the respectable letter from "Fxxx"


See the comment 15 & 16
http://www.wisestocktrader.com/indicators/3268-trend-catching-system

See the comment 5 & 7
http://www.wisestocktrader.com/indicators/3320-tma-bands
 
Last edited:
#6
I do understand and I appreciate the hard you do. If it could have been easy I could have done it myself.

Anyways Thanks for your time.

Regards.
 

KelvinHand

Well-Known Member
#7
I do understand and I appreciate the hard you do. If it could have been easy I could have done it myself.

Anyways Thanks for your time.

Regards.
Here is the ProTrader AFL code that for NexGen T3.
http://www.wisestocktrader.com/indicators/3156-protrader-v1-0

There are:
- Trend Bands (Keltner)
- Large Triggers
- Small Triggers

If you extract out the Small Triggers, change the max setting to 200 for TL! & TL2:
Change the default parameters to
TL1 = 55; TL2 = 3;

You will getting very close to the Triggerline indicator

Here the comparison for you in MT4 and Amibroker ( 2 AFLS) in GBPUSD H4 of the sale page:

- Topleft = The MT4 to AFL converted from post#1
- BottomLeft = Protrader ALF given in the wisestocktrader.com
- Right side = MT4 Version

So use the Protrader's AFL Version, no need to reinvent the wheel.

A method is just a method. Still your Mind control the rest.
 
Last edited:

PartTime_Trader

Well-Known Member
#8
Here is the ProTrader AFL code that for NexGen T3.
http://www.wisestocktrader.com/indicators/3156-protrader-v1-0

There are:
- Trend Bands (Keltner)
- Large Triggers
- Small Triggers

If you extract out the Small Triggers, change the max setting to 200 for TL! & TL2:
Change the default parameters to
TL1 = 55; TL2 = 3;

You will getting very close to the Triggerline indicator
Code:
_SECTION_BEGIN("TriggerLines");
r=LinearReg(C, 55);
e=EMA(r, 3);
col = IIf(r > e, colorBlue, colorRed);
Plot(r, "TriggerLine 1", col, styleThick|styleNoLabel|styleDashed);
Plot(e, "TriggerLine 2", col, styleThick|styleNoLabel);
_SECTION_END();
Thanks
:thumb:
 

sabhlok_r

Well-Known Member
#9
Code:
_SECTION_BEGIN("TriggerLines");
r=LinearReg(C, 55);
e=EMA(r, 3);
col = IIf(r > e, colorBlue, colorRed);
Plot(r, "TriggerLine 1", col, styleThick|styleNoLabel|styleDashed);
Plot(e, "TriggerLine 2", col, styleThick|styleNoLabel);
_SECTION_END();
Thanks
:thumb:
thanks for sharing the afl.... I am getting error Ln:4 Col:143 : Error 16 , too many arguments

Any help....