i want afl codings for the mt4 files

#1
#property copyright "Copyright Forexprofitkeeper"
#property link "www.forexprofitkeeper.com"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Lime //FPK_MACD up
#property indicator_color2 Magenta //FPK_MACD up
#property indicator_color3 Yellow //Upperband
#property indicator_color4 Yellow //Lowerband




extern int FastLen = 12;
extern int SlowLen = 26;
extern int Length = 10;
extern int barsCount = 400;
extern double StDv = 2.5;
extern double buff = 0.1;
extern bool alertsOn = true;
extern bool alertsMessageBox = true;
extern bool alertsSound = false;
extern string alertsSoundFile = "TP1M.wav"; //enterSoundFile
extern bool alertsEmail = false;
extern bool alertsAfterBarClose = true;
//----
int loopbegin;
int shift;
double zeroline;
//---- indicator buffers
double ExtMapBuffer1[]; // FPK_MACD
double ExtMapBuffer2[]; // FPK_MACD
double ExtMapBuffer3[]; // Upperband Line
double ExtMapBuffer4[]; // Lowerband Line
//---- buffers
double bbMacd[];
double Upperband[];
double Lowerband[];
double avg[];
double bbMacdline;
double sDev;
double mean;
double sumSqr;
double sslHup[];
double sslHdn[];
double hlv[];
double hlv2[];
double sslHup1[];
double sslHdn1[];
double hlv1[];
int levdr = 0;
double alertTag;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 6 additional buffers are used for counting.
IndicatorBuffers(8);
//---- drawing settings
SetIndexBuffer(0, ExtMapBuffer1); // FPK_MACD line
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0, 108);
IndicatorDigits(Digits + 1);
//----
SetIndexBuffer(1, ExtMapBuffer2); // FPK_MACD line
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1, 108);
IndicatorDigits(Digits + 1);
//----
SetIndexBuffer (2,sslHup1); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,108); SetIndexLabel(2,"cross");


SetIndexBuffer(4, bbMacd);
SetIndexBuffer(5, hlv1);
SetIndexBuffer(6, Lowerband);
SetIndexBuffer(7, avg);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("FPK_MACD(" + FastLen + "," + SlowLen + "," + Length+")");
SetIndexLabel(0, "bbMacd");
SetIndexLabel(1, "Upperband");
SetIndexLabel(2, "Lowerband");
//---- initialization done
Comment("Copyright http://www.forexprofitkeeper.com");
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom FPK_MACD |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
if (barsCount > 0)
limit = MathMin(Bars - counted_bars,barsCount);
else limit = Bars - counted_bars;
//----
for(int i = 0; i < limit; i++)
bbMacd = iMA(NULL, 0, FastLen, 0, MODE_EMA, PRICE_CLOSE, i) -
iMA(NULL, 0, SlowLen, 0, MODE_EMA, PRICE_CLOSE, i);

sslHup1 = iCustom(NULL,levdr,"",0, 3,i);
sslHdn1 = iCustom(NULL,levdr,"", 0, 4,i);
//----
for(i = 0; i < limit; i++)
{
avg = iMAOnArray(bbMacd, 0, Length, 0, MODE_EMA, i);
sDev = iStdDevOnArray(bbMacd, 0, Length, MODE_EMA, 0, i);

ExtMapBuffer1=bbMacd; // Uptrend FPK_MACD
ExtMapBuffer2=bbMacd; // downtrend FPK_MACD

//----
if(bbMacd > 0)
ExtMapBuffer2 = EMPTY_VALUE;


//----
if(bbMacd < 0)
ExtMapBuffer1 = EMPTY_VALUE;

if (alertsOn==true && i==1 && bbMacd > 0 && bbMacd[i+1] < 0 && alertTag!=Time[0]){
Alert("FPK_MACD crossing O on the upside on ",Symbol()," ",Period());
alertTag = Time[0];
}
if (alertsOn==true && i==1 && bbMacd < 0 && bbMacd[i+1] > 0 && alertTag!=Time[0]){
Alert("FPK_MACD crossing O on the downside on ",Symbol()," ",Period());
alertTag = Time[0];

}

sslHup1 = EMPTY_VALUE;
}

for(i=limit;i>=0;i--)
{

if((bbMacd[i+2] < 0 && bbMacd[i+1]>buff*Point) || (bbMacd[i+2] > 0 && bbMacd[i+1]<-buff*Point) || (bbMacd[i+2] < buff*Point && bbMacd[i+1]>buff*Point) || (bbMacd[i+2] > -buff*Point && bbMacd[i+1]<-buff*Point)) hlv1 = 1;
else hlv1 = - 1;




if(hlv1 == -1) { sslHup1 = EMPTY_VALUE; }
if(hlv1 == 1) { sslHup1[i+1] = levdr; }
if(bbMacd[i+2] < 0 && bbMacd[i+1]>buff*Point) hlv = 1;
if(bbMacd[i+2] > 0 && bbMacd[i+1]<-buff*Point) hlv2 = 1;







}
//---- done
return(0);
}
 
#2
#property copyright "Copyright Forexprofitkeeper"
#property link "www.forexprofitkeeper.com"


#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 RoyalBlue
#property indicator_color3 Gold
//---- input parameters
extern int Minutes=30;
extern int MACD_Fast = 12;
extern int MACD_Slow = 26;
extern int MACD_MA = 9;
extern int BarsToCount = 1000;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double Ma;
double hhigh, llow;
double Psar;
double PADX,NADX;
string TimeFrameStr;
double MA1,MA2,MA3;
double MACD_Signal,MACD_Main;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,4,Red);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4, RoyalBlue);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,4, Gold);
SetIndexBuffer(2,ExtMapBuffer3);

switch(Minutes)
{
case 1 : TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe"; Minutes=0;
}
IndicatorShortName("FPK_FT ("+TimeFrameStr+")");


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----

for (int i = 0; i < BarsToCount; i++){
ExtMapBuffer1=0;
ExtMapBuffer2=0;
ExtMapBuffer3=0;


MACD_Signal=iMACD(NULL,Minutes,MACD_Fast,MACD_Slow,MACD_MA,PRICE_CLOSE,MODE_SIGNAL,i);
MACD_Main =iMACD(NULL,Minutes,MACD_Fast,MACD_Slow,MACD_MA,PRICE_CLOSE,MODE_MAIN,i);

if(MACD_Signal < MACD_Main && MACD_Main > 0)ExtMapBuffer2 = 1;
if(MACD_Signal > MACD_Main && MACD_Main < 0)ExtMapBuffer1 = 1;
if(ExtMapBuffer1 == 0 && ExtMapBuffer2 == 0)
{ExtMapBuffer3 = 1;}

}




//----
return(0);
}
//+------------------------------------------------------------------+
 

saivenkat

Well-Known Member
#3
Dont Get Carried Away with the Colorful blue dots on the indicator on the bottom pane... Its Macd..only..

And those in bottom half of the image in the site .. is useless.. you cant take a decision based on the color of the band.. as the band changes color very often.. Will recalculate... Only at the end of the day you could see a beautiful colorful chart...

May be you find some sort of usefulness when you stick on Timeframes not less than 4 hr or so..

Have they shown their performance of Indicator in Sluggish market, i mean higly volatile.. and when its clinging on Congested zones.. never... because.. your SL will hitting more often..

So, my two cents are.. just google this forum... you would have more number of indicators/strategies that would be suffice for us to trade.. I came to this conclusion.. after years together chasing the MT4 indicators / EA's and nothing .. i found .. useful enough.. mere waste of time and energy...
 
#4
Hi saivenkat

thanks for one great hint.
real trend is visible on 4 hr charts if you have enough data.

Mostly guys using horizontal s&r end up screwed.
It is the trendlines drawn on 4 hr tf that can put the trader on reality outlook.
the trendlines may be 4,low speed small slope initial trendline,secondgear higher sloped trendline,thirdgear over60 degree sloped trendline.once the zone of next trendline begines,price wont go back to previous trendlinebase.

combining the trendline support and fibonacci valid support is the clue for success.
Property of trendline= price starts from it to rise then falls to it,begins rise again. buy at low risk on trendline touch.
fib support property= price retraces to it and begins bounce off it.
 
#6
Dont Get Carried Away with the Colorful blue dots on the indicator on the bottom pane... Its Macd..only..

And those in bottom half of the image in the site .. is useless.. you cant take a decision based on the color of the band.. as the band changes color very often.. Will recalculate... Only at the end of the day you could see a beautiful colorful chart...

May be you find some sort of usefulness when you stick on Timeframes not less than 4 hr or so..

Have they shown their performance of Indicator in Sluggish market, i mean higly volatile.. and when its clinging on Congested zones.. never... because.. your SL will hitting more often..

So, my two cents are.. just google this forum... you would have more number of indicators/strategies that would be suffice for us to trade.. I came to this conclusion.. after years together chasing the MT4 indicators / EA's and nothing .. i found .. useful enough.. mere waste of time and energy...
sir, can you suggest me which indicator/afl is best for trading
 

rvlv

Active Member
#7
i am looking for amibroker formula for this mt4 code half trend indicator
can somebody help me please
========================
//+----------------------------------------------------------------------+
//| HalfTrend.mq4 |
///+----------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 DodgerBlue // up[]
#property indicator_width1 2
#property indicator_color2 Red // down[]
#property indicator_width2 2
#property indicator_color3 DodgerBlue // atrlo[]
#property indicator_width3 1
#property indicator_color4 Red // atrhi[]
#property indicator_width4 1
#property indicator_color5 DodgerBlue // arrup[]
#property indicator_width5 1
#property indicator_color6 Red // arrdwn[]
#property indicator_width6 1


extern int Amplitude = 2;
extern bool ShowBars = true;
extern bool ShowArrows = true;
extern bool alertsOn = true;
extern bool alertsOnCurrent = false;
extern bool alertsMessage = true;
extern bool alertsSound = true;
extern bool alertsEmail = false;

bool nexttrend;
double minhighprice,maxlowprice;
double up[],down[],atrlo[],atrhi[],trend[];
double arrup[],arrdwn[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(7); // +1 buffer - trend[]

SetIndexBuffer(0,up);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,down);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(2,atrlo);
SetIndexBuffer(3,atrhi);
SetIndexBuffer(6,trend);
SetIndexBuffer(4,arrup);
SetIndexBuffer(5,arrdwn);
SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(6,0.0);

if(ShowBars)
{
SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM, STYLE_SOLID);
}
else
{
SetIndexStyle(2,DRAW_NONE);
SetIndexStyle(3,DRAW_NONE);
}
if(ShowArrows)
{
SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID); SetIndexArrow(4,233);
SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID); SetIndexArrow(5,234);
}
else
{
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_NONE);
}


nexttrend=0;
minhighprice= High[Bars-1];
maxlowprice = Low[Bars-1];
return (0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
class CFix { } ExtFix;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double atr,lowprice_i,highprice_i,lowma,highma;
int workbar=0;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i=Bars-1; i>=0; i--)
{
lowprice_i=iLow(Symbol(),Period(),iLowest(Symbol(),Period(),MODE_LOW,Amplitude,i));
highprice_i=iHigh(Symbol(),Period(),iHighest(Symbol(),Period(),MODE_HIGH,Amplitude,i));
lowma=NormalizeDouble(iMA(NULL,0,Amplitude,0,MODE_SMA,PRICE_LOW,i),Digits());
highma=NormalizeDouble(iMA(NULL,0,Amplitude,0,MODE_SMA,PRICE_HIGH,i),Digits());
trend=trend[i+1];
atr=iATR(Symbol(),0,100,i)/2;

arrup = EMPTY_VALUE;
arrdwn = EMPTY_VALUE;
if(nexttrend==1)
{
maxlowprice=MathMax(lowprice_i,maxlowprice);

if(highma<maxlowprice && Close<Low[i+1])
{
trend=1.0;
nexttrend=0;
minhighprice=highprice_i;
}
}
if(nexttrend==0)
{
minhighprice=MathMin(highprice_i,minhighprice);

if(lowma>minhighprice && Close>High[i+1])
{
trend=0.0;
nexttrend=1;
maxlowprice=lowprice_i;
}
}
if(trend==0.0)
{
if(trend[i+1]!=0.0)
{
up=down[i+1];
up[i+1]=up;
arrup = up - 2*atr;
}
else
{
up=MathMax(maxlowprice,up[i+1]);
}
atrhi = up - atr;
atrlo = up;
down=0.0;
}
else
{
if(trend[i+1]!=1.0)
{
down=up[i+1];
down[i+1]=down;
arrdwn = down + 2*atr;
}
else
{
down=MathMin(minhighprice,down[i+1]);
}
atrhi = down + atr;
atrlo = down;
up=0.0;
}
}
manageAlerts();
return (0);
}
//+------------------------------------------------------------------+
//+-------------------------------------------------------------------
//|
//+-------------------------------------------------------------------
//
//
//
//
//

void manageAlerts()
{
if (alertsOn)
{
if (alertsOnCurrent)
int whichBar = 0;
else whichBar = 1;
if (arrup[whichBar] != EMPTY_VALUE) doAlert(whichBar,"up");
if (arrdwn[whichBar] != EMPTY_VALUE) doAlert(whichBar,"down");
}
}

//
//
//
//
//

void doAlert(int forBar, string doWhat)
{
static string previousAlert="nothing";
static datetime previousTime;
string message;

if (previousAlert != doWhat || previousTime != Time[forBar]) {
previousAlert = doWhat;
previousTime = Time[forBar];

//
//
//
//
//

message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," HalfTrend signal ",doWhat);
if (alertsMessage) Alert(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol(),"HalfTrend "),message);
if (alertsSound) PlaySound("alert2.wav");
}
}
 

rvlv

Active Member
#8
here is some info on half trend indicator
by the way it is free on tradingview(name is extremetrend)
https://www.tradingview.com/script/U1SJ8ubc-HalfTrend/
-------------------------------------------------------------------

Half Trend Buy Sell Indicator is a Moving Average based market trend identifying tool that suits all sorts of trading styles. This indicator can signal both the trend and trade at the same time.

It can be applied to trade all kinds of forex currency pairs within the MT4 trading platforms and fits with all sorts of timeframe charts.

The Indicator demonstrates the trend signals in a much simpler way so that everybody including newbies can apply it for real trading purposes. Besides, it can also be added to other trend-following systems for better performance.



Half Trend Buy Sell Indicator calculates the open and close of the price bars over the selected period of time and applies its own calculation method to find an average line of the price movement. This slope works like a moving average.

It turns blue and price moves above its level mean the market is in a bullish trend. On the contrary, price drops below its level and the slope turns red when the market is in a bearish trend.

This indicator plots up/downward arrows around the price candles pointing the direction of possible trade entries.
Half Trend: Buy Condition

  • Price moves above the indicator slope
  • Half Indicator turns blue
  • A blue upward arrow appears below the price candle
  • Set stop loss below the indicator level
  • Exit long/take profit whenever a red downward arrow appears above the price bar


  • Price moves below the indicator slope
  • Half Indicator turns red
  • A red downward arrow appears above the price candle
  • Set stop loss above the indicator level
  • Exit short/take profit whenever a blue upward arrow appears below the price bar
 

Similar threads