Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
Could someone share a sample code of an indicator that would take the values of two custom indicators on chart at the bar close, and based on that, either give an alert, or draw coloured bars, it does not really matter what it does.
For example, we have two LWMAs on the chart with different period settings. As the bar closes, the indicator would compare their values, and if the shorter one is higher than the longer, it would draw a blue bar in a separate window. As simple as that.
I need it for my mql studies, I'm a bit overwhelmed with theory now and want to do something practical. Thanks in advance!
How to call Function when when the trade is execuating ?
Please help me
how I call a funcion when the trade is executing when opening new trade or closing a trade or creating a pending order, I I want to call function
Please help me
how I call a funcion when the trade is executing when opening new trade or closing a trade or creating a pending order, I I want to call function
What function do you want to call? Not really sure what you're question is.
This is a program which will use Supertrend indicator using iCustom:
Code:
#property copyright "Coders Guru"
#property link "http://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
int start()
{
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 pos=Bars-counted_bars;
while(pos>=0)
{
ExtMapBuffer1[pos] = iCustom(NULL, 0, "SuperTrend",0,0,pos);
ExtMapBuffer2[pos] = iCustom(NULL, 0, "SuperTrend",0,1,pos);
pos--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Dear Codersguru,
Can you please take a look at the attached chart. Is it possible for you to code the attached SuperTrend indicator in candle form just like CJA did in this post? The one he attached is a .ex4 file and it crashes my FxPro and other MT4 platforms each time it is loaded but it works perfectly with Alpari UK.
i hope i´m right here to open this new thread , the idea is to post ONLY expert advisor code of ALL INDICATORS what you know for programming and test your own expert advisor .
SORRY FOR MY BAD ENGLISH.......
the form looks like a "FUNCTION" - my first examples :
if(CheckParabolicSar()== 1 {example: open order buy ....}
if(CheckParabolicSar()==-1 {example: open order sell ....}
note: parabolic sar is standard indicator , it`s not needed to attach for downloading....
-----------------------------------------------------------------------
Any help please. I am reading from and indicator into an EA using icustom, during backtest the trend runs quite happily, then for some reason the icustom parameters reverse so my trend is going up instead of down even though the indicator is showing down after the trade is activated i corrects itself then happens again some time later
__________________
New to Forex? Get all you need for Free at my site Click Here
You can also get my Hot Forex System (scroll to the bottom of the page): Click Here
Any help please. I am reading from and indicator into an EA using icustom, during backtest the trend runs quite happily, then for some reason the icustom parameters reverse so my trend is going up instead of down even though the indicator is showing down after the trade is activated i corrects itself then happens again some time later
mmm so the indicator seems to be the problem it is SuperTrend volty like but I have had the problem with other non repainting indicators such as FX Sniper Ergodic and Fisher.
The challenge seems to be that there are many times when the indicator points in a direction say down, but the start point of the move ends up being lower than the finish causing the indicator to show down but the data reads up.
Any comment s on this, does anyone have a non repainting indicator that does not do this, or any other solution?
Please see attached pic
__________________
New to Forex? Get all you need for Free at my site Click Here
You can also get my Hot Forex System (scroll to the bottom of the page): Click Here
i need some help with the ea im trying to create. this ea will be used to close position based on the color of the indicator but i'll open the position manually. since i don't have the decompile version the indicator, i think icustom is the way to go.
but how do i call the function based on the color?
eg. if i used Heikin Ashi_SW and i want to close sell position when the color is blue after the bar is closed and vice versa.
I have a simple Custom Indicator with no externs called #TestIndicator that fills 8 buffers with the number 1.0 but when I bring back the buffers in my EA the buffer results are always 0 . Can you help me with this.
#TestIndicator
Code:
#property indicator_chart_window
#property indicator_buffers 8
double buf4_up[];
double buf4_down[];
double buf3_up[];
double buf3_down[];
double buf2_up[];
double buf2_down[];
double buf1_up[];
double buf1_down[];
int UniqueNum = 0070;
string shortname = "";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
shortname = "#TFX";
IndicatorBuffers(8);
IndicatorShortName(shortname);
//---- indicators
SetIndexBuffer(0,buf4_up);
SetIndexBuffer(1,buf4_down);
SetIndexBuffer(2,buf3_up);
SetIndexBuffer(3,buf3_down);
SetIndexBuffer(4,buf2_up);
SetIndexBuffer(5,buf2_down);
SetIndexBuffer(6,buf1_up);
SetIndexBuffer(7,buf1_down);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
//---- the last calculated bar will be recalculated
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars - 1;
//---- the main cycle
for(int i = limit; i >= 0; i--)
{
//----
buf4_up[i]=1.0;
buf4_down[i]=1.0;
buf3_up[i]=1.0;
buf3_down[i]=1.0;
buf2_up[i]=1.0;
buf2_down[i]=1.0;
buf1_up[i]=1.0;
buf1_down[i]=1.0;
}
//----
//----
//----
return(0);
}
//+------------------
EA Code
Code:
double test4_up[];
double test4_down[];
double test3_up[];
double test3_down[];
double test2_up[];
double test2_down[];
double test1_up[];
double test1_down[];
int UniqueNum = 009;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
Print("Inside init");
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Print("Inside deinit");
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
Print("Inside start");
int counted_bars=IndicatorCounted();
int y5m=0, y1h=0, y30m=0, y15m=0, yy=0;
int i=0;
int limit=Bars-counted_bars;
for(i=0;i<limit;i++)
{
test4_up[i] = iCustom(NULL, 0, "#TestIndicator",0,i);
test4_down[i] = iCustom(NULL, 0, "#TestIndicator",1,i);
}
for(i=0;i<30;i++)
{
Print("Test 4 UP ", test4_up[i]," Bar ",i );
Print("Test 4 DOWN ", test4_down[i]," Bar ",i );
//Print("This is a test");
}
//----
return(0);
}
//+---------