Re: MT4 Indicator requests and ideas

7731
euro_rapp wrote: Wed Dec 18, 2019 5:58 am I have some idea.

But i need your help. This system is used by an Hedge Fund and i want to rebuilt it. For this i need to use PZ Turtle Indicator which Lopez released the Quellcode for free. It was not decompiled! But the candles should not penetrate the Bollinger Stop. I cant find the line where it tells the BB stop to respect the wicks. A solution would be may to shift the BB stop line to the left.

Code: Select all

//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 DarkSlateGray
#property indicator_color4 DarkSlateGray
#property indicator_color5 DodgerBlue
#property indicator_color6 Red
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 1
#property indicator_width4 1
#property indicator_width5 1
#property indicator_width6 1
#property indicator_style3 STYLE_DOT
#property indicator_style4 STYLE_DOT
#property indicator_style5 STYLE_DOT
#property indicator_style6 STYLE_DOT

//---- indicator parameters
extern int  TradePeriod         = 20;     // Donchian channel period for trading signals
extern int  StopPeriod          = 10;     // Donchian channel period for exit signals
extern bool Strict              = false;  // Apply strict entry parameters like the Turtles did
extern bool DisplayAlerts       = false;  // You know...

//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double TrendDirection[];

//---- internal
static datetime TimeStamp;
static int AlertCount = 1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   // One more invisible buffer to store trend direction
   IndicatorBuffers(7);
   
   // Drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,159);
   SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,159);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
   
   // Name and labels
   IndicatorShortName("Turtle Channel ("+ TradePeriod +"-"+ StopPeriod +")");
   SetIndexLabel(0,"Upper line");
   SetIndexLabel(1,"Lower line");
   SetIndexLabel(2,"Longs Stop line");
   SetIndexLabel(3,"Shorts Stop line");
//   SetIndexBuffer(4, "Bullish trend change");
//   SetIndexBuffer(5, "Bearish trend change");
   
   // Buffers
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);    // Stop level for longs
   SetIndexBuffer(3,ExtMapBuffer4);    // Stop level for shorts
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexBuffer(6,TrendDirection);
   
   Comment("Copyright © http://www.pointzero-indicator.com");
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
     // More vars here too...
     int start = 0;
     int limit;
     int counted_bars = IndicatorCounted();

     // check for possible errors
     if(counted_bars < 0) 
        return(-1);
        
     // Only check these
     limit = Bars - 1 - counted_bars;
     if(counted_bars==0) limit-=1+1;
     
     // Check the signal foreach bar
     for(int i = limit; i >= start; i--)
     {           
         // Highs and lows
         double rhigh = iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TradePeriod,i+1));
         double rlow  = iLow(Symbol(),Period(),iLowest(Symbol(), Period(), MODE_LOW, TradePeriod, i+1));
         double shigh = iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, StopPeriod,i+1));
         double slow  = iLow(Symbol(),Period(),iLowest(Symbol(), Period(), MODE_LOW, StopPeriod, i+1));
         
         // Candle value
         double CLOSE = iClose(Symbol(),0, i);
         double HIGH = iHigh(Symbol(),0, i);
         double LOW = iLow(Symbol(),0, i);
         
         // Default behavior is to preserve the trend
         TrendDirection[i] = TrendDirection[i+1];
         
         // It might be recalculating bar zero
         ExtMapBuffer1[i] = EMPTY_VALUE;
         ExtMapBuffer2[i] = EMPTY_VALUE;
         ExtMapBuffer3[i] = EMPTY_VALUE;
         ExtMapBuffer4[i] = EMPTY_VALUE;
         ExtMapBuffer5[i] = EMPTY_VALUE;
         ExtMapBuffer6[i] = EMPTY_VALUE;
         
         // Change to uptrend
         if(((CLOSE > rhigh && i > 0) || (HIGH > rhigh && Strict == true)) && TrendDirection[i+1] != OP_BUY)
         {
            TrendDirection[i] = OP_BUY;
            ExtMapBuffer5[i] = rlow;
         
         // Change to downtrend
         } else if(((CLOSE < rlow && i > 0) || (LOW < rlow && Strict == true)) && TrendDirection[i+1] != OP_SELL) {
            
            TrendDirection[i] = OP_SELL;
            ExtMapBuffer6[i] = rhigh;
         }
         
         // Draw lines
         if(TrendDirection[i] == OP_BUY)
         {
            ExtMapBuffer1[i] = rlow;
            ExtMapBuffer3[i] = slow;
            
         // Draw lines
         } else if(TrendDirection[i] == OP_SELL) {
         
            ExtMapBuffer2[i] = rhigh;
            ExtMapBuffer4[i] = shigh;
         }
     }
     
     // Alert
     if(TimeStamp != Time[0] && DisplayAlerts == true)
     {
         if(TrendDirection[1] == OP_SELL && TrendDirection[2] == OP_BUY && AlertCount == 0)
         {
            Alert("[Turtle Trading "+ TradePeriod +"-"+ StopPeriod +"]["+ Symbol() +"] SELL");
         } else if (TrendDirection[1] == OP_BUY && TrendDirection[2] == OP_SELL && AlertCount == 0) {
            Alert("[Turtle Trading "+ TradePeriod +"-"+ StopPeriod +"]["+ Symbol() +"] BUY");
         }
         TimeStamp = Time[0];
         AlertCount = 0;
     }
    
   // Bye Bye
   return(0);
}
It should look like in the picture i added here. I also marked the example of the PZ Turtle with arrows on the second picture,
Far as I can remember there is not a bb stop in the versions I have seen.


Re: MT4 Indicator requests and ideas

7732
mrtools wrote: Wed Dec 18, 2019 11:38 am

Far as I can remember there is not a bb stop in the versions I have seen.
But that small line after the big blue and red line is a BB stop I think. I just removed the main lines and made the small lines big so I can use them for the system. I just need to move them one candle to the left. I encircled the line I use in orange.
Attachments

Re: MT4 Indicator requests and ideas

7734
mrtools wrote: Sun May 26, 2019 12:05 pm

This is what Mladen said about the Henderson filter, it recaluates(repaint)

Henderson's Filter for MetaTrader 5. According to a brief description:

What are the Henderson trend filters?

The Henderson Filters are a widely used set of trend filters, or smoothers. They were initially derived by Robert Henderson (1916) for use in actuarial work. They are also used within the X-11 family of seasonal adjustment packages, e.g. X-12-ARIMA. The Henderson Filters can be used separately, for example, the Australian Bureau of Statistics uses them to calculate trend estimates from the seasonally adjusted estimates.

The requirement used by Henderson to derive the filters was that they must follow a local cubic polynomial without distortion. The Henderson Filters are derived by minimizing the sum of squares of the third difference of the moving average series. Henderson's criteria ensures that when these filters are applied to third degree polynomials, the resulting smoothed output will fit exactly on these parabolas. The Henderson Filters are suitable for smoothing economic time series as they allow the cycles typical of the trend to pass through unchanged. They also have the property that they will eliminate almost all the irregular variations that are of very short frequencies of six months or less.

The filter weights applied in the middle of a time series are symmetric, while the end filter weights are asymmetric. This is due to the standard end point problem where at the start and end of the series there is not enough data on either side of the data points to generate symmetric filter weights. In practice, the impact of this can be reduced by generating separate forecasts and then applying the symmetric filter weights, e.g. by using ARIMA methods.

More information can be found here.

PS: be aware that Henderson's filters are from a family of centered smoothers, i.e. they recalculate half period bars.
Mr Tools / Mr Mladen - I am using this indicator for my trading purpose. How to add time setting?. That is once I attach this indicator I need to get signals only between the time I PREFER to trade. For example If I WANT to trade between morning 9.30 AM to evening 3.30 PM IST (Indian standard time), I SHOULD have the choice to set both timings and the signals generated during this interval only to be taken by EA.

If I straightaway attach the indi then it is taking the last signal of the previous day as the first entry of today.

Please help / advice.

Regards

ARSD

Re: MT4 Indicator requests and ideas

7735
mrtools wrote: Sun May 26, 2019 12:00 pm

Added the dots.
Mr Tools / Mr Mladen - I am using this indicator for my trading purpose. How to add time setting?. That is once I attach this indicator I need to get signals only between the time I PREFER to trade. For example If I WANT to trade between morning 9.30 AM to evening 3.30 PM IST (Indian standard time), I SHOULD have the choice to set both timings and the signals generated during this interval only to be taken by EA.

If I straightaway attach the indi then it is taking the last signal of the previous day as the first entry of today.

Please help / advice.

Regards

ARSD


Re: MT4 Indicator requests and ideas

7738
euro_rapp wrote: Wed Dec 18, 2019 11:53 am
But that small line after the big blue and red line is a BB stop I think. I just removed the main lines and made the small lines big so I can use them for the system. I just need to move them one candle to the left. I encircled the line I use in orange.
Image
Attachments
These users thanked the author moey_dw for the post:
sizabici
Official Forex-station GIF animator at your service 👨‍⚖️
See a GIF with Forex-station.com on it? I probably made it
The best divergence indicator in the world.
Real news exists: Infowars.com 👈

Re: MT4 Indicator requests and ideas

7739
mrtools wrote: Sun May 26, 2019 12:00 pm

Added the dots.
Mr Tools / Mr Mladen - I am using this indicator for my trading purpose. How to add time setting?. That is once I attach this indicator I need to get signals only between the time I PREFER to trade. For example If I WANT to trade between morning 9.30 AM to evening 3.30 PM IST (Indian standard time), I SHOULD have the choice to set both timings and the signals generated during this interval only to be taken by EA.

If I straightaway attach the indi then it is taking the last signal of the previous day as the first entry of today.

Please help / advice.

Regards

ARSD


Who is online

Users browsing this forum: NotInPortland, SEMrush [Bot], Skyold and 64 guests